| 
									
										
										
										
											2016-03-12 18:50:43 +00:00
										 |  |  | #!/bin/bash | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | cat > test.js << EOF | 
					
						
							|  |  |  | var task = new Task(); | 
					
						
							|  |  |  | task.activate(); | 
					
						
							| 
									
										
										
										
											2016-04-16 21:30:52 +00:00
										 |  |  | task.execute({name: "child.js", source: File.readFile("child.js")}).then(function() { | 
					
						
							| 
									
										
										
										
											2016-03-12 18:50:43 +00:00
										 |  |  | 	task.getExports().then(function(exports) { | 
					
						
							|  |  |  | 		return exports.add(1, 1); | 
					
						
							|  |  |  | 	}).then(function(sum) { | 
					
						
							|  |  |  | 		if (sum == 2) { | 
					
						
							|  |  |  | 			exit(0); | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			exit(1); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | EOF | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | cat > child.js << EOF | 
					
						
							|  |  |  | exports = { | 
					
						
							|  |  |  | 	add: function(left, right) { | 
					
						
							|  |  |  | 		return left + right; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | EOF | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-13 13:37:58 +00:00
										 |  |  | $TILDEFRIENDS test.js |