forked from cory/tildefriends
		
	git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3292 ed5197a5-7fde-0310-b194-c3ffbd925b24
		
			
				
	
	
		
			29 lines
		
	
	
		
			340 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			340 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
cat > required.js << EOF
 | 
						|
function foo() {
 | 
						|
	return 12345;
 | 
						|
}
 | 
						|
 | 
						|
exports.foo = foo;
 | 
						|
EOF
 | 
						|
 | 
						|
cat > test.js << EOF
 | 
						|
if (require("required").foo() != 12345) {
 | 
						|
	exit(1);
 | 
						|
}
 | 
						|
var gotError = false;
 | 
						|
try {
 | 
						|
	require("missing");
 | 
						|
} catch (error) {
 | 
						|
	print("nope");
 | 
						|
	gotError = true;
 | 
						|
}
 | 
						|
if (!gotError) {
 | 
						|
	exit(2);
 | 
						|
}
 | 
						|
exit(0);
 | 
						|
EOF
 | 
						|
 | 
						|
$TILDEFRIENDS test.js
 |