From 388acb57583f85afd969e71354e1dd332c714de7 Mon Sep 17 00:00:00 2001 From: Aryan Gupta Date: Sun, 24 Mar 2024 02:59:46 +0100 Subject: [PATCH] add test reference for an error message Signed-off-by: Aryan Gupta --- tests/errors/test_optional.py | 2 ++ tests/reference/asr-test_optional-97e5371.json | 13 +++++++++++++ tests/reference/asr-test_optional-97e5371.stderr | 5 +++++ tests/tests.toml | 4 ++++ 4 files changed, 24 insertions(+) create mode 100644 tests/errors/test_optional.py create mode 100644 tests/reference/asr-test_optional-97e5371.json create mode 100644 tests/reference/asr-test_optional-97e5371.stderr diff --git a/tests/errors/test_optional.py b/tests/errors/test_optional.py new file mode 100644 index 0000000000..58786a1360 --- /dev/null +++ b/tests/errors/test_optional.py @@ -0,0 +1,2 @@ +def match(pat : str, string : str) -> Optional[list[str] | str]: + return None \ No newline at end of file diff --git a/tests/reference/asr-test_optional-97e5371.json b/tests/reference/asr-test_optional-97e5371.json new file mode 100644 index 0000000000..7dbe53ca63 --- /dev/null +++ b/tests/reference/asr-test_optional-97e5371.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-test_optional-97e5371", + "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/errors/test_optional.py", + "infile_hash": "2532c73de47afb82c9d1d9fa335d3b274e7c79a14007353639958a45", + "outfile": null, + "outfile_hash": null, + "stdout": null, + "stdout_hash": null, + "stderr": "asr-test_optional-97e5371.stderr", + "stderr_hash": "b9cc75eb200847db5d4d39d9f511959ebf22faad68cf0096c7a2b68c", + "returncode": 2 +} \ No newline at end of file diff --git a/tests/reference/asr-test_optional-97e5371.stderr b/tests/reference/asr-test_optional-97e5371.stderr new file mode 100644 index 0000000000..4c93a66d6b --- /dev/null +++ b/tests/reference/asr-test_optional-97e5371.stderr @@ -0,0 +1,5 @@ +semantic error: The type 'Optional' is undeclared. + --> tests/errors/test_optional.py:1:39 + | +1 | def match(pat : str, string : str) -> Optional[list[str] | str]: + | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/tests.toml b/tests/tests.toml index 0c22c94aec..be2061fe97 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -1383,3 +1383,7 @@ run_with_dbg = true [[test]] filename = "runtime_errors/test_raise_01.py" run_with_dbg = true + +[[test]] +filename = "errors/test_optional.py" +asr = true \ No newline at end of file