diff --git a/tested/languages/typescript/linter.py b/tested/languages/typescript/linter.py index 590c6559..e3d719b2 100644 --- a/tested/languages/typescript/linter.py +++ b/tested/languages/typescript/linter.py @@ -14,7 +14,6 @@ def run_eslint( config: DodonaConfig, remaining: float ) -> tuple[list[Message], list[AnnotateCode]]: - """ Calls eslint to annotate submitted source code and adds resulting score and annotations to tab. diff --git a/tests/test_functionality.py b/tests/test_functionality.py index 88e74cc5..29b0beb5 100644 --- a/tests/test_functionality.py +++ b/tests/test_functionality.py @@ -105,7 +105,9 @@ def test_generic_exception_wrong_error( assert updates.find_status_enum() == ["wrong"] -@pytest.mark.parametrize("lang", ["python", "java", "kotlin", "csharp", "typescript", "javascript"]) +@pytest.mark.parametrize( + "lang", ["python", "java", "kotlin", "csharp", "typescript", "javascript"] +) def test_assignment_and_use_in_expression( lang: str, tmp_path: Path, pytestconfig: pytest.Config ): @@ -156,7 +158,9 @@ def test_assignment_and_use_in_expression_list( assert len(updates.find_all("start-test")) == 1 -@pytest.mark.parametrize("lang", ["python", "java", "kotlin", "csharp", "typescript", "javascript"]) +@pytest.mark.parametrize( + "lang", ["python", "java", "kotlin", "csharp", "typescript", "javascript"] +) def test_crashing_assignment_with_before( lang: str, tmp_path: Path, pytestconfig: pytest.Config ): @@ -237,6 +241,7 @@ def test_missing_key_types_detected_js_dictionary( assert len(updates.find_all("start-testcase")) == 1 assert updates.find_status_enum() == ["correct"] + def test_missing_key_types_detected_ts_object( tmp_path: Path, pytestconfig: pytest.Config ): @@ -356,7 +361,8 @@ def test_batch_compilation_no_fallback_runtime( @pytest.mark.parametrize( - "lang", ["python", "java", "c", "javascript", "typescript", "kotlin", "bash", "csharp"] + "lang", + ["python", "java", "c", "javascript", "typescript", "kotlin", "bash", "csharp"], ) def test_program_params(lang: str, tmp_path: Path, pytestconfig: pytest.Config): conf = configuration(pytestconfig, "sum", lang, tmp_path, "short.tson", "correct") diff --git a/tests/test_language_quircks.py b/tests/test_language_quircks.py index 61c4ed88..7ee0e5d2 100644 --- a/tests/test_language_quircks.py +++ b/tests/test_language_quircks.py @@ -36,6 +36,7 @@ def test_javascript_vanilla_object(tmp_path: Path, pytestconfig: pytest.Config): updates = assert_valid_output(result, pytestconfig) assert updates.find_status_enum() == ["correct"] + def test_typescript_vanilla_object(tmp_path: Path, pytestconfig: pytest.Config): conf = configuration( pytestconfig, @@ -49,6 +50,7 @@ def test_typescript_vanilla_object(tmp_path: Path, pytestconfig: pytest.Config): updates = assert_valid_output(result, pytestconfig) assert updates.find_status_enum() == ["correct"] + def test_python_input_prompt_is_ignored(tmp_path: Path, pytestconfig: pytest.Config): conf = configuration( pytestconfig, @@ -89,7 +91,9 @@ def test_haskell_function_arguments_without_brackets( @pytest.mark.parametrize("lang", ["javascript", "typescript"]) -def test_js_ts_exception_correct(lang:str, tmp_path: Path, pytestconfig: pytest.Config): +def test_js_ts_exception_correct( + lang: str, tmp_path: Path, pytestconfig: pytest.Config +): conf = configuration( pytestconfig, "js-ts-exceptions", @@ -105,7 +109,9 @@ def test_js_ts_exception_correct(lang:str, tmp_path: Path, pytestconfig: pytest. @pytest.mark.parametrize("lang", ["javascript", "typescript"]) -def test_js_ts_exception_correct_temp(lang:str, tmp_path: Path, pytestconfig: pytest.Config): +def test_js_ts_exception_correct_temp( + lang: str, tmp_path: Path, pytestconfig: pytest.Config +): conf = configuration( pytestconfig, "js-ts-exceptions", @@ -121,7 +127,7 @@ def test_js_ts_exception_correct_temp(lang:str, tmp_path: Path, pytestconfig: py @pytest.mark.parametrize("lang", ["javascript", "typescript"]) -def test_js_ts_exception_wrong(lang:str, tmp_path: Path, pytestconfig: pytest.Config): +def test_js_ts_exception_wrong(lang: str, tmp_path: Path, pytestconfig: pytest.Config): conf = configuration( pytestconfig, "js-ts-exceptions", @@ -137,7 +143,9 @@ def test_js_ts_exception_wrong(lang:str, tmp_path: Path, pytestconfig: pytest.Co @pytest.mark.parametrize("lang", ["javascript", "typescript"]) -def test_js_ts_exception_wrong_null(lang:str, tmp_path: Path, pytestconfig: pytest.Config): +def test_js_ts_exception_wrong_null( + lang: str, tmp_path: Path, pytestconfig: pytest.Config +): conf = configuration( pytestconfig, "js-ts-exceptions", @@ -154,7 +162,7 @@ def test_js_ts_exception_wrong_null(lang:str, tmp_path: Path, pytestconfig: pyte @pytest.mark.parametrize("lang", ["javascript", "typescript"]) def test_js_ts_exception_missing_message( - lang:str, tmp_path: Path, pytestconfig: pytest.Config + lang: str, tmp_path: Path, pytestconfig: pytest.Config ): conf = configuration( pytestconfig, @@ -181,6 +189,7 @@ def test_javascript_async(exercise: str, tmp_path: Path, pytestconfig: pytest.Co updates = assert_valid_output(result, pytestconfig) assert updates.find_status_enum() == ["correct"] + @pytest.mark.parametrize("exercise", ["echo-function-file-input", "echo-function"]) def test_typescript_async(exercise: str, tmp_path: Path, pytestconfig: pytest.Config): conf = configuration( diff --git a/tests/test_linters.py b/tests/test_linters.py index 332e3cfb..ff3037df 100644 --- a/tests/test_linters.py +++ b/tests/test_linters.py @@ -59,6 +59,7 @@ def test_eslint(tmp_path: Path, config: dict, pytestconfig: pytest.Config): updates = assert_valid_output(result, pytestconfig) assert len(updates.find_all("annotate-code")) > 0 + @pytest.mark.parametrize("config", _get_config_options("typescript")) def test_eslint_typescript(tmp_path: Path, config: dict, pytestconfig: pytest.Config): conf = configuration( diff --git a/tests/test_oracles_programmed.py b/tests/test_oracles_programmed.py index 166a721c..f3f491dd 100644 --- a/tests/test_oracles_programmed.py +++ b/tests/test_oracles_programmed.py @@ -105,7 +105,9 @@ def test_missing_custom_check_function(tmp_path: Path, pytestconfig: pytest.Conf assert len(updates.find_all("append-message")) == 4 -@pytest.mark.parametrize("lang", ["python", "java", "kotlin", "javascript", "csharp"]) +@pytest.mark.parametrize( + "lang", ["python", "java", "kotlin", "javascript", "typescript", "csharp"] +) def test_custom_check_function_lotto_correct( lang: str, tmp_path: Path, pytestconfig: pytest.Config ): @@ -118,7 +120,9 @@ def test_custom_check_function_lotto_correct( assert updates.find_status_enum() == ["correct"] -@pytest.mark.parametrize("lang", ["python", "java", "kotlin", "javascript", "csharp"]) +@pytest.mark.parametrize( + "lang", ["python", "java", "kotlin", "javascript", "typescript", "csharp"] +) def test_custom_check_function_lotto_wrong( lang: str, tmp_path: Path, pytestconfig: pytest.Config ): diff --git a/tests/test_problem_statements.py b/tests/test_problem_statements.py index f4a095b3..fb161aa1 100644 --- a/tests/test_problem_statements.py +++ b/tests/test_problem_statements.py @@ -30,6 +30,7 @@ def test_small_descriptions(language: str): ("c", "this_is_a_function_name"), ("kotlin", "thisIsAFunctionName"), ("javascript", "thisIsAFunctionName"), + ("typescript", "thisIsAFunctionName"), ("haskell", "thisIsAFunctionName"), ("runhaskell", "thisIsAFunctionName"), ], @@ -71,6 +72,11 @@ def test_template_function_name(lang: str, expected: str): ("javascript", "'text'", "string"), ("javascript", '"sequence", "integer"', "array"), ("javascript", '"array", ("set", ("integer", ))', "array>"), + ("typescript", "'integer'", "number"), + ("typescript", "'real'", "number"), + ("typescript", "'text'", "string"), + ("typescript", '"sequence", "integer"', "array"), + ("typescript", '"array", ("set", ("integer", ))', "array>"), ("haskell", "'integer'", "Int"), ("haskell", "'real'", "Double"), ("haskell", "'text'", "String"), @@ -99,6 +105,8 @@ def test_template_type_name(lang: str, tested_type: Any, expected: str): ("kotlin", "'map'", "map"), ("javascript", "'sequence'", "sequence"), ("javascript", "'map'", "map"), + ("typescript", "'sequence'", "sequence"), + ("typescript", "'map'", "map"), ("haskell", "'sequence'", "sequence"), ("haskell", "'list'", "list"), ], @@ -120,6 +128,8 @@ def test_template_natural_type_name(lang: str, tested_type: Any, expected: str): ("kotlin", "'map'", "afbeelding"), ("javascript", "'sequence'", "sequentie"), ("javascript", "'map'", "afbeelding"), + ("typescript", "'sequence'", "sequentie"), + ("typescript", "'map'", "afbeelding"), ("haskell", "'sequence'", "sequentie"), ("haskell", "'list'", "lijst"), ], @@ -149,6 +159,10 @@ def test_template_natural_type_name_nl(lang: str, tested_type: Any, expected: st "javascript", "let random = new Random()\nrandom.newSequence(10, 10)\n[10, 5, 2, 8, 7, 1, 3, 4, 9, 6]", ), + ( + "typescript", + "let random = new Random()\nrandom.newSequence(10, 10)\n[10, 5, 2, 8, 7, 1, 3, 4, 9, 6]", + ), ], ) def test_template_statement_expression(lang: str, expected: str): @@ -167,6 +181,7 @@ def test_template_statement_expression(lang: str, expected: str): "c", "kotlin", "javascript", + "typescript", "haskell", ], )