You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SublimeKSP uses unittest for testing.
The documentation can be found here with instructions on how to run tests
We need tests to check if code if compiled correctly
We need tests to check if errors are identified correctly
Look at other tests for examples.
This is a good first issue if you are looking to contribute!
If you need any more guidance, feel free to contact me :))
Tests needed:
Additional Macro Tests
Const Blocks
Structs
UI Arrays
Multidimensional Arrays
Lists
Open Size Arrays
Persistence Handling
UI Functions (set_button_properties etc.)
String Array Initialisation
Array Concat
If you find any tests that are needed then please add!
Examples
Example for comparing outputs
classForLoop(unittest.TestCase):
deftestForLoopBasic(self):
code=''' on init declare i for i := 0 to 10 message(i) end for end on'''expected_output=''' on init declare $i $i := 0 while ($i<=10) message($i) inc($i) end while end on'''output=do_compile(code, remove_preprocessor_vars=True)
output= [l.strip() forlinoutput.split('\n') ifl]
expected_output= [l.strip() forlinexpected_output.split('\n') ifl]
self.assertEqual(output, expected_output)
Example to check if a line is in the output
classPropertyTests(unittest.TestCase):
deftestAlias1(self):
code=''' on init declare a property b -> a message(b) end on '''output=do_compile(code)
self.assertTrue('message($a)'inoutput)
Example to check if an error raised
classTypeChecks(unittest.TestCase):
deftestAssignStringToIntVar1(self):
code=''' on init declare x := 'test' end on'''self.assertRaises(ParseException, do_compile, code, extra_syntax_checks=True)
The text was updated successfully, but these errors were encountered:
mkruselj
changed the title
Add tests for preprocesser plugins
Add tests for preprocessor plugins
Dec 21, 2022
SublimeKSP uses unittest for testing.
The documentation can be found here with instructions on how to run tests
We need tests to check if code if compiled correctly
We need tests to check if errors are identified correctly
Look at other tests for examples.
This is a good first issue if you are looking to contribute!
If you need any more guidance, feel free to contact me :))
Tests needed:
If you find any tests that are needed then please add!
Examples
Example for comparing outputs
Example to check if a line is in the output
Example to check if an error raised
The text was updated successfully, but these errors were encountered: