Ejemplo n.º 1
0
 def test_impossible_cast(self):
     util.assert_compile_succeeds(
         "resources/types_instanceof_casts/impossible_cast.slg",
         message=[
             "Impossible cast: LHS :Class1 is incompatible with RHS :Class2"
         ],
         no_warnings=False)
Ejemplo n.º 2
0
 def test_include(self):
     lib = util.assert_compile_succeeds(
         "resources/integration_include/lib.slg")
     main = util.assert_compile_succeeds(
         "resources/integration_include/main.slg", include=[lib])
     assert "0x00000003" in util.interpret(lib, main,
                                           "--print-return-value")
Ejemplo n.º 3
0
 def test_method(self):
     lib = util.assert_compile_succeeds(
         "resources/namespaces/method_lib.slg")
     main = util.assert_compile_succeeds(
         "resources/namespaces/method_main.slg", include=[lib])
     assert "0x00000005" in util.interpret(lib, main,
                                           "--print-return-value")
Ejemplo n.º 4
0
 def test_not_duplicate_method(self):
     main_path = util.assert_compile_succeeds(
         "resources/interpreter_duplicate_method_or_class/main.slg")
     not_duplicate_method_path = util.assert_compile_succeeds(
         "resources/interpreter_duplicate_method_or_class/not_duplicate_method.slg"
     )
     util.interpret(main_path, not_duplicate_method_path, expect_fail=False)
Ejemplo n.º 5
0
 def test_include(self):
     lib = util.assert_compile_succeeds(
         "resources/generic_classes/include_lib.slg")
     main = util.assert_compile_succeeds(
         "resources/generic_classes/include_main.slg", include=[lib])
     util.interpret(lib, main)
     util.interpret(main, lib)
Ejemplo n.º 6
0
 def test_duplicate_method(self):
     main_path = util.assert_compile_succeeds(
         "resources/interpreter_duplicate_method_or_class/main.slg")
     duplicate_method_path = util.assert_compile_succeeds(
         "resources/interpreter_duplicate_method_or_class/duplicate_method.slg"
     )
     assert "Duplicate method name and containing class: 'duplicate_method'" in util.interpret(
         main_path, duplicate_method_path, expect_fail=True)
Ejemplo n.º 7
0
 def test_duplicate_class(self):
     main_path = util.assert_compile_succeeds(
         "resources/interpreter_duplicate_method_or_class/main.slg")
     duplicate_class_path = util.assert_compile_succeeds(
         "resources/interpreter_duplicate_method_or_class/duplicate_class.slg"
     )
     assert "Duplicate class name: 'DuplicateClass'" in util.interpret(
         main_path, duplicate_class_path, expect_fail=True)
Ejemplo n.º 8
0
 def test_instanceof_incompatible_types(self):
     util.assert_compile_succeeds(
         "resources/types_instanceof_casts/instanceof_incompatible_types.slg",
         message=[
             ":StringSubclass always instanceof :stdlib.String",
             ":stdlib.String always instanceof :stdlib.String",
             "there cannot exist any :stdlib.String instanceof :stdlib.InputStream"
         ],
         no_warnings=False)
Ejemplo n.º 9
0
 def test_include_class_method_and_global_method_with_same_name(self):
     lib = util.assert_compile_succeeds(
         "resources/integration_include/include_class_method_and_global_method_with_same_name_lib.slg",
         no_stdlib=True)
     main = util.assert_compile_succeeds(
         "resources/integration_include/include_class_method_and_global_method_with_same_name_main.slg",
         no_stdlib=True,
         include=[lib])
     assert "0x00000003" in util.interpret(lib, main,
                                           "--print-return-value")
     assert "0x00000003" in util.interpret(main, lib,
                                           "--print-return-value")
Ejemplo n.º 10
0
 def test_inherit_interface_implementations(self):
     path = util.assert_compile_succeeds(
         "resources/interfaces/inherit_interface_implementations.slg")
     util.interpret(path)
Ejemplo n.º 11
0
 def test_linkedlist(self):
     path = util.assert_compile_succeeds(
         "resources/integration_kitchensink/linkedlist.slg")
     assert "0x0000000a" in util.interpret(path, "--print-return-value")
Ejemplo n.º 12
0
 def test_bounds(self):
     path = util.assert_compile_succeeds(
         "resources/generic_classes/bounds.slg")
     util.interpret(path)
Ejemplo n.º 13
0
 def test_reification_reuse(self):
     path = util.assert_compile_succeeds(
         "resources/generic_methods/reification_reuse.slg")
     # TODO: Figure out some way of calibrating this or do it based on memory use or something
     util.interpret(path, timeout=0.5)
Ejemplo n.º 14
0
 def test_generic_instanceof_primitive(self):
     path = util.assert_compile_succeeds(
         "resources/generic_methods/generic_instanceof_primitive.slg")
     util.interpret(path)
Ejemplo n.º 15
0
 def test_instanceof(self):
     path = util.assert_compile_succeeds(
         "resources/interfaces/instanceof.slg", no_warnings=False)
     util.interpret(path)
Ejemplo n.º 16
0
 def test_initializer(self):
     path = util.assert_compile_succeeds(
         "resources/static_variables/initializer.slg", no_warnings=False)
     util.interpret(path)
Ejemplo n.º 17
0
 def test_basic(self):
     path = util.assert_compile_succeeds(
         "resources/static_variables/basic.slg", no_warnings=False)
     util.interpret(path)
Ejemplo n.º 18
0
 def test_array_instanceof(self):
     path = util.assert_compile_succeeds(
         "resources/types_instanceof_casts/array_instanceof.slg",
         no_warnings=False)
     util.interpret(path)
Ejemplo n.º 19
0
 def test_basic(self):
     path = util.assert_compile_succeeds(
         "resources/generic_methods/basic.slg")
     util.interpret(path)
Ejemplo n.º 20
0
 def test_initializer_garbage_collection(self):
     path = util.assert_compile_succeeds(
         "resources/static_variables/initializer_garbage_collection.slg",
         no_warnings=False)
     assert "Garbage collecting" in util.interpret(path, "--gc-verbose")
Ejemplo n.º 21
0
 def test_generic_recursion(self):
     path = util.assert_compile_succeeds(
         "resources/generic_methods/generic_recursion.slg")
     util.interpret(path)
Ejemplo n.º 22
0
 def test_object_extension(self):
     path = util.assert_compile_succeeds(
         "resources/object/object_extension.slg", no_warnings=False)
     util.interpret(path)
Ejemplo n.º 23
0
 def test_generic_instanceof_type_parameter(self):
     path = util.assert_compile_succeeds(
         "resources/generic_methods/generic_instanceof_type_parameter.slg")
     util.interpret(path)
Ejemplo n.º 24
0
 def test_supercalls(self):
     path = util.assert_compile_succeeds(
         "resources/supercalls/supercalls.slg")
     util.interpret(path)
Ejemplo n.º 25
0
 def test_inherit_from_generic(self):
     path = util.assert_compile_succeeds(
         "resources/generic_classes/inherit_from_generic.slg")
     util.interpret(path)
Ejemplo n.º 26
0
 def test_supercall_statement(self):
     path = util.assert_compile_succeeds(
         "resources/supercalls/supercall_statement.slg")
Ejemplo n.º 27
0
 def test_classcallspecial_bug(self):
     path = util.assert_compile_succeeds(
         "resources/generic_classes/classcallspecial_bug.slg",
         no_warnings=False)
     util.interpret(path)
Ejemplo n.º 28
0
 def test_basic(self):
     path = util.assert_compile_succeeds("resources/interfaces/basic.slg")
     util.interpret(path)
Ejemplo n.º 29
0
 def test_whileloop(self):
     path = util.assert_compile_succeeds(
         "resources/integration_kitchensink/whileloop.slg")
     assert "0x00000032" in util.interpret(path, "--print-return-value")
Ejemplo n.º 30
0
 def test_multiple_interfaces(self):
     path = util.assert_compile_succeeds(
         "resources/interfaces/multiple_interfaces.slg")
     util.interpret(path)