Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tested/languages/haskell/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions tests/exercises/dedup/evaluation/plan.yaml
Original file line number Diff line number Diff line change
@@ -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"

8 changes: 8 additions & 0 deletions tests/exercises/dedup/solution/solution.hs
Original file line number Diff line number Diff line change
@@ -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)
30 changes: 30 additions & 0 deletions tests/test_cli_args.py
Original file line number Diff line number Diff line change
@@ -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"]
Loading