from Check import checkMonkeySyntax
from compile_error import CompileError

import unittest

ERROR_TEST = """if (process.argv.length < 3)
	console.error("not enough args");
	process.exit(1);
}
"""

class TestStringMethods(unittest.TestCase):

	def test_syntax_ok(self):
		toTest = checkMonkeySyntax('a=1+2')
		self.assertTrue(toTest is None)
		
	def test_syntax_error(self):
		toTest = checkMonkeySyntax(ERROR_TEST)
		self.assertTrue(isinstance (toTest[0], CompileError))
		self.assertEqual(toTest[0].filename, 'toCheck.js')
		self.assertEqual(toTest[0].line, 4)
		self.assertEqual(toTest[0].column, 0)
		self.assertEqual(toTest[0].functionname, None)
		self.assertEqual(toTest[0].text, 'syntax error: }')
		self.assertEqual(toTest[0].errorname, 'SyntaxError')
	
		
if __name__ == '__main__':
    unittest.main()

@@ -1,12 +1,801 @@
+#!/usr/bin/python%0A#    Copyright 2017 Dhvani Patel%0A#%0A#    This file is part of UnnaturalCode.%0A#    %0A#    UnnaturalCode is free software: you can redistribute it and/or modify%0A#    it under the terms of the GNU Affero General Public License as published by%0A#    the Free Software Foundation, either version 3 of the License, or%0A#    (at your option) any later version.%0A#%0A#    UnnaturalCode is distributed in the hope that it will be useful,%0A#    but WITHOUT ANY WARRANTY; without even the implied warranty of%0A#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A#    GNU Affero General Public License for more details.%0A#%0A#    You should have received a copy of the GNU Affero General Public License%0A#    along with UnnaturalCode.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0A
 from Check i

Update test_monkey.py