Пример #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
Пример #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)
Пример #3
0
 def test_valid_position_arguments(self):
     compile.compile_source.return_value = "xxxx"
     compile.main([self.jsio_path])
     assert compile.compile_source.called
Пример #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)
Пример #5
0
 def test_valid_position_arguments(self):
     compile.compile_source.return_value = "xxxx"
     compile.main([self.jsio_path])
     assert compile.compile_source.called
Пример #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)