diff --git a/tested/languages/haskell/generators.py b/tested/languages/haskell/generators.py index c2897db7..7d5a0c9c 100644 --- a/tested/languages/haskell/generators.py +++ b/tested/languages/haskell/generators.py @@ -241,7 +241,7 @@ def convert_execution_unit(pu: PreparedExecutionUnit) -> str: if tc.testcase.is_main_testcase(): assert isinstance(tc.input, MainInput) wrapped = [json.dumps(a) for a in tc.input.arguments] - result += indent + f"let mainArgs = [{' '.join(wrapped)}]\n" + result += indent + f"let mainArgs = [{' ,'.join(wrapped)}]\n" result += ( indent + f"result <- try (withArgs mainArgs {pu.submission_name}.main) :: IO (Either SomeException ())\n" diff --git a/tests/exercises/dedup/evaluation/plan.yaml b/tests/exercises/dedup/evaluation/plan.yaml new file mode 100644 index 00000000..9eef4f07 --- /dev/null +++ b/tests/exercises/dedup/evaluation/plan.yaml @@ -0,0 +1,9 @@ +- tab: "command_line_arguments" + testcases: + - arguments: [haskell, rust, java, haskell, c, rust] + stdout: "c haskell java rust" + - arguments: ["banana", "apple", "apple", "orange", "apple", "apple", "banana", "orange"] + stdout: "apple banana orange" + - arguments: [] + stdout: "\n" + \ No newline at end of file diff --git a/tests/exercises/dedup/solution/solution.hs b/tests/exercises/dedup/solution/solution.hs new file mode 100644 index 00000000..c5df5fbb --- /dev/null +++ b/tests/exercises/dedup/solution/solution.hs @@ -0,0 +1,8 @@ +import Data.List (nub, sort) +import System.Environment (getArgs) + +main :: IO () +main = do + args <- getArgs + let uniqueSorted = nub (sort args) + putStrLn (unwords uniqueSorted) diff --git a/tests/test_cli_args.py b/tests/test_cli_args.py new file mode 100644 index 00000000..debd85b3 --- /dev/null +++ b/tests/test_cli_args.py @@ -0,0 +1,30 @@ +import json +from pathlib import Path + +import pytest +import yaml + +from tested.datatypes import ( + AdvancedNothingTypes, + AdvancedSequenceTypes, + BasicNumericTypes, +) +from tested.serialisation import NothingType, NumberType, SequenceType +from tested.utils import sorted_no_duplicates, sorting_value_extract +from tests.manual_utils import assert_valid_output, configuration, execute_config + + +@pytest.mark.parametrize("language", ["haskell"]) +def test_cli_params(language: str, tmp_path: Path, pytestconfig: pytest.Config): + conf = configuration( + pytestconfig, + "dedup", + language, + tmp_path, + "plan.yaml", + "solution", + ) + result = execute_config(conf) + print(result) + updates = assert_valid_output(result, pytestconfig) + assert updates.find_status_enum() == ["correct", "correct", "correct"]