Ejemplo n.º 1
0
    def test_hookbox_bad_import_raises_error(self):
        compile.main(self.compile_args)
        hookbox_exercising_js = """
require('nonexistent.js')
"""
        smoke_test_script_file = file(self.smoke_test_script_path, 'w')
        smoke_test_script_file.write(hookbox_exercising_js)
        smoke_test_script_file.close()
        
        run_command = ['node', self.smoke_test_script_path]
        
        expected_result = ""
        output, error = \
            Popen(run_command, stdout=PIPE, stderr=PIPE).communicate()
        assert error
Ejemplo n.º 2
0
    def test_hookbox_no_smoke_for_remote_jsio(self):
        compile.main(self.compile_args)
        hookbox_exercising_js = """
var sys = require('sys');
require.paths.push('tests/data');
require('hookbox.compiled');
"""
        smoke_test_script_file = file(self.smoke_test_script_path, 'w')
        smoke_test_script_file.write(hookbox_exercising_js)
        smoke_test_script_file.close()
        
        run_command = ['node', self.smoke_test_script_path]

        expected_result = ""
        output, error = \
            Popen(run_command, stdout=PIPE, stderr=PIPE).communicate()
        assert not error, error
        assert expected_result == output, repr(output)
Ejemplo n.º 3
0
 def test_valid_position_arguments(self):
     compile.compile_source.return_value = "xxxx"
     compile.main([self.jsio_path])
     assert compile.compile_source.called
Ejemplo n.º 4
0
 def test_invalid_position_arguments(self):
     try:
         compile.main([])
         raise Exception("an exception should have been raised")
     except SystemExit, exc:
         assert "1" == str(exc), str(exc)
Ejemplo n.º 5
0
 def test_valid_position_arguments(self):
     compile.compile_source.return_value = "xxxx"
     compile.main([self.jsio_path])
     assert compile.compile_source.called
Ejemplo n.º 6
0
 def test_invalid_position_arguments(self):
     try:
         compile.main([])
         raise Exception("an exception should have been raised")
     except SystemExit, exc:
         assert "1" == str(exc), str(exc)