diff --git a/kclvm/evaluator/src/calculation.rs b/kclvm/evaluator/src/calculation.rs index be392a692..d82d28ce4 100644 --- a/kclvm/evaluator/src/calculation.rs +++ b/kclvm/evaluator/src/calculation.rs @@ -259,14 +259,7 @@ impl<'ctx> Evaluator<'ctx> { /// Insert an entry including key and value into the dict, and merge the original entry. #[inline] pub(crate) fn dict_insert_merge_value(&self, dict: &mut ValueRef, key: &str, value: &ValueRef) { - self.dict_merge_key_value_pair( - dict, - key, - value, - ConfigEntryOperationKind::Union, - -1, - false, - ); + self.dict_merge_key_value_pair(dict, key, value, ConfigEntryOperationKind::Union, -1, true); } /// Set dict key with the value. When the dict is a schema and resolve schema validations. diff --git a/kclvm/parser/src/file_graph.rs b/kclvm/parser/src/file_graph.rs index 9fdbe6301..31ad0322b 100644 --- a/kclvm/parser/src/file_graph.rs +++ b/kclvm/parser/src/file_graph.rs @@ -66,17 +66,20 @@ impl FileGraph { .rev() .map(|n| self.graph[n].clone()) .collect::>()), - Err(_) => { + Err(err) => { // toposort function in the `petgraph` library doesn't return the cycle itself, // so we need to use Tarjan's algorithm to find one instead let strongly_connected_components = petgraph::algo::tarjan_scc(&self.graph); // a strongly connected component is a cycle if it has more than one node // let's just return the first one we find - let cycle = strongly_connected_components + let cycle = match strongly_connected_components .into_iter() .find(|component| component.len() > 1) - .unwrap(); + { + Some(vars) => vars, + None => vec![err.node_id()], + }; Err(cycle .iter() .map(|n| self.graph[*n].clone()) diff --git a/kclvm/tests/integration/grammar/test_grammar.py b/kclvm/tests/integration/grammar/test_grammar.py index 3e2cf928b..8f803526c 100644 --- a/kclvm/tests/integration/grammar/test_grammar.py +++ b/kclvm/tests/integration/grammar/test_grammar.py @@ -10,8 +10,6 @@ TEST_FILE = "main.k" STDOUT_GOLDEN = "stdout.golden" STDERR_GOLDEN = "stderr.golden" -STDOUT_GOLDEN_PY = "stdout.golden.py" -STDERR_GOLDEN_PY = "stderr.golden.py" SETTINGS_FILE = "settings.yaml" TEST_PATH = "test/grammar" @@ -106,6 +104,16 @@ def read_settings_file(settings_file_name): test_dirs = find_test_dirs(str(test_path), "") +def remove_ansi_escape_sequences(text): + ansi_escape_pattern = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]') + return ansi_escape_pattern.sub('', text) + + +def remove_extra_empty_lines(text): + lines = [line for line in text.splitlines() if line.strip()] + return '\n'.join(lines) + + @pytest.mark.parametrize("test_dir", test_dirs) def test_grammar(test_dir): print("Testing {}".format(test_dir)) @@ -123,31 +131,37 @@ def test_grammar(test_dir): stdout, stderr = process.communicate() print("STDOUT:\n{}".format(stdout.decode())) print("STDERR:\n{}".format(stderr.decode())) - RETURN_CODE = 0 - KCLVM_OUTPUT = 1 - GOLDEN_FILE = 2 - GOLDEN_FILE_SCRIPT = 3 - settings = { - "stdout": (None, stdout, STDOUT_GOLDEN, STDOUT_GOLDEN_PY), - } - for _, setting in settings.items(): - # Attempt to generate a golden stdout. - golden_file_result = generate_golden_file( - os.path.join(test_dir, setting[GOLDEN_FILE_SCRIPT]) - ) - if golden_file_result: - compare_results(setting[KCLVM_OUTPUT], golden_file_result) - else: - # Attempt to use existing golden stdout. - try: - with open( - os.path.join(test_dir, setting[GOLDEN_FILE]), "r" - ) as golden_file: - compare_results_with_lines(setting[KCLVM_OUTPUT], golden_file) - if setting[RETURN_CODE] is not None: - assert process.returncode == setting[RETURN_CODE] - except OSError: - # Ignore when a golden file does not exist. - pass - except Exception: - raise + # Attempt to use existing golden stdout. + try: + with open( + os.path.join(test_dir, STDOUT_GOLDEN), "r" + ) as golden_file: + compare_results_with_lines(stdout, golden_file) + assert process.returncode == 0 + except OSError: + # Ignore when a golden file does not exist. + pass + except Exception: + raise + + # Attempt to compare existing golden stdout. + try: + with open( + os.path.join(test_dir, STDOUT_GOLDEN), "r" + ) as golden_file: + compare_results_with_lines(stdout, golden_file) + assert process.returncode == 0 + except OSError: + # Ignore when a golden file does not exist. + pass + except Exception: + raise + + stderr_file = pathlib.Path(test_dir).joinpath(STDERR_GOLDEN) + cwd = os.path.abspath(test_dir) + if stderr_file.exists(): + golden = remove_extra_empty_lines(remove_ansi_escape_sequences(stderr_file.read_text())) + stderr = remove_extra_empty_lines(remove_ansi_escape_sequences(stderr.decode())) + golden = golden.replace("${CWD}", cwd) + assert golden in stderr + assert process.returncode > 0 diff --git a/test/grammar/assert/invalid/fail_0/stderr.golden b/test/grammar/assert/invalid/fail_0/stderr.golden new file mode 100644 index 000000000..2047a8f1b --- /dev/null +++ b/test/grammar/assert/invalid/fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:1:1 + | +1 | assert False + | + | \ No newline at end of file diff --git a/test/grammar/assert/invalid/fail_0/stderr.golden.py b/test/grammar/assert/invalid/fail_0/stderr.golden.py deleted file mode 100644 index e559a04cc..000000000 --- a/test/grammar/assert/invalid/fail_0/stderr.golden.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.AssertionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - )] - ), - file=sys.stdout) diff --git a/test/grammar/assert/invalid/fail_1/stderr.golden b/test/grammar/assert/invalid/fail_1/stderr.golden new file mode 100644 index 000000000..e8797487b --- /dev/null +++ b/test/grammar/assert/invalid/fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:1:1 + | +1 | assert 1 == 2, '1 is not equal to 2' + | 1 is not equal to 2 + | \ No newline at end of file diff --git a/test/grammar/assert/invalid/fail_1/stderr.golden.py b/test/grammar/assert/invalid/fail_1/stderr.golden.py deleted file mode 100644 index 1ae5f6c7b..000000000 --- a/test/grammar/assert/invalid/fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AssertionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ) - ], - arg_msg="1 is not equal to 2" - ) - , file=sys.stdout -) - diff --git a/test/grammar/assert/invalid/fail_2/stderr.golden b/test/grammar/assert/invalid/fail_2/stderr.golden new file mode 100644 index 000000000..93ee8da44 --- /dev/null +++ b/test/grammar/assert/invalid/fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | assert _x == "bad case", "x should be 'good case'" + | x should be 'good case' + | \ No newline at end of file diff --git a/test/grammar/assert/invalid/fail_2/stderr.golden.py b/test/grammar/assert/invalid/fail_2/stderr.golden.py deleted file mode 100644 index b09935282..000000000 --- a/test/grammar/assert/invalid/fail_2/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AssertionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="x should be 'good case'" - ) - , file=sys.stdout -) - diff --git a/test/grammar/assert/invalid/fail_3/stderr.golden b/test/grammar/assert/invalid/fail_3/stderr.golden new file mode 100644 index 000000000..72a3b312a --- /dev/null +++ b/test/grammar/assert/invalid/fail_3/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | assert _x == "bad case" if _x, "x should be 'good case'" + | x should be 'good case' + | \ No newline at end of file diff --git a/test/grammar/assert/invalid/fail_3/stderr.golden.py b/test/grammar/assert/invalid/fail_3/stderr.golden.py deleted file mode 100644 index ced74dad3..000000000 --- a/test/grammar/assert/invalid/fail_3/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AssertionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3 - ) - ], - arg_msg="x should be 'good case'" - ) - , file=sys.stdout -) - diff --git a/test/grammar/builtins/file/append/file_append.txt b/test/grammar/builtins/file/append/file_append.txt index 0d6f364b7..719403733 100644 --- a/test/grammar/builtins/file/append/file_append.txt +++ b/test/grammar/builtins/file/append/file_append.txt @@ -1 +1 @@ -sample content \ No newline at end of file +sample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample contentsample content \ No newline at end of file diff --git a/test/grammar/builtins/file/append/stderr.golden b/test/grammar/builtins/file/append/stderr.golden index deb51ae96..7233d69b5 100644 --- a/test/grammar/builtins/file/append/stderr.golden +++ b/test/grammar/builtins/file/append/stderr.golden @@ -1 +1,6 @@ -append() requires 'filepath' argument \ No newline at end of file +error[E3M38]: EvaluationError + --> ${CWD}/main.k:5:1 + | +5 | file.append("", "sample content without path") + | Failed to open or create file '': No such file or directory (os error 2) + | \ No newline at end of file diff --git a/test/grammar/builtins/file/cp/stderr.golden b/test/grammar/builtins/file/cp/stderr.golden index 208cb53cf..01fc01b20 100644 --- a/test/grammar/builtins/file/cp/stderr.golden +++ b/test/grammar/builtins/file/cp/stderr.golden @@ -1 +1,6 @@ -cp: failed to copy 'source.txt' to 'destination.txt': No such file or directory +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | file.cp("source.txt", "destination.txt") + | Failed to copy from 'source.txt' to 'destination.txt': No such file or directory (os error 2) + | \ No newline at end of file diff --git a/test/grammar/builtins/file/delete/stderr.golden b/test/grammar/builtins/file/delete/stderr.golden index 564eba2a0..4e4f3d86b 100644 --- a/test/grammar/builtins/file/delete/stderr.golden +++ b/test/grammar/builtins/file/delete/stderr.golden @@ -1 +1,6 @@ -delete: failed to delete 'test_dir': No such file or directory +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | file.delete("test_dir") + | failed to delete 'test_dir': No such file or directory (os error 2) + | \ No newline at end of file diff --git a/test/grammar/builtins/file/delete/stdout.golden b/test/grammar/builtins/file/delete/stdout.golden deleted file mode 100644 index 8b1378917..000000000 --- a/test/grammar/builtins/file/delete/stdout.golden +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/grammar/builtins/file/mkdir/main.k b/test/grammar/builtins/file/mkdir/main.k index d27fd493c..bd3697910 100644 --- a/test/grammar/builtins/file/mkdir/main.k +++ b/test/grammar/builtins/file/mkdir/main.k @@ -1,3 +1,4 @@ import file file.mkdir("test_dir") +a = 1 \ No newline at end of file diff --git a/test/grammar/builtins/file/mkdir/stderr.golden b/test/grammar/builtins/file/mkdir/stderr.golden deleted file mode 100644 index 48ea2caa4..000000000 --- a/test/grammar/builtins/file/mkdir/stderr.golden +++ /dev/null @@ -1,2 +0,0 @@ -mkdir: failed to create directory 'test_dir': File exists - diff --git a/test/grammar/builtins/file/mkdir/stdout.golden b/test/grammar/builtins/file/mkdir/stdout.golden index 8b1378917..a016ac454 100644 --- a/test/grammar/builtins/file/mkdir/stdout.golden +++ b/test/grammar/builtins/file/mkdir/stdout.golden @@ -1 +1 @@ - +a: 1 \ No newline at end of file diff --git a/test/grammar/builtins/file/mv/stderr.golden b/test/grammar/builtins/file/mv/stderr.golden index 05d6bfd7e..e0e8ca746 100644 --- a/test/grammar/builtins/file/mv/stderr.golden +++ b/test/grammar/builtins/file/mv/stderr.golden @@ -1 +1,6 @@ -mv: failed to move 'source.txt' to 'destination.txt': No such file or directory +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | file.mv("source.txt", "destination.txt") + | Failed to move 'source.txt' to 'destination.txt': No such file or directory (os error 2) + | \ No newline at end of file diff --git a/test/grammar/builtins/file/mv/stdout.golden b/test/grammar/builtins/file/mv/stdout.golden deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/grammar/builtins/file/size/stderr.golden b/test/grammar/builtins/file/size/stderr.golden index 7c27d0cb0..9017b13a6 100644 --- a/test/grammar/builtins/file/size/stderr.golden +++ b/test/grammar/builtins/file/size/stderr.golden @@ -1 +1,6 @@ -size: failed to get size of 'source_file.txt': No such file or directory \ No newline at end of file +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | file.size("source_file.txt") + | failed to get size of 'source_file.txt': No such file or directory (os error 2) + | \ No newline at end of file diff --git a/test/grammar/builtins/file/write/main.k b/test/grammar/builtins/file/write/main.k index c257f1d29..c33358214 100644 --- a/test/grammar/builtins/file/write/main.k +++ b/test/grammar/builtins/file/write/main.k @@ -1,3 +1,4 @@ import file -file.write("test_file.txt", "Hello, world!") \ No newline at end of file +file.write("test_file.txt", "Hello, world!") +a = 1 \ No newline at end of file diff --git a/test/grammar/builtins/file/write/stdout.golden b/test/grammar/builtins/file/write/stdout.golden index e69de29bb..a016ac454 100644 --- a/test/grammar/builtins/file/write/stdout.golden +++ b/test/grammar/builtins/file/write/stdout.golden @@ -0,0 +1 @@ +a: 1 \ No newline at end of file diff --git a/test/grammar/builtins/operator/operator_fail_0/stderr.golden b/test/grammar/builtins/operator/operator_fail_0/stderr.golden new file mode 100644 index 000000000..f031b9ff4 --- /dev/null +++ b/test/grammar/builtins/operator/operator_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:5 + | +2 | b = 1 + None + | ^ unsupported operand type(s) for +: 'int(1)' and 'NoneType' + | \ No newline at end of file diff --git a/test/grammar/builtins/operator/operator_fail_0/stderr.golden.py b/test/grammar/builtins/operator/operator_fail_0/stderr.golden.py deleted file mode 100644 index 3da23c34b..000000000 --- a/test/grammar/builtins/operator/operator_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="unsupported operand type(s) for +: 'int(1)' and 'NoneType'" - ), - file=sys.stdout -) diff --git a/test/grammar/builtins/operator/operator_fail_1/stderr.golden b/test/grammar/builtins/operator/operator_fail_1/stderr.golden new file mode 100644 index 000000000..e29e672cc --- /dev/null +++ b/test/grammar/builtins/operator/operator_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:5 + | +2 | b = None + 1 + | ^ unsupported operand type(s) for +: 'NoneType' and 'int(1)' + | \ No newline at end of file diff --git a/test/grammar/builtins/operator/operator_fail_1/stderr.golden.py b/test/grammar/builtins/operator/operator_fail_1/stderr.golden.py deleted file mode 100644 index 21347a90e..000000000 --- a/test/grammar/builtins/operator/operator_fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="unsupported operand type(s) for +: 'NoneType' and 'int(1)'" - ), - file=sys.stdout -) - diff --git a/test/grammar/builtins/operator/operator_fail_2/stderr.golden b/test/grammar/builtins/operator/operator_fail_2/stderr.golden new file mode 100644 index 000000000..b2ab2e1f6 --- /dev/null +++ b/test/grammar/builtins/operator/operator_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:5 + | +2 | b = 1 + a + | ^ unsupported operand type(s) for +: 'int(1)' and '[int | {str:str}]' + | \ No newline at end of file diff --git a/test/grammar/builtins/operator/operator_fail_2/stderr.golden.py b/test/grammar/builtins/operator/operator_fail_2/stderr.golden.py deleted file mode 100644 index 72e10e9f9..000000000 --- a/test/grammar/builtins/operator/operator_fail_2/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="unsupported operand type(s) for +: 'int(1)' and '[int|{str:str}]'" - ), - file=sys.stdout -) - diff --git a/test/grammar/builtins/str/index/stderr.golden b/test/grammar/builtins/str/index/stderr.golden new file mode 100644 index 000000000..b655c6ac5 --- /dev/null +++ b/test/grammar/builtins/str/index/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | b = "Hello World".index("Wrold") + | substring not found + | \ No newline at end of file diff --git a/test/grammar/builtins/str/index/stderr.golden.py b/test/grammar/builtins/str/index/stderr.golden.py deleted file mode 100644 index d81ddf910..000000000 --- a/test/grammar/builtins/str/index/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="substring not found" - ) - , file=sys.stdout -) - diff --git a/test/grammar/builtins/str/rindex/stderr.golden b/test/grammar/builtins/str/rindex/stderr.golden new file mode 100644 index 000000000..e76aa4c34 --- /dev/null +++ b/test/grammar/builtins/str/rindex/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | c = "Hello World, Hello World".rindex("Hee") + | substring not found + | \ No newline at end of file diff --git a/test/grammar/builtins/str/rindex/stderr.golden.py b/test/grammar/builtins/str/rindex/stderr.golden.py deleted file mode 100644 index ea85be9ec..000000000 --- a/test/grammar/builtins/str/rindex/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3 - ) - ], - arg_msg="substring not found" - ) - , file=sys.stdout -) - diff --git a/test/grammar/comprehension/dict/invalid_loop_var_fail_0/stderr.golden b/test/grammar/comprehension/dict/invalid_loop_var_fail_0/stderr.golden new file mode 100644 index 000000000..d1103b7ec --- /dev/null +++ b/test/grammar/comprehension/dict/invalid_loop_var_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:2:25 + | +2 | dataLoop = [i for i, j, k in data] # error + | ^ the number of loop variables is 3, which can only be 1 or 2 + | \ No newline at end of file diff --git a/test/grammar/comprehension/dict/invalid_loop_var_fail_0/stderr.golden.py b/test/grammar/comprehension/dict/invalid_loop_var_fail_0/stderr.golden.py deleted file mode 100644 index 7b68df657..000000000 --- a/test/grammar/comprehension/dict/invalid_loop_var_fail_0/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=26 - ) - ], - arg_msg="the number of loop variables is 3, which can only be 1 or 2" - ), - file=sys.stdout -) - diff --git a/test/grammar/comprehension/dict/invalid_loop_var_fail_1/stderr.golden b/test/grammar/comprehension/dict/invalid_loop_var_fail_1/stderr.golden new file mode 100644 index 000000000..782a440ae --- /dev/null +++ b/test/grammar/comprehension/dict/invalid_loop_var_fail_1/stderr.golden @@ -0,0 +1,36 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:20 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["in"] got ( + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["identifier", "literal", "(", "[", "{"] got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["]"] got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ unexpected token ')' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:30 + | +2 | dataLoop = [i for i() in data] # error + | ^ unexpected token ']' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:2:23 + | +2 | dataLoop = [i for i() in data] # error + | ^ name 'in' is not defined, did you mean '["int"]'? + | \ No newline at end of file diff --git a/test/grammar/comprehension/dict/invalid_loop_var_fail_1/stderr.golden.py b/test/grammar/comprehension/dict/invalid_loop_var_fail_1/stderr.golden.py deleted file mode 100644 index 5beb56e27..000000000 --- a/test/grammar/comprehension/dict/invalid_loop_var_fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=22 - ) - ], - arg_msg="loop variables can only be ordinary identifiers" - ), - file=sys.stdout -) diff --git a/test/grammar/comprehension/dict/invalid_loop_var_fail_2/stderr.golden b/test/grammar/comprehension/dict/invalid_loop_var_fail_2/stderr.golden new file mode 100644 index 000000000..c5ffa7e43 --- /dev/null +++ b/test/grammar/comprehension/dict/invalid_loop_var_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:2:19 + | +2 | dataLoop = [i for i.j.k in data] # error + | ^ loop variables can only be ordinary identifiers + | \ No newline at end of file diff --git a/test/grammar/comprehension/dict/invalid_loop_var_fail_2/stderr.golden.py b/test/grammar/comprehension/dict/invalid_loop_var_fail_2/stderr.golden.py deleted file mode 100644 index a28d6dd59..000000000 --- a/test/grammar/comprehension/dict/invalid_loop_var_fail_2/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=24 - ) - ], - arg_msg="loop variables can only be ordinary identifiers" - ), - file=sys.stdout -) - diff --git a/test/grammar/comprehension/list/invalid_loop_var_fail_0/stderr.golden b/test/grammar/comprehension/list/invalid_loop_var_fail_0/stderr.golden new file mode 100644 index 000000000..d1103b7ec --- /dev/null +++ b/test/grammar/comprehension/list/invalid_loop_var_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:2:25 + | +2 | dataLoop = [i for i, j, k in data] # error + | ^ the number of loop variables is 3, which can only be 1 or 2 + | \ No newline at end of file diff --git a/test/grammar/comprehension/list/invalid_loop_var_fail_0/stderr.golden.py b/test/grammar/comprehension/list/invalid_loop_var_fail_0/stderr.golden.py deleted file mode 100644 index 1d99c291b..000000000 --- a/test/grammar/comprehension/list/invalid_loop_var_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=26 - ) - ], - arg_msg="the number of loop variables is 3, which can only be 1 or 2" - ), - file=sys.stdout -) diff --git a/test/grammar/comprehension/list/invalid_loop_var_fail_1/stderr.golden b/test/grammar/comprehension/list/invalid_loop_var_fail_1/stderr.golden new file mode 100644 index 000000000..c5ffa7e43 --- /dev/null +++ b/test/grammar/comprehension/list/invalid_loop_var_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:2:19 + | +2 | dataLoop = [i for i.j.k in data] # error + | ^ loop variables can only be ordinary identifiers + | \ No newline at end of file diff --git a/test/grammar/comprehension/list/invalid_loop_var_fail_1/stderr.golden.py b/test/grammar/comprehension/list/invalid_loop_var_fail_1/stderr.golden.py deleted file mode 100644 index a28d6dd59..000000000 --- a/test/grammar/comprehension/list/invalid_loop_var_fail_1/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=24 - ) - ], - arg_msg="loop variables can only be ordinary identifiers" - ), - file=sys.stdout -) - diff --git a/test/grammar/comprehension/list/invalid_loop_var_fail_2/stderr.golden b/test/grammar/comprehension/list/invalid_loop_var_fail_2/stderr.golden new file mode 100644 index 000000000..782a440ae --- /dev/null +++ b/test/grammar/comprehension/list/invalid_loop_var_fail_2/stderr.golden @@ -0,0 +1,36 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:20 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["in"] got ( + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["identifier", "literal", "(", "[", "{"] got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["]"] got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ unexpected token ')' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:30 + | +2 | dataLoop = [i for i() in data] # error + | ^ unexpected token ']' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:2:23 + | +2 | dataLoop = [i for i() in data] # error + | ^ name 'in' is not defined, did you mean '["int"]'? + | \ No newline at end of file diff --git a/test/grammar/comprehension/list/invalid_loop_var_fail_2/stderr.golden.py b/test/grammar/comprehension/list/invalid_loop_var_fail_2/stderr.golden.py deleted file mode 100644 index c18dc4559..000000000 --- a/test/grammar/comprehension/list/invalid_loop_var_fail_2/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=22 - ) - ], - arg_msg="loop variables can only be ordinary identifiers" - ), - file=sys.stdout -) - diff --git a/test/grammar/comprehension/str/invalid_loop_var_fail_0/stderr.golden b/test/grammar/comprehension/str/invalid_loop_var_fail_0/stderr.golden new file mode 100644 index 000000000..d5c33854e --- /dev/null +++ b/test/grammar/comprehension/str/invalid_loop_var_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:2:25 + | +2 | dataLoop = [i for i, j, k in dataString] # error + | ^ the number of loop variables is 3, which can only be 1 or 2 + | \ No newline at end of file diff --git a/test/grammar/comprehension/str/invalid_loop_var_fail_0/stderr.golden.py b/test/grammar/comprehension/str/invalid_loop_var_fail_0/stderr.golden.py deleted file mode 100644 index 7b68df657..000000000 --- a/test/grammar/comprehension/str/invalid_loop_var_fail_0/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=26 - ) - ], - arg_msg="the number of loop variables is 3, which can only be 1 or 2" - ), - file=sys.stdout -) - diff --git a/test/grammar/comprehension/str/invalid_loop_var_fail_1/stderr.golden b/test/grammar/comprehension/str/invalid_loop_var_fail_1/stderr.golden new file mode 100644 index 000000000..c5ffa7e43 --- /dev/null +++ b/test/grammar/comprehension/str/invalid_loop_var_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:2:19 + | +2 | dataLoop = [i for i.j.k in data] # error + | ^ loop variables can only be ordinary identifiers + | \ No newline at end of file diff --git a/test/grammar/comprehension/str/invalid_loop_var_fail_1/stderr.golden.py b/test/grammar/comprehension/str/invalid_loop_var_fail_1/stderr.golden.py deleted file mode 100644 index a28d6dd59..000000000 --- a/test/grammar/comprehension/str/invalid_loop_var_fail_1/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=24 - ) - ], - arg_msg="loop variables can only be ordinary identifiers" - ), - file=sys.stdout -) - diff --git a/test/grammar/comprehension/str/invalid_loop_var_fail_2/stderr.golden b/test/grammar/comprehension/str/invalid_loop_var_fail_2/stderr.golden new file mode 100644 index 000000000..782a440ae --- /dev/null +++ b/test/grammar/comprehension/str/invalid_loop_var_fail_2/stderr.golden @@ -0,0 +1,36 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:20 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["in"] got ( + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["identifier", "literal", "(", "[", "{"] got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ expected one of ["]"] got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:21 + | +2 | dataLoop = [i for i() in data] # error + | ^ unexpected token ')' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:30 + | +2 | dataLoop = [i for i() in data] # error + | ^ unexpected token ']' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:2:23 + | +2 | dataLoop = [i for i() in data] # error + | ^ name 'in' is not defined, did you mean '["int"]'? + | \ No newline at end of file diff --git a/test/grammar/comprehension/str/invalid_loop_var_fail_2/stderr.golden.py b/test/grammar/comprehension/str/invalid_loop_var_fail_2/stderr.golden.py deleted file mode 100644 index 5beb56e27..000000000 --- a/test/grammar/comprehension/str/invalid_loop_var_fail_2/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=19, - end_col_no=22 - ) - ], - arg_msg="loop variables can only be ordinary identifiers" - ), - file=sys.stdout -) diff --git a/test/grammar/datatype/dict/indexing_in_comprehension_fail_0/stderr.golden b/test/grammar/datatype/dict/indexing_in_comprehension_fail_0/stderr.golden new file mode 100644 index 000000000..80c286409 --- /dev/null +++ b/test/grammar/datatype/dict/indexing_in_comprehension_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2A31]: IllegalAttributeError + --> ${CWD}/main.k:16:13 + | +16 | service: service["name"], + | ^ A attribute must be string type, got '{str:str}' + | \ No newline at end of file diff --git a/test/grammar/datatype/dict/indexing_in_comprehension_fail_0/stderr.golden.py b/test/grammar/datatype/dict/indexing_in_comprehension_fail_0/stderr.golden.py deleted file mode 100644 index f3131eb01..000000000 --- a/test/grammar/datatype/dict/indexing_in_comprehension_fail_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalAttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=16, - col_no=13 - ) - ], - arg_msg="type '{str:str}'" - ) - , file=sys.stdout -) diff --git a/test/grammar/datatype/list/add_None_fail/stderr.golden b/test/grammar/datatype/list/add_None_fail/stderr.golden new file mode 100644 index 000000000..6d8905799 --- /dev/null +++ b/test/grammar/datatype/list/add_None_fail/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:4:1 + | +4 | result2 = _list1 + _list2 + | can only concatenate list (not "NoneType") to list + | \ No newline at end of file diff --git a/test/grammar/datatype/list/add_None_fail/stderr.golden.py b/test/grammar/datatype/list/add_None_fail/stderr.golden.py deleted file mode 100644 index 7a0bbd6e7..000000000 --- a/test/grammar/datatype/list/add_None_fail/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4 - ) - ], - arg_msg="can only concatenate list (not \"NoneType\") to list" - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_float/overflow/inf/stderr.golden b/test/grammar/datatype/range_check_float/overflow/inf/stderr.golden new file mode 100644 index 000000000..2e5cb5f60 --- /dev/null +++ b/test/grammar/datatype/range_check_float/overflow/inf/stderr.golden @@ -0,0 +1 @@ +inf: A 64-bit floating point number overflow \ No newline at end of file diff --git a/test/grammar/datatype/range_check_float/overflow/inf/stderr.golden.py b/test/grammar/datatype/range_check_float/overflow/inf/stderr.golden.py deleted file mode 100644 index 1234c318c..000000000 --- a/test/grammar/datatype/range_check_float/overflow/inf/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.FloatOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6 - ) - ], - arg_msg=kcl_error.FLOAT_OVER_FLOW_MSG.format("inf", 64) - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_float/overflow/number_0/stderr.golden b/test/grammar/datatype/range_check_float/overflow/number_0/stderr.golden new file mode 100644 index 000000000..4e89012b0 --- /dev/null +++ b/test/grammar/datatype/range_check_float/overflow/number_0/stderr.golden @@ -0,0 +1,9 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:8:1 + | +8 | a = uplimit * (100 + epsilon) + | 3.4e+40: A 32-bit floating point number overflow + | +note: backtrace: + 0: kclvm_main + at ${CWD}/main.k:8 \ No newline at end of file diff --git a/test/grammar/datatype/range_check_float/overflow/number_0/stderr.golden.py b/test/grammar/datatype/range_check_float/overflow/number_0/stderr.golden.py deleted file mode 100644 index ebb3e5553..000000000 --- a/test/grammar/datatype/range_check_float/overflow/number_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.FloatOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8 - ) - ], - arg_msg=kcl_error.FLOAT_OVER_FLOW_MSG.format(3.4e+40, 32) - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_float/underflow/number_0/stderr.golden b/test/grammar/datatype/range_check_float/underflow/number_0/stderr.golden new file mode 100644 index 000000000..d3d895dbe --- /dev/null +++ b/test/grammar/datatype/range_check_float/underflow/number_0/stderr.golden @@ -0,0 +1 @@ +1.1754943509999997e-38: A 32-bit floating point number underflow diff --git a/test/grammar/datatype/range_check_float/underflow/number_0/stderr.golden.py b/test/grammar/datatype/range_check_float/underflow/number_0/stderr.golden.py deleted file mode 100644 index 0b31d3b1d..000000000 --- a/test/grammar/datatype/range_check_float/underflow/number_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_warning_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.FloatUnderflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7 - ) - ], - arg_msg=kcl_error.FLOAT_UNDER_FLOW_MSG.format(1.1754943509999997e-38, 32) - ) - , file=sys.stdout -) diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_0/stderr.golden b/test/grammar/datatype/range_check_int/augment_assign_fail_0/stderr.golden new file mode 100644 index 000000000..597779eb5 --- /dev/null +++ b/test/grammar/datatype/range_check_int/augment_assign_fail_0/stderr.golden @@ -0,0 +1,9 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | _a += 1 + | 2147483648: A 32 bit integer overflow + | +note: backtrace: + 0: kclvm_main + at ${CWD}/main.k:2 \ No newline at end of file diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_0/stderr.golden.py b/test/grammar/datatype/range_check_int/augment_assign_fail_0/stderr.golden.py deleted file mode 100644 index 225e2ee6b..000000000 --- a/test/grammar/datatype/range_check_int/augment_assign_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(2147483648, 32)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_1/stderr.golden b/test/grammar/datatype/range_check_int/augment_assign_fail_1/stderr.golden new file mode 100644 index 000000000..3af756538 --- /dev/null +++ b/test/grammar/datatype/range_check_int/augment_assign_fail_1/stderr.golden @@ -0,0 +1,9 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | _a += 1 + | 9223372036854775808: A 64 bit integer overflow + | +note: backtrace: + 0: kclvm_main + at ${CWD}/main.k:2 \ No newline at end of file diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_1/stderr.golden.py b/test/grammar/datatype/range_check_int/augment_assign_fail_1/stderr.golden.py deleted file mode 100644 index bafe89e16..000000000 --- a/test/grammar/datatype/range_check_int/augment_assign_fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(9223372036854775808, 64) - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_2/stderr.golden b/test/grammar/datatype/range_check_int/augment_assign_fail_2/stderr.golden new file mode 100644 index 000000000..3af756538 --- /dev/null +++ b/test/grammar/datatype/range_check_int/augment_assign_fail_2/stderr.golden @@ -0,0 +1,9 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | _a += 1 + | 9223372036854775808: A 64 bit integer overflow + | +note: backtrace: + 0: kclvm_main + at ${CWD}/main.k:2 \ No newline at end of file diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_2/stderr.golden.py b/test/grammar/datatype/range_check_int/augment_assign_fail_2/stderr.golden.py deleted file mode 100644 index bafe89e16..000000000 --- a/test/grammar/datatype/range_check_int/augment_assign_fail_2/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(9223372036854775808, 64) - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_3/stderr.golden b/test/grammar/datatype/range_check_int/augment_assign_fail_3/stderr.golden new file mode 100644 index 000000000..597779eb5 --- /dev/null +++ b/test/grammar/datatype/range_check_int/augment_assign_fail_3/stderr.golden @@ -0,0 +1,9 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | _a += 1 + | 2147483648: A 32 bit integer overflow + | +note: backtrace: + 0: kclvm_main + at ${CWD}/main.k:2 \ No newline at end of file diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_3/stderr.golden.py b/test/grammar/datatype/range_check_int/augment_assign_fail_3/stderr.golden.py deleted file mode 100644 index 15e8b3254..000000000 --- a/test/grammar/datatype/range_check_int/augment_assign_fail_3/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(2147483648, 32) - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_4/stderr.golden b/test/grammar/datatype/range_check_int/augment_assign_fail_4/stderr.golden new file mode 100644 index 000000000..b8f210907 --- /dev/null +++ b/test/grammar/datatype/range_check_int/augment_assign_fail_4/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:2:1 + | +2 | a += 1 + | ^ Immutable variable 'a' is modified during compiling + | + --> ${CWD}/main.k:1:1 + | +1 | a = 2147483646 + | ^ The variable 'a' is declared here firstly + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/datatype/range_check_int/augment_assign_fail_4/stderr.golden.py b/test/grammar/datatype/range_check_int/augment_assign_fail_4/stderr.golden.py deleted file mode 100644 index f291e2f54..000000000 --- a/test/grammar/datatype/range_check_int/augment_assign_fail_4/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1 - ) - ], - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/dict_fail_0/main.k b/test/grammar/datatype/range_check_int/dict_fail_0/main.k deleted file mode 100644 index cd5bbd2a3..000000000 --- a/test/grammar/datatype/range_check_int/dict_fail_0/main.k +++ /dev/null @@ -1 +0,0 @@ -a = {"key": 2147483648} diff --git a/test/grammar/datatype/range_check_int/dict_fail_0/settings.yaml b/test/grammar/datatype/range_check_int/dict_fail_0/settings.yaml deleted file mode 100644 index 5fae1f7de..000000000 --- a/test/grammar/datatype/range_check_int/dict_fail_0/settings.yaml +++ /dev/null @@ -1 +0,0 @@ -kcl_options: -r -d diff --git a/test/grammar/datatype/range_check_int/dict_fail_0/stderr.golden.py b/test/grammar/datatype/range_check_int/dict_fail_0/stderr.golden.py deleted file mode 100644 index 8643f7a62..000000000 --- a/test/grammar/datatype/range_check_int/dict_fail_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ) - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(2147483648, 32) - ) - , file=sys.stdout -) diff --git a/test/grammar/datatype/range_check_int/dict_fail_1/main.k b/test/grammar/datatype/range_check_int/dict_fail_1/main.k deleted file mode 100644 index c216d620d..000000000 --- a/test/grammar/datatype/range_check_int/dict_fail_1/main.k +++ /dev/null @@ -1 +0,0 @@ -a = {"key": 9223372036854775808} diff --git a/test/grammar/datatype/range_check_int/dict_fail_1/settings.yaml b/test/grammar/datatype/range_check_int/dict_fail_1/settings.yaml deleted file mode 100644 index 542d01cf5..000000000 --- a/test/grammar/datatype/range_check_int/dict_fail_1/settings.yaml +++ /dev/null @@ -1 +0,0 @@ -kcl_options: -d diff --git a/test/grammar/datatype/range_check_int/dict_fail_1/stderr.golden.py b/test/grammar/datatype/range_check_int/dict_fail_1/stderr.golden.py deleted file mode 100644 index 877df4f8a..000000000 --- a/test/grammar/datatype/range_check_int/dict_fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(9223372036854775808, 64)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/list_fail_0/main.k b/test/grammar/datatype/range_check_int/list_fail_0/main.k deleted file mode 100644 index d2f87881d..000000000 --- a/test/grammar/datatype/range_check_int/list_fail_0/main.k +++ /dev/null @@ -1 +0,0 @@ -myList = [1, 2, 3, 2147483648] diff --git a/test/grammar/datatype/range_check_int/list_fail_0/settings.yaml b/test/grammar/datatype/range_check_int/list_fail_0/settings.yaml deleted file mode 100644 index 5fae1f7de..000000000 --- a/test/grammar/datatype/range_check_int/list_fail_0/settings.yaml +++ /dev/null @@ -1 +0,0 @@ -kcl_options: -r -d diff --git a/test/grammar/datatype/range_check_int/list_fail_0/stderr.golden.py b/test/grammar/datatype/range_check_int/list_fail_0/stderr.golden.py deleted file mode 100644 index 602e555a9..000000000 --- a/test/grammar/datatype/range_check_int/list_fail_0/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(2147483648, 32)) - , file=sys.stdout -) diff --git a/test/grammar/datatype/range_check_int/list_fail_1/main.k b/test/grammar/datatype/range_check_int/list_fail_1/main.k deleted file mode 100644 index 116e4937c..000000000 --- a/test/grammar/datatype/range_check_int/list_fail_1/main.k +++ /dev/null @@ -1 +0,0 @@ -myList = [1, 2, 3, 9223372036854775808] diff --git a/test/grammar/datatype/range_check_int/list_fail_1/settings.yaml b/test/grammar/datatype/range_check_int/list_fail_1/settings.yaml deleted file mode 100644 index 542d01cf5..000000000 --- a/test/grammar/datatype/range_check_int/list_fail_1/settings.yaml +++ /dev/null @@ -1 +0,0 @@ -kcl_options: -d diff --git a/test/grammar/datatype/range_check_int/list_fail_1/stderr.golden.py b/test/grammar/datatype/range_check_int/list_fail_1/stderr.golden.py deleted file mode 100644 index 877df4f8a..000000000 --- a/test/grammar/datatype/range_check_int/list_fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(9223372036854775808, 64)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/normal_assign_fail_0/main.k b/test/grammar/datatype/range_check_int/normal_assign_fail_0/main.k index 0dc548955..34126bed6 100644 --- a/test/grammar/datatype/range_check_int/normal_assign_fail_0/main.k +++ b/test/grammar/datatype/range_check_int/normal_assign_fail_0/main.k @@ -1 +1 @@ -a = 2147483648 +a = 2147483648 + 1 diff --git a/test/grammar/datatype/range_check_int/normal_assign_fail_0/stderr.golden b/test/grammar/datatype/range_check_int/normal_assign_fail_0/stderr.golden new file mode 100644 index 000000000..92f92a94a --- /dev/null +++ b/test/grammar/datatype/range_check_int/normal_assign_fail_0/stderr.golden @@ -0,0 +1 @@ +2147483649: A 32 bit integer overflow \ No newline at end of file diff --git a/test/grammar/datatype/range_check_int/normal_assign_fail_0/stderr.golden.py b/test/grammar/datatype/range_check_int/normal_assign_fail_0/stderr.golden.py deleted file mode 100644 index b52d322b3..000000000 --- a/test/grammar/datatype/range_check_int/normal_assign_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(2147483648, 32)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/normal_assign_fail_1/main.k b/test/grammar/datatype/range_check_int/normal_assign_fail_1/main.k deleted file mode 100644 index d12c93eb4..000000000 --- a/test/grammar/datatype/range_check_int/normal_assign_fail_1/main.k +++ /dev/null @@ -1 +0,0 @@ -a = 9223372036854775808 diff --git a/test/grammar/datatype/range_check_int/normal_assign_fail_1/settings.yaml b/test/grammar/datatype/range_check_int/normal_assign_fail_1/settings.yaml deleted file mode 100644 index 542d01cf5..000000000 --- a/test/grammar/datatype/range_check_int/normal_assign_fail_1/settings.yaml +++ /dev/null @@ -1 +0,0 @@ -kcl_options: -d diff --git a/test/grammar/datatype/range_check_int/normal_assign_fail_1/stderr.golden.py b/test/grammar/datatype/range_check_int/normal_assign_fail_1/stderr.golden.py deleted file mode 100644 index 877df4f8a..000000000 --- a/test/grammar/datatype/range_check_int/normal_assign_fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(9223372036854775808, 64)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/oneliner_fail_0/main.k b/test/grammar/datatype/range_check_int/oneliner_fail_0/main.k deleted file mode 100644 index ef1b82d52..000000000 --- a/test/grammar/datatype/range_check_int/oneliner_fail_0/main.k +++ /dev/null @@ -1,2 +0,0 @@ -a = 1 -c = +2147483648 diff --git a/test/grammar/datatype/range_check_int/oneliner_fail_0/settings.yaml b/test/grammar/datatype/range_check_int/oneliner_fail_0/settings.yaml deleted file mode 100644 index d4fd18f4b..000000000 --- a/test/grammar/datatype/range_check_int/oneliner_fail_0/settings.yaml +++ /dev/null @@ -1 +0,0 @@ -kcl_options: -r -d diff --git a/test/grammar/datatype/range_check_int/oneliner_fail_0/stderr.golden.py b/test/grammar/datatype/range_check_int/oneliner_fail_0/stderr.golden.py deleted file mode 100644 index 225e2ee6b..000000000 --- a/test/grammar/datatype/range_check_int/oneliner_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(2147483648, 32)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/range_check_int/oneliner_fail_1/main.k b/test/grammar/datatype/range_check_int/oneliner_fail_1/main.k deleted file mode 100644 index 5a13773fd..000000000 --- a/test/grammar/datatype/range_check_int/oneliner_fail_1/main.k +++ /dev/null @@ -1,2 +0,0 @@ -a = 1 -c = +9223372036854775808 diff --git a/test/grammar/datatype/range_check_int/oneliner_fail_1/settings.yaml b/test/grammar/datatype/range_check_int/oneliner_fail_1/settings.yaml deleted file mode 100644 index 542d01cf5..000000000 --- a/test/grammar/datatype/range_check_int/oneliner_fail_1/settings.yaml +++ /dev/null @@ -1 +0,0 @@ -kcl_options: -d diff --git a/test/grammar/datatype/range_check_int/oneliner_fail_1/stderr.golden.py b/test/grammar/datatype/range_check_int/oneliner_fail_1/stderr.golden.py deleted file mode 100644 index f8cdeca0e..000000000 --- a/test/grammar/datatype/range_check_int/oneliner_fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(9223372036854775808, 64)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/str_interpolation/invalid_format_value_fail_1/main.k b/test/grammar/datatype/str_interpolation/dollar_escape_0/main.k similarity index 100% rename from test/grammar/datatype/str_interpolation/invalid_format_value_fail_1/main.k rename to test/grammar/datatype/str_interpolation/dollar_escape_0/main.k diff --git a/test/grammar/datatype/str_interpolation/dollar_escape_0/stdout.golden b/test/grammar/datatype/str_interpolation/dollar_escape_0/stdout.golden new file mode 100644 index 000000000..668abcf60 --- /dev/null +++ b/test/grammar/datatype/str_interpolation/dollar_escape_0/stdout.golden @@ -0,0 +1,3 @@ +a: 1 +b: 1 +data: '$1$ 1.0 $$$ $$ ' diff --git a/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_0/stderr.golden b/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_0/stderr.golden new file mode 100644 index 000000000..9c0eceefa --- /dev/null +++ b/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:3:11 + | +3 | data = "${a: #js}" + " $$ " + | ^ #js is a invalid format spec + | \ No newline at end of file diff --git a/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_0/stderr.golden.py b/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_0/stderr.golden.py deleted file mode 100644 index 389a3a524..000000000 --- a/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=11, - ) - ], - arg_msg="#js is a invalid format spec" - ) - , file=sys.stdout -) diff --git a/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_1/stderr.golden b/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_1/stderr.golden new file mode 100644 index 000000000..ce83ca1e0 --- /dev/null +++ b/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:3:11 + | +3 | data = "${a: #yamll}" + " $$ " + | ^ #yamll is a invalid format spec + | \ No newline at end of file diff --git a/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_1/stderr.golden.py b/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_1/stderr.golden.py deleted file mode 100644 index eced44cbe..000000000 --- a/test/grammar/datatype/str_interpolation/invalid_format_spec_fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=11, - ) - ], - arg_msg="#yamll is a invalid format spec" - ) - , file=sys.stdout -) diff --git a/test/grammar/datatype/str_interpolation/invalid_format_value_fail_0/stderr.golden b/test/grammar/datatype/str_interpolation/invalid_format_value_fail_0/stderr.golden new file mode 100644 index 000000000..becdb22a8 --- /dev/null +++ b/test/grammar/datatype/str_interpolation/invalid_format_value_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:2:8 + | +2 | b = "${b = a + 1}" + | ^ invalid string interpolation expression: 'b = a + 1' + | \ No newline at end of file diff --git a/test/grammar/datatype/str_interpolation/invalid_format_value_fail_0/stderr.golden.py b/test/grammar/datatype/str_interpolation/invalid_format_value_fail_0/stderr.golden.py deleted file mode 100644 index 475f5969e..000000000 --- a/test/grammar/datatype/str_interpolation/invalid_format_value_fail_0/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.InvalidFormatSpec_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - end_col_no=19 - ) - ], - arg_msg="invalid string interpolation expression 'b = a + 1'" - ), - file=sys.stdout -) - diff --git a/test/grammar/datatype/str_interpolation/invalid_format_value_fail_1/stderr.golden.py b/test/grammar/datatype/str_interpolation/invalid_format_value_fail_1/stderr.golden.py deleted file mode 100644 index 3b79bbd30..000000000 --- a/test/grammar/datatype/str_interpolation/invalid_format_value_fail_1/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.InvalidFormatSpec_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=8, - end_col_no=37 - ) - ], - arg_msg="invalid single '$', expecting '$' or '{'" - ), - file=sys.stdout -) - diff --git a/test/grammar/datatype/str_interpolation/var_not_define_fail_1/main.k b/test/grammar/datatype/str_interpolation/var_after_string_interpolation/main.k similarity index 100% rename from test/grammar/datatype/str_interpolation/var_not_define_fail_1/main.k rename to test/grammar/datatype/str_interpolation/var_after_string_interpolation/main.k diff --git a/test/grammar/datatype/str_interpolation/var_after_string_interpolation/stdout.golden b/test/grammar/datatype/str_interpolation/var_after_string_interpolation/stdout.golden new file mode 100644 index 000000000..95683b27a --- /dev/null +++ b/test/grammar/datatype/str_interpolation/var_after_string_interpolation/stdout.golden @@ -0,0 +1,3 @@ +a: 1 +b: '3' +c: 2 \ No newline at end of file diff --git a/test/grammar/datatype/str_interpolation/var_not_define_fail_0/stderr.golden b/test/grammar/datatype/str_interpolation/var_not_define_fail_0/stderr.golden new file mode 100644 index 000000000..d2d62332c --- /dev/null +++ b/test/grammar/datatype/str_interpolation/var_not_define_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:2:8 + | +2 | b = "${c + 1}" + | ^ name 'c' is not defined + | \ No newline at end of file diff --git a/test/grammar/datatype/str_interpolation/var_not_define_fail_0/stderr.golden.py b/test/grammar/datatype/str_interpolation/var_not_define_fail_0/stderr.golden.py deleted file mode 100644 index b311d3ab7..000000000 --- a/test/grammar/datatype/str_interpolation/var_not_define_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=8 - ) - ], - arg_msg="name 'c' is not defined" - ), - file=sys.stdout -) - diff --git a/test/grammar/datatype/str_interpolation/var_not_define_fail_1/stderr.golden.py b/test/grammar/datatype/str_interpolation/var_not_define_fail_1/stderr.golden.py deleted file mode 100644 index b311d3ab7..000000000 --- a/test/grammar/datatype/str_interpolation/var_not_define_fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=8 - ) - ], - arg_msg="name 'c' is not defined" - ), - file=sys.stdout -) - diff --git a/test/grammar/datatype/undefined/fail_0/stderr.golden b/test/grammar/datatype/undefined/fail_0/stderr.golden new file mode 100644 index 000000000..e6d5506b0 --- /dev/null +++ b/test/grammar/datatype/undefined/fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | data = a + b + | unsupported operand type(s) for +: 'int' and 'UndefinedType' + | \ No newline at end of file diff --git a/test/grammar/datatype/undefined/fail_0/stderr.golden.py b/test/grammar/datatype/undefined/fail_0/stderr.golden.py deleted file mode 100644 index f522c2ad5..000000000 --- a/test/grammar/datatype/undefined/fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3 - ) - ], - arg_msg="unsupported operand type(s) for +: 'int' and 'UndefinedType'" - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/undefined/fail_1/stderr.golden b/test/grammar/datatype/undefined/fail_1/stderr.golden new file mode 100644 index 000000000..24ff9b479 --- /dev/null +++ b/test/grammar/datatype/undefined/fail_1/stderr.golden @@ -0,0 +1 @@ +int() argument must be a string or a number, not 'UndefinedType' diff --git a/test/grammar/datatype/undefined/fail_1/stderr.golden.py b/test/grammar/datatype/undefined/fail_1/stderr.golden.py deleted file mode 100644 index 6ed112d57..000000000 --- a/test/grammar/datatype/undefined/fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ) - ], - arg_msg="int() argument must be a string or a number, not 'UndefinedType'" - ) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/units/invalid_units_fail_0/stderr.golden b/test/grammar/datatype/units/invalid_units_fail_0/stderr.golden new file mode 100644 index 000000000..964ca4849 --- /dev/null +++ b/test/grammar/datatype/units/invalid_units_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:6 + | +1 | mi = 1mi + | ^ invalid int binary suffix + | \ No newline at end of file diff --git a/test/grammar/datatype/units/invalid_units_fail_0/stderr.golden.py b/test/grammar/datatype/units/invalid_units_fail_0/stderr.golden.py deleted file mode 100644 index dddc2c730..000000000 --- a/test/grammar/datatype/units/invalid_units_fail_0/stderr.golden.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.InvalidSyntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=7, - arg_msg="Expected one of ['newline']" - )], - ), - file=sys.stdout) diff --git a/test/grammar/datatype/units/invalid_units_fail_1/stderr.golden b/test/grammar/datatype/units/invalid_units_fail_1/stderr.golden new file mode 100644 index 000000000..997fa7aa3 --- /dev/null +++ b/test/grammar/datatype/units/invalid_units_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:6 + | +1 | ni = 1ni + | ^ invalid int binary suffix + | \ No newline at end of file diff --git a/test/grammar/datatype/units/invalid_units_fail_1/stderr.golden.py b/test/grammar/datatype/units/invalid_units_fail_1/stderr.golden.py deleted file mode 100644 index dddc2c730..000000000 --- a/test/grammar/datatype/units/invalid_units_fail_1/stderr.golden.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.InvalidSyntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=7, - arg_msg="Expected one of ['newline']" - )], - ), - file=sys.stdout) diff --git a/test/grammar/datatype/units/invalid_units_fail_2/stderr.golden b/test/grammar/datatype/units/invalid_units_fail_2/stderr.golden new file mode 100644 index 000000000..7993a2500 --- /dev/null +++ b/test/grammar/datatype/units/invalid_units_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:6 + | +1 | ui = 1ui + | ^ invalid int binary suffix + | \ No newline at end of file diff --git a/test/grammar/datatype/units/invalid_units_fail_2/stderr.golden.py b/test/grammar/datatype/units/invalid_units_fail_2/stderr.golden.py deleted file mode 100644 index dddc2c730..000000000 --- a/test/grammar/datatype/units/invalid_units_fail_2/stderr.golden.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.InvalidSyntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=7, - arg_msg="Expected one of ['newline']" - )], - ), - file=sys.stdout) diff --git a/test/grammar/datatype/units/range_check_fail_0/stderr.golden b/test/grammar/datatype/units/range_check_fail_0/stderr.golden new file mode 100644 index 000000000..5cc8c801e --- /dev/null +++ b/test/grammar/datatype/units/range_check_fail_0/stderr.golden @@ -0,0 +1 @@ +1329227995784915872903807060280344576: A 64 bit integer overflow \ No newline at end of file diff --git a/test/grammar/datatype/units/range_check_fail_0/stderr.golden.py b/test/grammar/datatype/units/range_check_fail_0/stderr.golden.py deleted file mode 100644 index 8685f546b..000000000 --- a/test/grammar/datatype/units/range_check_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ), - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(1329227995784915872903807060280344576, 64)) - , file=sys.stdout -) - diff --git a/test/grammar/datatype/units/range_check_fail_1/stderr.golden b/test/grammar/datatype/units/range_check_fail_1/stderr.golden new file mode 100644 index 000000000..19826f2ab --- /dev/null +++ b/test/grammar/datatype/units/range_check_fail_1/stderr.golden @@ -0,0 +1 @@ +1073849208920891981824: A 64 bit integer overflow \ No newline at end of file diff --git a/test/grammar/datatype/units/range_check_fail_1/stderr.golden.py b/test/grammar/datatype/units/range_check_fail_1/stderr.golden.py deleted file mode 100644 index 5b3cac3db..000000000 --- a/test/grammar/datatype/units/range_check_fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IntOverflow_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1 - ) - ], - arg_msg=kcl_error.INT_OVER_FLOW_MSG.format(1073849208920891981824, 64) - ) - , file=sys.stdout -) - diff --git a/test/grammar/expr/identifier_prefix/fail_0/stderr.golden b/test/grammar/expr/identifier_prefix/fail_0/stderr.golden new file mode 100644 index 000000000..3a8c137db --- /dev/null +++ b/test/grammar/expr/identifier_prefix/fail_0/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:2:1 + | +2 | $a = 2 + | ^ Can not change the value of 'a', because it was declared immutable + | + --> ${CWD}/main.k:1:1 + | +1 | a = 1 + | ^ The variable 'a' is declared here + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/expr/identifier_prefix/fail_0/stderr.golden.py b/test/grammar/expr/identifier_prefix/fail_0/stderr.golden.py deleted file mode 100644 index 3f4ae726b..000000000 --- a/test/grammar/expr/identifier_prefix/fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1, - end_col_no=3 - - ) - ], - ), - file=sys.stdout -) - diff --git a/test/grammar/expr/identifier_prefix/fail_1/stderr.golden b/test/grammar/expr/identifier_prefix/fail_1/stderr.golden new file mode 100644 index 000000000..da065c2e2 --- /dev/null +++ b/test/grammar/expr/identifier_prefix/fail_1/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:2:1 + | +2 | a = 2 + | ^ Can not change the value of 'a', because it was declared immutable + | + --> ${CWD}/main.k:1:1 + | +1 | $a = 1 + | ^ The variable 'a' is declared here + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/expr/identifier_prefix/fail_1/stderr.golden.py b/test/grammar/expr/identifier_prefix/fail_1/stderr.golden.py deleted file mode 100644 index c8b15b5a3..000000000 --- a/test/grammar/expr/identifier_prefix/fail_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1 - ) - ], - ), - file=sys.stdout -) - diff --git a/test/grammar/import/empty_import_fail/stderr.golden b/test/grammar/import/empty_import_fail/stderr.golden new file mode 100644 index 000000000..45b9ab05a --- /dev/null +++ b/test/grammar/import/empty_import_fail/stderr.golden @@ -0,0 +1,6 @@ +error[E2F04]: CannotFindModule + --> ${CWD}/main.k:1:1 + | +1 | import pkg_empty + | ^ Cannot import the module pkg_empty from ${CWD}/pkg_empty, attempted import folder with no kcl files + | \ No newline at end of file diff --git a/test/grammar/import/empty_import_fail/stderr.golden.py b/test/grammar/import/empty_import_fail/stderr.golden.py deleted file mode 100644 index 49bb33cf7..000000000 --- a/test/grammar/import/empty_import_fail/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -modulename = 'pkg_empty' - -location = os.path.join(cwd, modulename) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CannotFindModule_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - end_col_no=17 - ) - ], - arg_msg=kcl_error.CANNOT_FIND_MODULE_MSG.format(modulename, '{}'.format(location)) + ", attempted import folder with no kcl files" - ), - file=sys.stdout -) diff --git a/test/grammar/import/import_abs_fail_0/app-main/stderr.golden b/test/grammar/import/import_abs_fail_0/app-main/stderr.golden new file mode 100644 index 000000000..0686d6443 --- /dev/null +++ b/test/grammar/import/import_abs_fail_0/app-main/stderr.golden @@ -0,0 +1,14 @@ +error[E2F04]: CannotFindModule + --> ${CWD}/main.k:1:1 + | +1 | import .some0.pkg1 as some00 # some0 not found in app-main package + | ^ Cannot find the module .some0.pkg1 from ${CWD}/some0/pkg1 + | +suggestion: try 'kcl mod add app-main' to download the package not found +suggestion: find more package on 'https://artifacthub.io' +error[E2G22]: TypeError + --> ${CWD}/main.k:3:9 + | +3 | Name1 = some00.Name # some0.pkg1.name + | ^ attribute 'Name' not found in 'module 'app-main.some0.pkg1'' + | \ No newline at end of file diff --git a/test/grammar/import/import_abs_fail_0/app-main/stderr.golden.py b/test/grammar/import/import_abs_fail_0/app-main/stderr.golden.py deleted file mode 100644 index 0c3f64f19..000000000 --- a/test/grammar/import/import_abs_fail_0/app-main/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -modulename = './some0/pkg1' - -packagename = os.path.abspath(os.path.join(cwd, modulename)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CannotFindModule_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - end_col_no=29 - ) - ], - arg_msg=kcl_error.CANNOT_FIND_MODULE_MSG.format(".some0.pkg1", packagename) - ), - file=sys.stdout -) - diff --git a/test/grammar/import/import_abs_fail_1/app-main/stderr.golden b/test/grammar/import/import_abs_fail_1/app-main/stderr.golden new file mode 100644 index 000000000..7e8461930 --- /dev/null +++ b/test/grammar/import/import_abs_fail_1/app-main/stderr.golden @@ -0,0 +1 @@ +attempted import folder with no kcl files \ No newline at end of file diff --git a/test/grammar/import/import_abs_fail_1/app-main/stderr.golden.py b/test/grammar/import/import_abs_fail_1/app-main/stderr.golden.py deleted file mode 100644 index 53cc7ac1a..000000000 --- a/test/grammar/import/import_abs_fail_1/app-main/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -modulename = './../' - -packagename = os.path.abspath(os.path.join(cwd, modulename)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CannotFindModule_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - end_col_no=31 - ) - ], - arg_msg=kcl_error.CANNOT_FIND_MODULE_MSG.format("...some0.pkg1", packagename) - ), - file=sys.stdout -) - diff --git a/test/grammar/import/import_main_file_fail_0/stderr.golden b/test/grammar/import/import_main_file_fail_0/stderr.golden new file mode 100644 index 000000000..a1c9ef71a --- /dev/null +++ b/test/grammar/import/import_main_file_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:1:1 + | +1 | import module + | ^ There is a circular import reference between module main and module + | \ No newline at end of file diff --git a/test/grammar/import/import_main_file_fail_0/stderr.golden.py b/test/grammar/import/import_main_file_fail_0/stderr.golden.py deleted file mode 100644 index 2de4f133d..000000000 --- a/test/grammar/import/import_main_file_fail_0/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -main_file = os.path.join(cwd, 'main.k') -module_file = os.path.join(cwd, 'module.k') - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=module_file, - line_no=2, - col_no=1, - ), - ], - arg_msg=f"Cannot import {main_file} in the main package") - , file=sys.stdout -) - diff --git a/test/grammar/import/import_main_file_fail_1/stderr.golden b/test/grammar/import/import_main_file_fail_1/stderr.golden new file mode 100644 index 000000000..ecde792d4 --- /dev/null +++ b/test/grammar/import/import_main_file_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:1:1 + | +1 | import main + | ^ There is a circular import reference between module main and main + | \ No newline at end of file diff --git a/test/grammar/import/import_main_file_fail_1/stderr.golden.py b/test/grammar/import/import_main_file_fail_1/stderr.golden.py deleted file mode 100644 index 6304f8236..000000000 --- a/test/grammar/import/import_main_file_fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -file = os.path.join(cwd, 'main.k') - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - line_no=1, - col_no=1, - ), - ], - arg_msg=f"Cannot import {file} in the main package") - , file=sys.stdout -) - diff --git a/test/grammar/import/import_syntax_error_0/app-main/stderr.golden b/test/grammar/import/import_syntax_error_0/app-main/stderr.golden new file mode 100644 index 000000000..aceea05aa --- /dev/null +++ b/test/grammar/import/import_syntax_error_0/app-main/stderr.golden @@ -0,0 +1,20 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:15 + | +1 | import .some0..pkg1 as some00 # some0 not found in app-main package + | ^ expected one of ["identifier"] got . + | +error[E2F04]: CannotFindModule + --> ${CWD}/main.k:1:1 + | +1 | import .some0..pkg1 as some00 # some0 not found in app-main package + | ^ Cannot find the module .some0..pkg1 from ${CWD}/some0//pkg1 + | +suggestion: try 'kcl mod add app-main' to download the package not found +suggestion: find more package on 'https://artifacthub.io' +error[E2G22]: TypeError + --> ${CWD}/main.k:3:9 + | +3 | Name1 = some00.Name # some0.pkg1.name + | ^ attribute 'Name' not found in 'module 'app-main.some0..pkg1'' + | \ No newline at end of file diff --git a/test/grammar/import/import_syntax_error_0/app-main/stderr.golden.py b/test/grammar/import/import_syntax_error_0/app-main/stderr.golden.py deleted file mode 100644 index 9e3e9c4bd..000000000 --- a/test/grammar/import/import_syntax_error_0/app-main/stderr.golden.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.InvalidSyntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=15, - arg_msg="Expected one of ['name']" - )], - ), - file=sys.stdout) diff --git a/test/grammar/import/module/no_module_attr_fail_0/stderr.golden b/test/grammar/import/module/no_module_attr_fail_0/stderr.golden new file mode 100644 index 000000000..29c2fbc6b --- /dev/null +++ b/test/grammar/import/module/no_module_attr_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:5 + | +3 | a = p.D + 1 + | ^ attribute 'D' not found in 'module 'pkg'' + | \ No newline at end of file diff --git a/test/grammar/import/module/no_module_attr_fail_0/stderr.golden.py b/test/grammar/import/module/no_module_attr_fail_0/stderr.golden.py deleted file mode 100644 index a002a3a27..000000000 --- a/test/grammar/import/module/no_module_attr_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5 - ) - ], - arg_msg="module 'pkg' has no attribute 'D'" - ), - file=sys.stdout -) - diff --git a/test/grammar/import/module/no_module_attr_fail_1/stderr.golden b/test/grammar/import/module/no_module_attr_fail_1/stderr.golden new file mode 100644 index 000000000..f740e3fc1 --- /dev/null +++ b/test/grammar/import/module/no_module_attr_fail_1/stderr.golden @@ -0,0 +1,12 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:10 + | +3 | schema A(p.D): + | ^ attribute 'D' not found in 'module 'pkg'' + | +error[E2D34]: IllegalInheritError + --> ${CWD}/main.k:3:10 + | +3 | schema A(p.D): + | ^ invalid schema inherit object type, expect schema, got 'any' + | \ No newline at end of file diff --git a/test/grammar/import/module/no_module_attr_fail_1/stderr.golden.py b/test/grammar/import/module/no_module_attr_fail_1/stderr.golden.py deleted file mode 100644 index bb7333979..000000000 --- a/test/grammar/import/module/no_module_attr_fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=10 - ) - ], - arg_msg="module 'pkg' has no attribute 'D'" - ), - file=sys.stdout -) - diff --git a/test/grammar/import/module/no_module_attr_fail_2/stderr.golden b/test/grammar/import/module/no_module_attr_fail_2/stderr.golden new file mode 100644 index 000000000..bedb8c0e6 --- /dev/null +++ b/test/grammar/import/module/no_module_attr_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:5 + | +3 | a = math.err_func(1) + | ^ attribute 'err_func' not found in 'module 'math'' + | \ No newline at end of file diff --git a/test/grammar/import/module/no_module_attr_fail_2/stderr.golden.py b/test/grammar/import/module/no_module_attr_fail_2/stderr.golden.py deleted file mode 100644 index 3cb9d21df..000000000 --- a/test/grammar/import/module/no_module_attr_fail_2/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5 - ) - ], - arg_msg="module 'math' has no attribute 'err_func'" - ), - file=sys.stdout -) - diff --git a/test/grammar/import/module/no_module_attr_fail_3/stderr.golden b/test/grammar/import/module/no_module_attr_fail_3/stderr.golden new file mode 100644 index 000000000..82fbd5bb6 --- /dev/null +++ b/test/grammar/import/module/no_module_attr_fail_3/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:5 + | +3 | a = mymath.err_func(1) + | ^ attribute 'err_func' not found in 'module 'math'' + | \ No newline at end of file diff --git a/test/grammar/import/module/no_module_attr_fail_3/stderr.golden.py b/test/grammar/import/module/no_module_attr_fail_3/stderr.golden.py deleted file mode 100644 index 3cb9d21df..000000000 --- a/test/grammar/import/module/no_module_attr_fail_3/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5 - ) - ], - arg_msg="module 'math' has no attribute 'err_func'" - ), - file=sys.stdout -) - diff --git a/test/grammar/import/pkg_inplace_modify_fail_0/stderr.golden b/test/grammar/import/pkg_inplace_modify_fail_0/stderr.golden new file mode 100644 index 000000000..ac1491f52 --- /dev/null +++ b/test/grammar/import/pkg_inplace_modify_fail_0/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:3:1 + | +3 | pkg.a = 1 + | ^ Can not change the value of 'pkg', because it was declared immutable + | + --> ${CWD}/main.k:1:1 + | +1 | import pkg + | ^ The variable 'pkg' is declared here + | +note: change the variable name to '_pkg' to make it mutable \ No newline at end of file diff --git a/test/grammar/import/pkg_inplace_modify_fail_0/stderr.golden.py b/test/grammar/import/pkg_inplace_modify_fail_0/stderr.golden.py deleted file mode 100644 index 26a35d289..000000000 --- a/test/grammar/import/pkg_inplace_modify_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=1, - ), - ], - arg_msg="Immutable variable is modified during compiling") - , file=sys.stdout -) - diff --git a/test/grammar/import/pkg_inplace_modify_fail_1/stderr.golden b/test/grammar/import/pkg_inplace_modify_fail_1/stderr.golden new file mode 100644 index 000000000..94e2c83d8 --- /dev/null +++ b/test/grammar/import/pkg_inplace_modify_fail_1/stderr.golden @@ -0,0 +1 @@ +pkg.a |= 2 \ No newline at end of file diff --git a/test/grammar/import/pkg_inplace_modify_fail_1/stderr.golden.py b/test/grammar/import/pkg_inplace_modify_fail_1/stderr.golden.py deleted file mode 100644 index 88ee9a09b..000000000 --- a/test/grammar/import/pkg_inplace_modify_fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=1, - ) - ], - arg_msg="only schema and dict object can be updated attribute" - ), - file=sys.stdout -) - diff --git a/test/grammar/import/pkg_inplace_modify_fail_2/stderr.golden b/test/grammar/import/pkg_inplace_modify_fail_2/stderr.golden new file mode 100644 index 000000000..f3af0be03 --- /dev/null +++ b/test/grammar/import/pkg_inplace_modify_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:4:1 + | +4 | pkg.a = 2 + | failed to update the dict. An iterable of key-value pairs was expected, but got UndefinedType. Check if the syntax for updating the dictionary with the attribute 'a' is correct + | \ No newline at end of file diff --git a/test/grammar/import/pkg_inplace_modify_fail_2/stderr.golden.py b/test/grammar/import/pkg_inplace_modify_fail_2/stderr.golden.py deleted file mode 100644 index e430951f1..000000000 --- a/test/grammar/import/pkg_inplace_modify_fail_2/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=5, - ), - ], - arg_msg="only schema and dict object can be updated attribute") - , file=sys.stdout -) - diff --git a/test/grammar/multi_file_compilation/invalid/invalid_0/stderr.golden b/test/grammar/multi_file_compilation/invalid/invalid_0/stderr.golden new file mode 100644 index 000000000..7050e975b --- /dev/null +++ b/test/grammar/multi_file_compilation/invalid/invalid_0/stderr.golden @@ -0,0 +1,18 @@ +error[E1001]: ImmutableError + --> ${CWD}/pkg.k:1:1 + | +1 | list_data = 1 + | ^ Can not change the value of 'list_data', because it was declared immutable + | + --> ${CWD}/main.k:1:1 + | +1 | list_data = [1, 2, 3] + | ^ The variable 'list_data' is declared here + | +note: change the variable name to '_list_data' to make it mutable +error[E2G22]: TypeError + --> ${CWD}/pkg.k:1:1 + | +1 | list_data = 1 + | ^ expected [int], got int(1) + | \ No newline at end of file diff --git a/test/grammar/multi_file_compilation/invalid/invalid_0/stderr.golden.py b/test/grammar/multi_file_compilation/invalid/invalid_0/stderr.golden.py deleted file mode 100644 index 412c13ee0..000000000 --- a/test/grammar/multi_file_compilation/invalid/invalid_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg.k", - line_no=1, - col_no=1 - ) - ], - ), - file=sys.stdout -) - diff --git a/test/grammar/multi_file_compilation/invalid/invalid_1/stderr.golden b/test/grammar/multi_file_compilation/invalid/invalid_1/stderr.golden new file mode 100644 index 000000000..bd4399fea --- /dev/null +++ b/test/grammar/multi_file_compilation/invalid/invalid_1/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/pkg.k:3:5 + | +3 | age: "18" + | ^ expected int, got str(18) + | + --> ${CWD}/main.k:3:5 + | +3 | age: int + | ^ variable is defined here, its type is int, but got str(18) + | \ No newline at end of file diff --git a/test/grammar/multi_file_compilation/invalid/invalid_1/stderr.golden.py b/test/grammar/multi_file_compilation/invalid/invalid_1/stderr.golden.py deleted file mode 100644 index f88f1fe78..000000000 --- a/test/grammar/multi_file_compilation/invalid/invalid_1/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/pkg.k", - line_no=3, - col_no=5, - arg_msg="got str(18)" - ) - ], - arg_msg="expect int, got str(18)" - ), - file=sys.stdout -) - diff --git a/test/grammar/multi_file_compilation/invalid/invalid_2/stderr.golden b/test/grammar/multi_file_compilation/invalid/invalid_2/stderr.golden new file mode 100644 index 000000000..d15cde6f7 --- /dev/null +++ b/test/grammar/multi_file_compilation/invalid/invalid_2/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/pkg2.k:1:1 + | +1 | a = 3 + | ^ Can not change the value of 'a', because it was declared immutable + | + --> ${CWD}/pkg1.k:1:1 + | +1 | a = _a + | ^ The variable 'a' is declared here + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/multi_file_compilation/invalid/invalid_2/stderr.golden.py b/test/grammar/multi_file_compilation/invalid/invalid_2/stderr.golden.py deleted file mode 100644 index afe307785..000000000 --- a/test/grammar/multi_file_compilation/invalid/invalid_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg2.k", - line_no=1, - col_no=1 - ) - ], - ), - file=sys.stdout -) - diff --git a/test/grammar/nest_var/nest_var_fail_0/stderr.golden b/test/grammar/nest_var/nest_var_fail_0/stderr.golden new file mode 100644 index 000000000..481bbec6d --- /dev/null +++ b/test/grammar/nest_var/nest_var_fail_0/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | name.name: "Alice" + | ^ expected str, got {str(name):str(Alice)} + | + --> ${CWD}/main.k:2:5 + | +2 | name: str + | ^ variable is defined here, its type is str, but got {str(name):str(Alice)} + | \ No newline at end of file diff --git a/test/grammar/nest_var/nest_var_fail_0/stderr.golden.py b/test/grammar/nest_var/nest_var_fail_0/stderr.golden.py deleted file mode 100644 index 375e24f9b..000000000 --- a/test/grammar/nest_var/nest_var_fail_0/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got {str(name):str(Alice)}" - ) - ], - arg_msg="expect str, got {str(name):str(Alice)}" - ), - file=sys.stdout -) - diff --git a/test/grammar/nest_var/nest_var_fail_1/stderr.golden b/test/grammar/nest_var/nest_var_fail_1/stderr.golden new file mode 100644 index 000000000..82f3510f2 --- /dev/null +++ b/test/grammar/nest_var/nest_var_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:8:10 + | +8 | name.err_name: "Alice" + | ^ Cannot add member 'err_name' to schema 'Name' + | \ No newline at end of file diff --git a/test/grammar/nest_var/nest_var_fail_1/stderr.golden.py b/test/grammar/nest_var/nest_var_fail_1/stderr.golden.py deleted file mode 100644 index c541677e3..000000000 --- a/test/grammar/nest_var/nest_var_fail_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=5, - arg_msg="'err_name' is not defined in schema 'Name'" - ), - ], - arg_msg="Cannot add member 'err_name' to schema 'Name'") - , file=sys.stdout -) - diff --git a/test/grammar/option/file_options_fail_0/stderr.golden b/test/grammar/option/file_options_fail_0/stderr.golden new file mode 100644 index 000000000..6f0cee190 --- /dev/null +++ b/test/grammar/option/file_options_fail_0/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Failed to load 'temp.yaml', invalid setting file format \ No newline at end of file diff --git a/test/grammar/option/file_options_fail_0/stderr.golden.py b/test/grammar/option/file_options_fail_0/stderr.golden.py deleted file mode 100644 index 5dac81fe3..000000000 --- a/test/grammar/option/file_options_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error - -file = 'temp.yaml' - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - ) - ], - arg_msg="Invalid configuration in setting file:\nsetting file content should be a mapping, got: 1" - ), - file=sys.stdout -) - - diff --git a/test/grammar/option/file_options_fail_1/stderr.golden b/test/grammar/option/file_options_fail_1/stderr.golden new file mode 100644 index 000000000..6f0cee190 --- /dev/null +++ b/test/grammar/option/file_options_fail_1/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Failed to load 'temp.yaml', invalid setting file format \ No newline at end of file diff --git a/test/grammar/option/file_options_fail_1/stderr.golden.py b/test/grammar/option/file_options_fail_1/stderr.golden.py deleted file mode 100644 index e77a4cf22..000000000 --- a/test/grammar/option/file_options_fail_1/stderr.golden.py +++ /dev/null @@ -1,27 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error - -file = 'temp.yaml' - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - ) - ], - arg_msg="""Invalid configuration in setting file: -invalid kcl_options value, should be list of key/value mapping. -=== A good example will be:=== -kcl_options: - - key: myArg # the option key must be a string value - value: myArgValue -=== got: === -kcl_options: - key: key - value: value -""" - ), - file=sys.stdout -) diff --git a/test/grammar/option/file_options_fail_2/stderr.golden b/test/grammar/option/file_options_fail_2/stderr.golden new file mode 100644 index 000000000..6f0cee190 --- /dev/null +++ b/test/grammar/option/file_options_fail_2/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Failed to load 'temp.yaml', invalid setting file format \ No newline at end of file diff --git a/test/grammar/option/file_options_fail_2/stderr.golden.py b/test/grammar/option/file_options_fail_2/stderr.golden.py deleted file mode 100644 index bd2c44876..000000000 --- a/test/grammar/option/file_options_fail_2/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error - -file = 'temp.yaml' - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - ) - ], - arg_msg="""Invalid configuration in setting file: -invalid kcl_options value, should be list of key/value mapping. -=== A good example will be:=== -kcl_options: - - key: myArg # the option key must be a string value - value: myArgValue -=== got: === -kcl_options: -- key -""" - ), - file=sys.stdout -) diff --git a/test/grammar/option/file_options_fail_3/stderr.golden b/test/grammar/option/file_options_fail_3/stderr.golden new file mode 100644 index 000000000..6f0cee190 --- /dev/null +++ b/test/grammar/option/file_options_fail_3/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Failed to load 'temp.yaml', invalid setting file format \ No newline at end of file diff --git a/test/grammar/option/file_options_fail_3/stderr.golden.py b/test/grammar/option/file_options_fail_3/stderr.golden.py deleted file mode 100644 index 30e113c52..000000000 --- a/test/grammar/option/file_options_fail_3/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error - -file = 'temp.yaml' - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - ) - ], - arg_msg="""Invalid yaml content of setting file: -while scanning a quoted scalar - in "", line 1, column 1: - " - ^ (line: 1) -found unexpected end of stream - in "", line 1, column 2: - " - ^ (line: 1)""" - ), - file=sys.stdout -) diff --git a/test/grammar/option/file_options_fail_4/stderr.golden b/test/grammar/option/file_options_fail_4/stderr.golden new file mode 100644 index 000000000..6f0cee190 --- /dev/null +++ b/test/grammar/option/file_options_fail_4/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Failed to load 'temp.yaml', invalid setting file format \ No newline at end of file diff --git a/test/grammar/option/file_options_fail_4/stderr.golden.py b/test/grammar/option/file_options_fail_4/stderr.golden.py deleted file mode 100644 index 21055f494..000000000 --- a/test/grammar/option/file_options_fail_4/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error - -file = 'temp.yaml' - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - ) - ], - arg_msg="""Invalid configuration in setting file: -setting file content should be a mapping, got: :2""" - ), - file=sys.stdout -) diff --git a/test/grammar/option/invalid_option_fail_0/stderr.golden b/test/grammar/option/invalid_option_fail_0/stderr.golden new file mode 100644 index 000000000..a5983f911 --- /dev/null +++ b/test/grammar/option/invalid_option_fail_0/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Invalid value for top level arguments \ No newline at end of file diff --git a/test/grammar/option/invalid_option_fail_0/stderr.golden.py b/test/grammar/option/invalid_option_fail_0/stderr.golden.py deleted file mode 100644 index 3ee0b6cf3..000000000 --- a/test/grammar/option/invalid_option_fail_0/stderr.golden.py +++ /dev/null @@ -1,15 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - arg_msg="Invalid value for option \"--argument(-D)\": should be in = pattern, got: key=value=" - ), - file=sys.stdout -) - diff --git a/test/grammar/option/invalid_option_fail_1/stderr.golden b/test/grammar/option/invalid_option_fail_1/stderr.golden new file mode 100644 index 000000000..a5983f911 --- /dev/null +++ b/test/grammar/option/invalid_option_fail_1/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Invalid value for top level arguments \ No newline at end of file diff --git a/test/grammar/option/invalid_option_fail_1/stderr.golden.py b/test/grammar/option/invalid_option_fail_1/stderr.golden.py deleted file mode 100644 index a77745145..000000000 --- a/test/grammar/option/invalid_option_fail_1/stderr.golden.py +++ /dev/null @@ -1,15 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - arg_msg="Invalid value for option \"--argument(-D)\": should be in = pattern, got: key=" - ), - file=sys.stdout -) - diff --git a/test/grammar/option/invalid_option_fail_2/stderr.golden b/test/grammar/option/invalid_option_fail_2/stderr.golden new file mode 100644 index 000000000..a5983f911 --- /dev/null +++ b/test/grammar/option/invalid_option_fail_2/stderr.golden @@ -0,0 +1,2 @@ +EvaluationError +Invalid value for top level arguments \ No newline at end of file diff --git a/test/grammar/option/invalid_option_fail_2/stderr.golden.py b/test/grammar/option/invalid_option_fail_2/stderr.golden.py deleted file mode 100644 index 2b9f41c64..000000000 --- a/test/grammar/option/invalid_option_fail_2/stderr.golden.py +++ /dev/null @@ -1,11 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalArgumentError_TYPE, - arg_msg="Invalid value for option \"--argument(-D)\": Invalid option name: ''. should be a non-empty string" - ), - file=sys.stdout -) - diff --git a/test/grammar/option/option_help_fail_0/stderr.golden b/test/grammar/option/option_help_fail_0/stderr.golden new file mode 100644 index 000000000..bc9d901e8 --- /dev/null +++ b/test/grammar/option/option_help_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:1:1 + | +1 | name = option("name", required=True, help="set name value") + | option('name') must be initialized, try '-D name=?' argument + | \ No newline at end of file diff --git a/test/grammar/option/option_help_fail_0/stderr.golden.py b/test/grammar/option/option_help_fail_0/stderr.golden.py deleted file mode 100644 index d70de9542..000000000 --- a/test/grammar/option/option_help_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -file = os.path.join(cwd, 'main.k') - -name = 'name' - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - line_no=1, - ), - ], - arg_msg=f"option('{name}') must be initialized, try '-D {name}=?' argument") - , file=sys.stdout -) - diff --git a/test/grammar/option/option_help_type_fail_0/stderr.golden b/test/grammar/option/option_help_type_fail_0/stderr.golden new file mode 100644 index 000000000..a8a56f953 --- /dev/null +++ b/test/grammar/option/option_help_type_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:1:1 + | +1 | name = option("name", type='str', required=True, help="set name value") + | option('name') must be initialized, try '-D name=?' argument + | \ No newline at end of file diff --git a/test/grammar/option/option_help_type_fail_0/stderr.golden.py b/test/grammar/option/option_help_type_fail_0/stderr.golden.py deleted file mode 100644 index f54aea77c..000000000 --- a/test/grammar/option/option_help_type_fail_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -file = os.path.join(cwd, 'main.k') - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - line_no=1, - ), - ], - arg_msg=f"option('name') must be initialized, try '-D name=?' argument") - , file=sys.stdout -) - diff --git a/test/grammar/option/type_convert_fail_0/stderr.golden b/test/grammar/option/type_convert_fail_0/stderr.golden new file mode 100644 index 000000000..d180e127b --- /dev/null +++ b/test/grammar/option/type_convert_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:1 + | +3 | c = option("key3", type="dict") + | cannot use '0.0' as type 'dict' + | \ No newline at end of file diff --git a/test/grammar/option/type_convert_fail_0/stderr.golden.py b/test/grammar/option/type_convert_fail_0/stderr.golden.py deleted file mode 100644 index b57d90909..000000000 --- a/test/grammar/option/type_convert_fail_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -file = os.path.join(cwd, 'main.k') - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - line_no=3, - ), - ], - arg_msg=f"cannot use '0.0' as type 'dict'") - , file=sys.stdout -) - diff --git a/test/grammar/option/type_convert_fail_1/stderr.golden b/test/grammar/option/type_convert_fail_1/stderr.golden new file mode 100644 index 000000000..e21ddeb34 --- /dev/null +++ b/test/grammar/option/type_convert_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:1:1 + | +1 | a = option("key1", type="list", default={"key": "value"}) + | cannot use '{'key': 'value'}' as type 'list' + | \ No newline at end of file diff --git a/test/grammar/option/type_convert_fail_1/stderr.golden.py b/test/grammar/option/type_convert_fail_1/stderr.golden.py deleted file mode 100644 index 04e105ffd..000000000 --- a/test/grammar/option/type_convert_fail_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -file = os.path.join(cwd, 'main.k') - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=file, - line_no=1, - ), - ], - arg_msg=f"cannot use '{{'key': 'value'}}' as type 'list'") - , file=sys.stdout -) - diff --git a/test/grammar/option/type_convert_fail_2/stderr.golden b/test/grammar/option/type_convert_fail_2/stderr.golden new file mode 100644 index 000000000..5188ca9f4 --- /dev/null +++ b/test/grammar/option/type_convert_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:51 + | +1 | a = option(type="list", default={"key": "value"}, "key1") + | ^ positional argument follows keyword argument + | \ No newline at end of file diff --git a/test/grammar/option/type_convert_fail_2/stderr.golden.py b/test/grammar/option/type_convert_fail_2/stderr.golden.py deleted file mode 100644 index 7b2d64745..000000000 --- a/test/grammar/option/type_convert_fail_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -file = os.path.join(cwd, 'main.k') - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=51, - end_col_no=57 - ) - ], - arg_msg="positional argument follows keyword argument"), - file=sys.stdout -) diff --git a/test/grammar/override/fail/type_fail/stderr.golden b/test/grammar/override/fail/type_fail/stderr.golden new file mode 100644 index 000000000..62e2840ac --- /dev/null +++ b/test/grammar/override/fail/type_fail/stderr.golden @@ -0,0 +1 @@ +expect int, got str(A) diff --git a/test/grammar/override/fail/type_fail/stderr.golden.py b/test/grammar/override/fail/type_fail/stderr.golden.py deleted file mode 100644 index 5b4c31676..000000000 --- a/test/grammar/override/fail/type_fail/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=5, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - ], - arg_msg="expect int, got str(A)" - ), - file=sys.stdout -) - diff --git a/test/grammar/path_selector/invalid/invalid_0/stderr.golden b/test/grammar/path_selector/invalid/invalid_0/stderr.golden new file mode 100644 index 000000000..c5dd438ce --- /dev/null +++ b/test/grammar/path_selector/invalid/invalid_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | dict_data = {"key1": "value1", "key2": "value2"} + | invalid path select operand :list_data.[0,1], value not found + | \ No newline at end of file diff --git a/test/grammar/path_selector/invalid/invalid_0/stderr.golden.py b/test/grammar/path_selector/invalid/invalid_0/stderr.golden.py deleted file mode 100644 index 8cdd91d5e..000000000 --- a/test/grammar/path_selector/invalid/invalid_0/stderr.golden.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - arg_msg="invalid path selector value [0,1]" - ), - file=sys.stdout -) - diff --git a/test/grammar/path_selector/invalid/invalid_1/stderr.golden b/test/grammar/path_selector/invalid/invalid_1/stderr.golden new file mode 100644 index 000000000..7d3195d98 --- /dev/null +++ b/test/grammar/path_selector/invalid/invalid_1/stderr.golden @@ -0,0 +1 @@ +list variable can't be used with dict selector expression diff --git a/test/grammar/path_selector/invalid/invalid_1/stderr.golden.py b/test/grammar/path_selector/invalid/invalid_1/stderr.golden.py deleted file mode 100644 index 311862206..000000000 --- a/test/grammar/path_selector/invalid/invalid_1/stderr.golden.py +++ /dev/null @@ -1,13 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.SelectorError_TYPE, - arg_msg="list variable can't be used with dict selector expression" - ), - file=sys.stdout -) diff --git a/test/grammar/path_selector/invalid/invalid_2/stderr.golden b/test/grammar/path_selector/invalid/invalid_2/stderr.golden new file mode 100644 index 000000000..8d937c411 --- /dev/null +++ b/test/grammar/path_selector/invalid/invalid_2/stderr.golden @@ -0,0 +1 @@ +dict variable can't be used with list selector expression diff --git a/test/grammar/path_selector/invalid/invalid_2/stderr.golden.py b/test/grammar/path_selector/invalid/invalid_2/stderr.golden.py deleted file mode 100644 index ed87bbf16..000000000 --- a/test/grammar/path_selector/invalid/invalid_2/stderr.golden.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.SelectorError_TYPE, - arg_msg="dict variable can't be used with list selector expression" - ), - file=sys.stdout -) - diff --git a/test/grammar/quant/all/multi_cons_invalid_0/stderr.golden b/test/grammar/quant/all/multi_cons_invalid_0/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/all/multi_cons_invalid_0/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/all/multi_cons_invalid_0/stderr.golden.py b/test/grammar/quant/all/multi_cons_invalid_0/stderr.golden.py deleted file mode 100644 index e5943ab87..000000000 --- a/test/grammar/quant/all/multi_cons_invalid_0/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) diff --git a/test/grammar/quant/all/multi_cons_invalid_1/stderr.golden b/test/grammar/quant/all/multi_cons_invalid_1/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/all/multi_cons_invalid_1/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/all/multi_cons_invalid_1/stderr.golden.py b/test/grammar/quant/all/multi_cons_invalid_1/stderr.golden.py deleted file mode 100644 index 5c35815bf..000000000 --- a/test/grammar/quant/all/multi_cons_invalid_1/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) \ No newline at end of file diff --git a/test/grammar/quant/all/multi_cons_invalid_2/stderr.golden b/test/grammar/quant/all/multi_cons_invalid_2/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/all/multi_cons_invalid_2/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/all/multi_cons_invalid_2/stderr.golden.py b/test/grammar/quant/all/multi_cons_invalid_2/stderr.golden.py deleted file mode 100644 index e5943ab87..000000000 --- a/test/grammar/quant/all/multi_cons_invalid_2/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) diff --git a/test/grammar/quant/all/multi_cons_invalid_3/stderr.golden b/test/grammar/quant/all/multi_cons_invalid_3/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/all/multi_cons_invalid_3/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/all/multi_cons_invalid_3/stderr.golden.py b/test/grammar/quant/all/multi_cons_invalid_3/stderr.golden.py deleted file mode 100644 index e5943ab87..000000000 --- a/test/grammar/quant/all/multi_cons_invalid_3/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) diff --git a/test/grammar/quant/all/multi_cons_invalid_4/stderr.golden b/test/grammar/quant/all/multi_cons_invalid_4/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/all/multi_cons_invalid_4/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/all/multi_cons_invalid_4/stderr.golden.py b/test/grammar/quant/all/multi_cons_invalid_4/stderr.golden.py deleted file mode 100644 index e5943ab87..000000000 --- a/test/grammar/quant/all/multi_cons_invalid_4/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) diff --git a/test/grammar/quant/all/simple_invalid_0/stderr.golden b/test/grammar/quant/all/simple_invalid_0/stderr.golden new file mode 100644 index 000000000..5ec907e63 --- /dev/null +++ b/test/grammar/quant/all/simple_invalid_0/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid cluster ip" + | Check failed on the condition: invalid cluster ip + | \ No newline at end of file diff --git a/test/grammar/quant/all/simple_invalid_0/stderr.golden.py b/test/grammar/quant/all/simple_invalid_0/stderr.golden.py deleted file mode 100644 index fa6173c1e..000000000 --- a/test/grammar/quant/all/simple_invalid_0/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid cluster ip") - , file=sys.stdout -) diff --git a/test/grammar/quant/any/multi_cons_invalid_0/stderr.golden b/test/grammar/quant/any/multi_cons_invalid_0/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/any/multi_cons_invalid_0/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/any/multi_cons_invalid_0/stderr.golden.py b/test/grammar/quant/any/multi_cons_invalid_0/stderr.golden.py deleted file mode 100644 index e5943ab87..000000000 --- a/test/grammar/quant/any/multi_cons_invalid_0/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) diff --git a/test/grammar/quant/any/multi_cons_invalid_1/stderr.golden b/test/grammar/quant/any/multi_cons_invalid_1/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/any/multi_cons_invalid_1/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/any/multi_cons_invalid_1/stderr.golden.py b/test/grammar/quant/any/multi_cons_invalid_1/stderr.golden.py deleted file mode 100644 index e5943ab87..000000000 --- a/test/grammar/quant/any/multi_cons_invalid_1/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) diff --git a/test/grammar/quant/any/multi_cons_invalid_2/stderr.golden b/test/grammar/quant/any/multi_cons_invalid_2/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/any/multi_cons_invalid_2/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/any/multi_cons_invalid_2/stderr.golden.py b/test/grammar/quant/any/multi_cons_invalid_2/stderr.golden.py deleted file mode 100644 index 7322e4809..000000000 --- a/test/grammar/quant/any/multi_cons_invalid_2/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) - diff --git a/test/grammar/quant/any/multi_cons_invalid_3/stderr.golden b/test/grammar/quant/any/multi_cons_invalid_3/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/any/multi_cons_invalid_3/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/any/multi_cons_invalid_3/stderr.golden.py b/test/grammar/quant/any/multi_cons_invalid_3/stderr.golden.py deleted file mode 100644 index 903348ae9..000000000 --- a/test/grammar/quant/any/multi_cons_invalid_3/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) - diff --git a/test/grammar/quant/any/multi_cons_invalid_4/stderr.golden b/test/grammar/quant/any/multi_cons_invalid_4/stderr.golden new file mode 100644 index 000000000..d0c9daa20 --- /dev/null +++ b/test/grammar/quant/any/multi_cons_invalid_4/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "invalid port" + | Check failed on the condition: invalid port + | \ No newline at end of file diff --git a/test/grammar/quant/any/multi_cons_invalid_4/stderr.golden.py b/test/grammar/quant/any/multi_cons_invalid_4/stderr.golden.py deleted file mode 100644 index 7322e4809..000000000 --- a/test/grammar/quant/any/multi_cons_invalid_4/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="invalid port") - , file=sys.stdout -) - diff --git a/test/grammar/quant/any/simple_invalid_0/stderr.golden b/test/grammar/quant/any/simple_invalid_0/stderr.golden new file mode 100644 index 000000000..20c58be9a --- /dev/null +++ b/test/grammar/quant/any/simple_invalid_0/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:8 + | +10 | main = app_conf { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | }, "no server defined" + | Check failed on the condition: no server defined + | \ No newline at end of file diff --git a/test/grammar/quant/any/simple_invalid_0/stderr.golden.py b/test/grammar/quant/any/simple_invalid_0/stderr.golden.py deleted file mode 100644 index 45187ecc5..000000000 --- a/test/grammar/quant/any/simple_invalid_0/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="no server defined") - , file=sys.stdout -) - diff --git a/test/grammar/scalar/invalid/conflict_0/stderr.golden b/test/grammar/scalar/invalid/conflict_0/stderr.golden new file mode 100644 index 000000000..f9830b6c9 --- /dev/null +++ b/test/grammar/scalar/invalid/conflict_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | 2 + | conflicting values between 2 and 1 + | \ No newline at end of file diff --git a/test/grammar/scalar/invalid/conflict_0/stderr.golden.py b/test/grammar/scalar/invalid/conflict_0/stderr.golden.py deleted file mode 100644 index bded16536..000000000 --- a/test/grammar/scalar/invalid/conflict_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="conflicting values between 2 and 1" - ) - , file=sys.stdout -) diff --git a/test/grammar/scalar/invalid/conflict_1/stderr.golden b/test/grammar/scalar/invalid/conflict_1/stderr.golden new file mode 100644 index 000000000..72100f1f3 --- /dev/null +++ b/test/grammar/scalar/invalid/conflict_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | 1 + | conflicting values between {...} and 1 + | \ No newline at end of file diff --git a/test/grammar/scalar/invalid/conflict_1/stderr.golden.py b/test/grammar/scalar/invalid/conflict_1/stderr.golden.py deleted file mode 100644 index baf0f8566..000000000 --- a/test/grammar/scalar/invalid/conflict_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="conflicting values between {...} and 1" - ) - , file=sys.stdout -) diff --git a/test/grammar/schema/assign_stmt/fail_0/stderr.golden b/test/grammar/schema/assign_stmt/fail_0/stderr.golden new file mode 100644 index 000000000..310899b9d --- /dev/null +++ b/test/grammar/schema/assign_stmt/fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | a.b = 1 + | failed to update the dict. An iterable of key-value pairs was expected, but got UndefinedType. Check if the syntax for updating the dictionary with the attribute 'b' is correct + | \ No newline at end of file diff --git a/test/grammar/schema/assign_stmt/fail_0/stderr.golden.py b/test/grammar/schema/assign_stmt/fail_0/stderr.golden.py deleted file mode 100644 index 8af3810e4..000000000 --- a/test/grammar/schema/assign_stmt/fail_0/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - ), - ], - arg_msg="failed to update the dict. An iterable of key-value pairs was expected, but got UndefinedType. Check if the syntax for updating the dictionary with the attribute 'b' is correct") - , file=sys.stdout -) diff --git a/test/grammar/schema/check_block/check_block_fail_0/stderr.golden b/test/grammar/schema/check_block/check_block_fail_0/stderr.golden new file mode 100644 index 000000000..b1bd15609 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_0/stderr.golden @@ -0,0 +1,24 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:19 + | +12 | (lastName not None) + | ^ expected one of [")"] got identifier + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:27 + | +12 | (lastName not None) + | ^ expected one of ["identifier", "literal", "(", "[", "{"] got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:27 + | +12 | (lastName not None) + | ^ expected expression got ) + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:27 + | +12 | (lastName not None) + | ^ expected one of ["identifier", "literal", "(", "[", "{"] got newline + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_0/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_0/stderr.golden.py deleted file mode 100644 index c58bf295a..000000000 --- a/test/grammar/schema/check_block/check_block_fail_0/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=19, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) - diff --git a/test/grammar/schema/check_block/check_block_fail_1/stderr.golden b/test/grammar/schema/check_block/check_block_fail_1/stderr.golden new file mode 100644 index 000000000..592dca22d --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_1/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:11 + | +9 | JohnDoe = Person { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | age < 140, "age is too large" + | Check failed on the condition: age is too large + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_1/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_1/stderr.golden.py deleted file mode 100644 index 478860683..000000000 --- a/test/grammar/schema/check_block/check_block_fail_1/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND, - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR, - ), - ], - arg_msg="age is too large") - , file=sys.stdout -) - diff --git a/test/grammar/schema/check_block/check_block_fail_10/stderr.golden b/test/grammar/schema/check_block/check_block_fail_10/stderr.golden new file mode 100644 index 000000000..41b5ff4aa --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_10/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:8:9 + | +8 | count = Count { + | ^ Instance check failed + | + --> ${CWD}/main.k:6:1 + | +6 | secondCount < 100 + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_10/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_10/stderr.golden.py deleted file mode 100644 index 55d498f65..000000000 --- a/test/grammar/schema/check_block/check_block_fail_10/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=9, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) - diff --git a/test/grammar/schema/check_block/check_block_fail_11/stderr.golden b/test/grammar/schema/check_block/check_block_fail_11/stderr.golden new file mode 100644 index 000000000..5e149cee5 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_11/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:3:9 + | +3 | alice = pkg.Person {} + | ^ Instance check failed + | + --> ${CWD}/pkg/person.k:5:1 + | +5 | name, "name should be defined" + | Check failed on the condition: name should be defined + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_11/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_11/stderr.golden.py deleted file mode 100644 index 80933a12c..000000000 --- a/test/grammar/schema/check_block/check_block_fail_11/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg/person.k", - line_no=5, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=9, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="name should be defined") - , file=sys.stdout -) - diff --git a/test/grammar/schema/check_block/check_block_fail_2/stderr.golden b/test/grammar/schema/check_block/check_block_fail_2/stderr.golden new file mode 100644 index 000000000..ff2140ab5 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_2/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:13:11 + | +13 | JohnDoe = Student { + | ^ Instance check failed + | + --> ${CWD}/main.k:11:1 + | +11 | 12 <= age <= 18 + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_2/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_2/stderr.golden.py deleted file mode 100644 index 899f3ee56..000000000 --- a/test/grammar/schema/check_block/check_block_fail_2/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=13, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) - diff --git a/test/grammar/schema/check_block/check_block_fail_3/stderr.golden b/test/grammar/schema/check_block/check_block_fail_3/stderr.golden new file mode 100644 index 000000000..2b73867e1 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_3/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:13:11 + | +13 | JohnDoe = Student { + | ^ Instance check failed + | + --> ${CWD}/main.k:6:1 + | +6 | len(lastName) < 10 + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_3/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_3/stderr.golden.py deleted file mode 100644 index 51ccccd68..000000000 --- a/test/grammar/schema/check_block/check_block_fail_3/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=13, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) - diff --git a/test/grammar/schema/check_block/check_block_fail_4/stderr.golden b/test/grammar/schema/check_block/check_block_fail_4/stderr.golden new file mode 100644 index 000000000..6026cdd15 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_4/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:8:14 + | +8 | SameenShaw = Person { + | ^ Instance check failed + | + --> ${CWD}/main.k:6:1 + | +6 | "father" not in family if family + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_4/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_4/stderr.golden.py deleted file mode 100644 index cebae8ba3..000000000 --- a/test/grammar/schema/check_block/check_block_fail_4/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=14, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) - diff --git a/test/grammar/schema/check_block/check_block_fail_5/stderr.golden b/test/grammar/schema/check_block/check_block_fail_5/stderr.golden new file mode 100644 index 000000000..fe3996074 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_5/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:11 + | +9 | JohnDoe = Person { + | ^ Instance check failed + | + --> ${CWD}/main.k:6:1 + | +6 | name, "name should be defined and not empty" + | Check failed on the condition: name should be defined and not empty + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_5/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_5/stderr.golden.py deleted file mode 100644 index f93873685..000000000 --- a/test/grammar/schema/check_block/check_block_fail_5/stderr.golden.py +++ /dev/null @@ -1,24 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="name should be defined and not empty") - , file=sys.stdout -) diff --git a/test/grammar/schema/check_block/check_block_fail_6/stderr.golden b/test/grammar/schema/check_block/check_block_fail_6/stderr.golden new file mode 100644 index 000000000..945357cc1 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_6/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:11 + | +9 | JohnDoe = Person { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | labels, "labels should be defined and not empty" + | Check failed on the condition: labels should be defined and not empty + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_6/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_6/stderr.golden.py deleted file mode 100644 index bd9a20b70..000000000 --- a/test/grammar/schema/check_block/check_block_fail_6/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="labels should be defined and not empty") - , file=sys.stdout -) diff --git a/test/grammar/schema/check_block/check_block_fail_7/stderr.golden b/test/grammar/schema/check_block/check_block_fail_7/stderr.golden new file mode 100644 index 000000000..945357cc1 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_7/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:11 + | +9 | JohnDoe = Person { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | labels, "labels should be defined and not empty" + | Check failed on the condition: labels should be defined and not empty + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_7/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_7/stderr.golden.py deleted file mode 100644 index bd9a20b70..000000000 --- a/test/grammar/schema/check_block/check_block_fail_7/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="labels should be defined and not empty") - , file=sys.stdout -) diff --git a/test/grammar/schema/check_block/check_block_fail_8/stderr.golden b/test/grammar/schema/check_block/check_block_fail_8/stderr.golden new file mode 100644 index 000000000..945357cc1 --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_8/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:11 + | +9 | JohnDoe = Person { + | ^ Instance check failed + | + --> ${CWD}/main.k:7:1 + | +7 | labels, "labels should be defined and not empty" + | Check failed on the condition: labels should be defined and not empty + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_8/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_8/stderr.golden.py deleted file mode 100644 index bd9a20b70..000000000 --- a/test/grammar/schema/check_block/check_block_fail_8/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="labels should be defined and not empty") - , file=sys.stdout -) diff --git a/test/grammar/schema/check_block/check_block_fail_9/stderr.golden b/test/grammar/schema/check_block/check_block_fail_9/stderr.golden new file mode 100644 index 000000000..9ca6f0f2c --- /dev/null +++ b/test/grammar/schema/check_block/check_block_fail_9/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:13 + | +10 | "name": Name {} + | ^ Instance check failed + | + --> ${CWD}/main.k:4:1 + | +4 | firstName, "firstName should be defined and not empty" + | Check failed on the condition: firstName should be defined and not empty + | \ No newline at end of file diff --git a/test/grammar/schema/check_block/check_block_fail_9/stderr.golden.py b/test/grammar/schema/check_block/check_block_fail_9/stderr.golden.py deleted file mode 100644 index 64402d7a5..000000000 --- a/test/grammar/schema/check_block/check_block_fail_9/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=13, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ], - arg_msg="firstName should be defined and not empty") - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/illegal_arg_fail_0/stderr.golden b/test/grammar/schema/deprecated/illegal_arg_fail_0/stderr.golden new file mode 100644 index 000000000..2af97fe72 --- /dev/null +++ b/test/grammar/schema/deprecated/illegal_arg_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:3:31 + | +3 | @deprecated(strict=False, "1.16") + | ^ positional argument follows keyword argument + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/illegal_arg_fail_0/stderr.golden.py b/test/grammar/schema/deprecated/illegal_arg_fail_0/stderr.golden.py deleted file mode 100644 index 701db9bc1..000000000 --- a/test/grammar/schema/deprecated/illegal_arg_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=31, - end_col_no=37 - ) - ], - arg_msg="positional argument follows keyword argument"), - file=sys.stdout -) diff --git a/test/grammar/schema/deprecated/member_simple_0/stderr.golden b/test/grammar/schema/deprecated/member_simple_0/stderr.golden new file mode 100644 index 000000000..1e98b0933 --- /dev/null +++ b/test/grammar/schema/deprecated/member_simple_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | name was deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_simple_0/stderr.golden.py b/test/grammar/schema/deprecated/member_simple_0/stderr.golden.py deleted file mode 100644 index b42f84d01..000000000 --- a/test/grammar/schema/deprecated/member_simple_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name","")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_simple_1/stderr.golden b/test/grammar/schema/deprecated/member_simple_1/stderr.golden new file mode 100644 index 000000000..965618a7a --- /dev/null +++ b/test/grammar/schema/deprecated/member_simple_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:8:1 + | +8 | JohnDoe = Person { + | name was deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_simple_1/stderr.golden.py b/test/grammar/schema/deprecated/member_simple_1/stderr.golden.py deleted file mode 100644 index 670370979..000000000 --- a/test/grammar/schema/deprecated/member_simple_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_simple_3/stderr.golden b/test/grammar/schema/deprecated/member_simple_3/stderr.golden new file mode 100644 index 000000000..a135f6e78 --- /dev/null +++ b/test/grammar/schema/deprecated/member_simple_3/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | attrs: ObsoleteSchema = ObsoleteSchema {} + | ObsoleteSchema was deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_simple_3/stderr.golden.py b/test/grammar/schema/deprecated/member_simple_3/stderr.golden.py deleted file mode 100644 index 0e44f2624..000000000 --- a/test/grammar/schema/deprecated/member_simple_3/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("ObsoleteSchema", "")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_standard_0/stderr.golden b/test/grammar/schema/deprecated/member_standard_0/stderr.golden new file mode 100644 index 000000000..579160ff2 --- /dev/null +++ b/test/grammar/schema/deprecated/member_standard_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | name was deprecated since version 1.16, use firstName and lastName instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_standard_0/stderr.golden.py b/test/grammar/schema/deprecated/member_standard_0/stderr.golden.py deleted file mode 100644 index a0e057c99..000000000 --- a/test/grammar/schema/deprecated/member_standard_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "since version 1.16, use firstName and lastName instead")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_standard_1/stderr.golden b/test/grammar/schema/deprecated/member_standard_1/stderr.golden new file mode 100644 index 000000000..579160ff2 --- /dev/null +++ b/test/grammar/schema/deprecated/member_standard_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | name was deprecated since version 1.16, use firstName and lastName instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_standard_1/stderr.golden.py b/test/grammar/schema/deprecated/member_standard_1/stderr.golden.py deleted file mode 100644 index a0e057c99..000000000 --- a/test/grammar/schema/deprecated/member_standard_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "since version 1.16, use firstName and lastName instead")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_standard_2/stderr.golden b/test/grammar/schema/deprecated/member_standard_2/stderr.golden new file mode 100644 index 000000000..579160ff2 --- /dev/null +++ b/test/grammar/schema/deprecated/member_standard_2/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | name was deprecated since version 1.16, use firstName and lastName instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_standard_2/stderr.golden.py b/test/grammar/schema/deprecated/member_standard_2/stderr.golden.py deleted file mode 100644 index a0e057c99..000000000 --- a/test/grammar/schema/deprecated/member_standard_2/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "since version 1.16, use firstName and lastName instead")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_standard_3/stderr.golden b/test/grammar/schema/deprecated/member_standard_3/stderr.golden new file mode 100644 index 000000000..5df74dd16 --- /dev/null +++ b/test/grammar/schema/deprecated/member_standard_3/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:1 + | +9 | JohnDoe = Person { + | name was deprecated since version 1.16, use firstName and lastName instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_standard_3/stderr.golden.py b/test/grammar/schema/deprecated/member_standard_3/stderr.golden.py deleted file mode 100644 index c5f919d4a..000000000 --- a/test/grammar/schema/deprecated/member_standard_3/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "since version 1.16, use firstName and lastName instead")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_standard_4/stderr.golden b/test/grammar/schema/deprecated/member_standard_4/stderr.golden new file mode 100644 index 000000000..4adabed9a --- /dev/null +++ b/test/grammar/schema/deprecated/member_standard_4/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | JohnDoe = Son { + | name was deprecated since version 1.16, use firstName and lastName instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_standard_4/stderr.golden.py b/test/grammar/schema/deprecated/member_standard_4/stderr.golden.py deleted file mode 100644 index d1112365b..000000000 --- a/test/grammar/schema/deprecated/member_standard_4/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "since version 1.16, use firstName and lastName instead")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_warning_0/main.k b/test/grammar/schema/deprecated/member_warning_0/main.k index 914fc1e9d..831a5a043 100644 --- a/test/grammar/schema/deprecated/member_warning_0/main.k +++ b/test/grammar/schema/deprecated/member_warning_0/main.k @@ -1,7 +1,7 @@ schema Person: firstName?: str = "John" lastName?: str - @deprecated(version="1.16", reason="use firstName and lastName instead", strict=False) + @deprecated(version="1.16", reason="use firstName and lastName instead", strict=True) name?: str JohnDoe = Person { diff --git a/test/grammar/schema/deprecated/member_warning_0/stderr.golden b/test/grammar/schema/deprecated/member_warning_0/stderr.golden new file mode 100644 index 000000000..579160ff2 --- /dev/null +++ b/test/grammar/schema/deprecated/member_warning_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | name was deprecated since version 1.16, use firstName and lastName instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_warning_0/stderr.golden.py b/test/grammar/schema/deprecated/member_warning_0/stderr.golden.py deleted file mode 100644 index 4aee93cfa..000000000 --- a/test/grammar/schema/deprecated/member_warning_0/stderr.golden.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_warning_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.Deprecated_Warning_TYPE, - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "since version 1.16, use firstName and lastName instead") - ) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/member_warning_1/main.k b/test/grammar/schema/deprecated/member_warning_1/main.k index bcd3d64b6..035e40e0f 100644 --- a/test/grammar/schema/deprecated/member_warning_1/main.k +++ b/test/grammar/schema/deprecated/member_warning_1/main.k @@ -1,7 +1,7 @@ schema Person: firstName?: str = "John" lastName?: str - @deprecated(strict=False) + @deprecated(strict=True) name?: str JohnDoe = Person { diff --git a/test/grammar/schema/deprecated/member_warning_1/stderr.golden b/test/grammar/schema/deprecated/member_warning_1/stderr.golden new file mode 100644 index 000000000..1e98b0933 --- /dev/null +++ b/test/grammar/schema/deprecated/member_warning_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | name was deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/member_warning_1/stderr.golden.py b/test/grammar/schema/deprecated/member_warning_1/stderr.golden.py deleted file mode 100644 index 6ca2b9b2a..000000000 --- a/test/grammar/schema/deprecated/member_warning_1/stderr.golden.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_warning_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.Deprecated_Warning_TYPE, - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("name", "") - ) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/schema_simple_0/stderr.golden b/test/grammar/schema/deprecated/schema_simple_0/stderr.golden new file mode 100644 index 000000000..d1253826f --- /dev/null +++ b/test/grammar/schema/deprecated/schema_simple_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | Person was deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/schema_simple_0/stderr.golden.py b/test/grammar/schema/deprecated/schema_simple_0/stderr.golden.py deleted file mode 100644 index ac5835190..000000000 --- a/test/grammar/schema/deprecated/schema_simple_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("Person", "")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/schema_simple_1/stderr.golden b/test/grammar/schema/deprecated/schema_simple_1/stderr.golden new file mode 100644 index 000000000..97118031b --- /dev/null +++ b/test/grammar/schema/deprecated/schema_simple_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | JohnDoe = Son {} + | Person was deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/schema_simple_1/stderr.golden.py b/test/grammar/schema/deprecated/schema_simple_1/stderr.golden.py deleted file mode 100644 index 8d8688d3d..000000000 --- a/test/grammar/schema/deprecated/schema_simple_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("Person", "")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/schema_standard_0/stderr.golden b/test/grammar/schema/deprecated/schema_standard_0/stderr.golden new file mode 100644 index 000000000..d36647851 --- /dev/null +++ b/test/grammar/schema/deprecated/schema_standard_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | Person was deprecated since version 1.16, use SuperPerson instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/schema_standard_0/stderr.golden.py b/test/grammar/schema/deprecated/schema_standard_0/stderr.golden.py deleted file mode 100644 index 39bcfffb9..000000000 --- a/test/grammar/schema/deprecated/schema_standard_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("Person", "since version 1.16, use SuperPerson instead")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/schema_standard_1/stderr.golden b/test/grammar/schema/deprecated/schema_standard_1/stderr.golden new file mode 100644 index 000000000..dd7fbf46c --- /dev/null +++ b/test/grammar/schema/deprecated/schema_standard_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | JohnDoe = Son {} + | Person was deprecated since version 1.16, use SuperPerson instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/schema_standard_1/stderr.golden.py b/test/grammar/schema/deprecated/schema_standard_1/stderr.golden.py deleted file mode 100644 index 70b808315..000000000 --- a/test/grammar/schema/deprecated/schema_standard_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.Deprecated_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10 - ), - ], - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("Person", "since version 1.16, use SuperPerson instead")) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/schema_warning_0/main.k b/test/grammar/schema/deprecated/schema_warning_0/main.k index 15f204313..424b1ac31 100644 --- a/test/grammar/schema/deprecated/schema_warning_0/main.k +++ b/test/grammar/schema/deprecated/schema_warning_0/main.k @@ -1,4 +1,4 @@ -@deprecated(strict=False) +@deprecated(strict=True) schema Person: firstName?: str = "John" lastName?: str diff --git a/test/grammar/schema/deprecated/schema_warning_0/stderr.golden b/test/grammar/schema/deprecated/schema_warning_0/stderr.golden new file mode 100644 index 000000000..d1253826f --- /dev/null +++ b/test/grammar/schema/deprecated/schema_warning_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | Person was deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/schema_warning_0/stderr.golden.py b/test/grammar/schema/deprecated/schema_warning_0/stderr.golden.py deleted file mode 100644 index a66cea3b4..000000000 --- a/test/grammar/schema/deprecated/schema_warning_0/stderr.golden.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_warning_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.Deprecated_Warning_TYPE, - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("Person", "") - ) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/schema_warning_1/main.k b/test/grammar/schema/deprecated/schema_warning_1/main.k index b592c29ed..524daf366 100644 --- a/test/grammar/schema/deprecated/schema_warning_1/main.k +++ b/test/grammar/schema/deprecated/schema_warning_1/main.k @@ -1,4 +1,4 @@ -@deprecated(strict=False, version="1.16", reason="use SuperPerson instead") +@deprecated(strict=True, version="1.16", reason="use SuperPerson instead") schema Person: firstName?: str = "John" lastName?: str diff --git a/test/grammar/schema/deprecated/schema_warning_1/stderr.golden b/test/grammar/schema/deprecated/schema_warning_1/stderr.golden new file mode 100644 index 000000000..d36647851 --- /dev/null +++ b/test/grammar/schema/deprecated/schema_warning_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | JohnDoe = Person { + | Person was deprecated since version 1.16, use SuperPerson instead + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/schema_warning_1/stderr.golden.py b/test/grammar/schema/deprecated/schema_warning_1/stderr.golden.py deleted file mode 100644 index c9fc44588..000000000 --- a/test/grammar/schema/deprecated/schema_warning_1/stderr.golden.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_warning_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.Deprecated_Warning_TYPE, - arg_msg=kcl_error.DEPRECATED_WARNING_MSG.format("Person", "since version 1.16, use SuperPerson instead") - ) - , file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/unknown_fail_0/stderr.golden b/test/grammar/schema/deprecated/unknown_fail_0/stderr.golden new file mode 100644 index 000000000..66a975203 --- /dev/null +++ b/test/grammar/schema/deprecated/unknown_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:4:6 + | +4 | @err_deprecated(version="1.16", reason="use firstName and lastName instead", strict=False) + | ^ UnKnown decorator err_deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/unknown_fail_0/stderr.golden.py b/test/grammar/schema/deprecated/unknown_fail_0/stderr.golden.py deleted file mode 100644 index ffe47b71b..000000000 --- a/test/grammar/schema/deprecated/unknown_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.UnKnownDecorator_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=6 - ) - ], - arg_msg=kcl_error.UNKNOWN_DECORATOR_MSG.format("err_deprecated") - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/deprecated/unknown_fail_1/stderr.golden b/test/grammar/schema/deprecated/unknown_fail_1/stderr.golden new file mode 100644 index 000000000..0007275e5 --- /dev/null +++ b/test/grammar/schema/deprecated/unknown_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:1:2 + | +1 | @err_deprecated + | ^ UnKnown decorator err_deprecated + | \ No newline at end of file diff --git a/test/grammar/schema/deprecated/unknown_fail_1/stderr.golden.py b/test/grammar/schema/deprecated/unknown_fail_1/stderr.golden.py deleted file mode 100644 index f6477ad73..000000000 --- a/test/grammar/schema/deprecated/unknown_fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.UnKnownDecorator_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=2 - ) - ], - arg_msg=kcl_error.UNKNOWN_DECORATOR_MSG.format("err_deprecated") - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/if_item/if_item_fail_0/stderr.golden b/test/grammar/schema/if_item/if_item_fail_0/stderr.golden new file mode 100644 index 000000000..df0cba355 --- /dev/null +++ b/test/grammar/schema/if_item/if_item_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:13:35 + | +13 | if data2["key3"] == "value3": "key4": "value4" + | ^ Cannot add member 'key4' to schema 'Data', did you mean '["key1", "key2", "key3"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/if_item/if_item_fail_0/stderr.golden.py b/test/grammar/schema/if_item/if_item_fail_0/stderr.golden.py deleted file mode 100644 index 38ab3417d..000000000 --- a/test/grammar/schema/if_item/if_item_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=13, - col_no=35, - arg_msg="'key4' is not defined in schema 'Data'" - ), - ], - arg_msg="Cannot add member 'key4' to schema 'Data'") - , file=sys.stdout -) - diff --git a/test/grammar/schema/index_signature/fail_0/stderr.golden b/test/grammar/schema/index_signature/fail_0/stderr.golden new file mode 100644 index 000000000..519b2b135 --- /dev/null +++ b/test/grammar/schema/index_signature/fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: IndexSignatureError + --> ${CWD}/main.k:3:5 + | +3 | label: int + | ^ the type 'int' of schema attribute 'label' does not meet the index signature definition [str]: str + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_0/stderr.golden.py b/test/grammar/schema/index_signature/fail_0/stderr.golden.py deleted file mode 100644 index cb9d9e2bb..000000000 --- a/test/grammar/schema/index_signature/fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IndexSignatureError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5 - ) - ], - arg_msg="the type 'int' of schema attribute 'label' does not meet the index signature definition [str]: str" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/index_signature/fail_1/stderr.golden b/test/grammar/schema/index_signature/fail_1/stderr.golden new file mode 100644 index 000000000..5204bfea8 --- /dev/null +++ b/test/grammar/schema/index_signature/fail_1/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:3:5 + | +3 | [str]: int + | ^ duplicate schema index signature definitions, only one is allowed in the schema + | +error[E2G22]: TypeError + --> ${CWD}/main.k:6:5 + | +6 | name: "test" + | ^ expected int, got str(test) + | +variable is defined here, its type is int, but got str(test) \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_1/stderr.golden.py b/test/grammar/schema/index_signature/fail_1/stderr.golden.py deleted file mode 100644 index 30a2a11f9..000000000 --- a/test/grammar/schema/index_signature/fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IndexSignatureError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - end_col_no=15 - ) - ], - arg_msg="only one index signature is allowed in the schema" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/index_signature/fail_10/stderr.golden b/test/grammar/schema/index_signature/fail_10/stderr.golden new file mode 100644 index 000000000..ed6e3939a --- /dev/null +++ b/test/grammar/schema/index_signature/fail_10/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:6:1 + | +6 | [name: str]: WithComponent = WithComponent {name: name} + | attribute 'type' of WithComponent is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_10/stderr.golden.py b/test/grammar/schema/index_signature/fail_10/stderr.golden.py deleted file mode 100644 index 0d5a27eb3..000000000 --- a/test/grammar/schema/index_signature/fail_10/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - ), - ], - arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/index_signature/fail_11/stderr.golden b/test/grammar/schema/index_signature/fail_11/stderr.golden new file mode 100644 index 000000000..e84cabf05 --- /dev/null +++ b/test/grammar/schema/index_signature/fail_11/stderr.golden @@ -0,0 +1 @@ +attribute 'name' of WithComponent is required and can't be None or Undefined \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_11/stderr.golden.py b/test/grammar/schema/index_signature/fail_11/stderr.golden.py deleted file mode 100644 index c861cfcb4..000000000 --- a/test/grammar/schema/index_signature/fail_11/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - ), - ], - arg_msg="attribute 'name' of WithComponent is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/index_signature/fail_2/stderr.golden b/test/grammar/schema/index_signature/fail_2/stderr.golden new file mode 100644 index 000000000..adcbd6cb6 --- /dev/null +++ b/test/grammar/schema/index_signature/fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: IndexSignatureError + --> ${CWD}/main.k:3:5 + | +3 | [name: str]: str + | ^ index signature attribute name 'name' cannot have the same name as schema attributes + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_2/stderr.golden.py b/test/grammar/schema/index_signature/fail_2/stderr.golden.py deleted file mode 100644 index f7ae1afd3..000000000 --- a/test/grammar/schema/index_signature/fail_2/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IndexSignatureError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5 - ) - ], - arg_msg="index signature attribute name 'name' cannot have the same name as schema attributes" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/index_signature/fail_3/stderr.golden b/test/grammar/schema/index_signature/fail_3/stderr.golden new file mode 100644 index 000000000..bb32e668e --- /dev/null +++ b/test/grammar/schema/index_signature/fail_3/stderr.golden @@ -0,0 +1,7 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | name: "test" + | ^ expected int, got str(test) + | +variable is defined here, its type is int, but got str(test) \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_3/stderr.golden.py b/test/grammar/schema/index_signature/fail_3/stderr.golden.py deleted file mode 100644 index 1bcb1104f..000000000 --- a/test/grammar/schema/index_signature/fail_3/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got str(test)" - ) - ], - arg_msg="expect int, got str(test)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/index_signature/fail_4/stderr.golden b/test/grammar/schema/index_signature/fail_4/stderr.golden new file mode 100644 index 000000000..333c2ad4f --- /dev/null +++ b/test/grammar/schema/index_signature/fail_4/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: IndexSignatureError + --> ${CWD}/main.k:2:5 + | +2 | count: int + | ^ the type 'int' of schema attribute 'count' does not meet the index signature definition [str]: str + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_4/stderr.golden.py b/test/grammar/schema/index_signature/fail_4/stderr.golden.py deleted file mode 100644 index 62be229e4..000000000 --- a/test/grammar/schema/index_signature/fail_4/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IndexSignatureError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5 - ) - ], - arg_msg="the type 'int' of schema attribute 'count' does not meet the index signature definition [str]: str" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/index_signature/fail_5/stderr.golden b/test/grammar/schema/index_signature/fail_5/stderr.golden new file mode 100644 index 000000000..30326640c --- /dev/null +++ b/test/grammar/schema/index_signature/fail_5/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:6:8 + | +6 | data = Data { + | ^ Instance check failed + | + --> ${CWD}/main.k:4:1 + | +4 | name in ["Alice", "Bob", "John"] + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_5/stderr.golden.py b/test/grammar/schema/index_signature/fail_5/stderr.golden.py deleted file mode 100644 index 2785c515d..000000000 --- a/test/grammar/schema/index_signature/fail_5/stderr.golden.py +++ /dev/null @@ -1,25 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) - diff --git a/test/grammar/schema/index_signature/fail_6/stderr.golden b/test/grammar/schema/index_signature/fail_6/stderr.golden new file mode 100644 index 000000000..97422f7db --- /dev/null +++ b/test/grammar/schema/index_signature/fail_6/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:8:8 + | +8 | data = Data { + | ^ Instance check failed + | + --> ${CWD}/main.k:6:1 + | +6 | regex.match(attr, r'^[-._a-zA-Z0-9]+$') + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_6/stderr.golden.py b/test/grammar/schema/index_signature/fail_6/stderr.golden.py deleted file mode 100644 index fa5180808..000000000 --- a/test/grammar/schema/index_signature/fail_6/stderr.golden.py +++ /dev/null @@ -1,24 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=8, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) diff --git a/test/grammar/schema/index_signature/fail_7/stderr.golden b/test/grammar/schema/index_signature/fail_7/stderr.golden new file mode 100644 index 000000000..f88cfff5e --- /dev/null +++ b/test/grammar/schema/index_signature/fail_7/stderr.golden @@ -0,0 +1 @@ +attribute 'type' of WithComponent is required and can't be None or Undefined \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_7/stderr.golden.py b/test/grammar/schema/index_signature/fail_7/stderr.golden.py deleted file mode 100644 index 0d5a27eb3..000000000 --- a/test/grammar/schema/index_signature/fail_7/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - ), - ], - arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/index_signature/fail_8/stderr.golden b/test/grammar/schema/index_signature/fail_8/stderr.golden new file mode 100644 index 000000000..a04b6e23d --- /dev/null +++ b/test/grammar/schema/index_signature/fail_8/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:1 + | +9 | ws: WithComponent {} + | attribute 'type' of WithComponent is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_8/stderr.golden.py b/test/grammar/schema/index_signature/fail_8/stderr.golden.py deleted file mode 100644 index 0d5a27eb3..000000000 --- a/test/grammar/schema/index_signature/fail_8/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - ), - ], - arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/index_signature/fail_9/stderr.golden b/test/grammar/schema/index_signature/fail_9/stderr.golden new file mode 100644 index 000000000..ed6e3939a --- /dev/null +++ b/test/grammar/schema/index_signature/fail_9/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:6:1 + | +6 | [name: str]: WithComponent = WithComponent {name: name} + | attribute 'type' of WithComponent is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/index_signature/fail_9/stderr.golden.py b/test/grammar/schema/index_signature/fail_9/stderr.golden.py deleted file mode 100644 index 0d5a27eb3..000000000 --- a/test/grammar/schema/index_signature/fail_9/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - ), - ], - arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_0/stderr.golden b/test/grammar/schema/inherit/cycle_inherit_fail_0/stderr.golden new file mode 100644 index 000000000..0109c00fc --- /dev/null +++ b/test/grammar/schema/inherit/cycle_inherit_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:4:8 + | +4 | schema Son(Parent): + | ^ There is a circular reference between schema Son and Parent + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_0/stderr.golden.py b/test/grammar/schema/inherit/cycle_inherit_fail_0/stderr.golden.py deleted file mode 100644 index a8fce6ca4..000000000 --- a/test/grammar/schema/inherit/cycle_inherit_fail_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CycleInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=1 - ), - ], - arg_msg="Son and Parent") - , file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_1/stderr.golden b/test/grammar/schema/inherit/cycle_inherit_fail_1/stderr.golden new file mode 100644 index 000000000..bc8f7703c --- /dev/null +++ b/test/grammar/schema/inherit/cycle_inherit_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:7:8 + | +7 | schema GrandSon(Parent): + | ^ There is a circular reference between schema GrandSon and Parent + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_1/stderr.golden.py b/test/grammar/schema/inherit/cycle_inherit_fail_1/stderr.golden.py deleted file mode 100644 index 7987bfaf7..000000000 --- a/test/grammar/schema/inherit/cycle_inherit_fail_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CycleInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=1 - ), - ], - arg_msg="GrandSon and Parent") - , file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_2/stderr.golden b/test/grammar/schema/inherit/cycle_inherit_fail_2/stderr.golden new file mode 100644 index 000000000..968962399 --- /dev/null +++ b/test/grammar/schema/inherit/cycle_inherit_fail_2/stderr.golden @@ -0,0 +1,18 @@ +error[E2L23]: CompileError + --> ${CWD}/pkg/c.k:2:8 + | +2 | schema C(B): + | ^ There is a circular reference between schema C and B + | +error[E2L23]: CompileError + --> ${CWD}/main.k:3:8 + | +3 | schema Son(pkg.B): + | ^ There is a circular reference between schema Son and B + | +error[E2L23]: CompileError + --> ${CWD}/main.k:9:5 + | +9 | fields: "asa", + | ^ Cannot add member 'fields' to schema 'Son', did you mean '["field"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_2/stderr.golden.py b/test/grammar/schema/inherit/cycle_inherit_fail_2/stderr.golden.py deleted file mode 100644 index eab09126b..000000000 --- a/test/grammar/schema/inherit/cycle_inherit_fail_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CycleInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg/c.k", - line_no=2, - col_no=1 - ), - ], - arg_msg="C and B") - , file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_3/stderr.golden b/test/grammar/schema/inherit/cycle_inherit_fail_3/stderr.golden new file mode 100644 index 000000000..929c5f54d --- /dev/null +++ b/test/grammar/schema/inherit/cycle_inherit_fail_3/stderr.golden @@ -0,0 +1,18 @@ +error[E2L23]: CompileError + --> ${CWD}/pkg/c.k:1:8 + | +1 | schema C(B): + | ^ There is a circular reference between schema C and B + | +error[E2L23]: CompileError + --> ${CWD}/main.k:3:8 + | +3 | schema Son(pkg.B): + | ^ There is a circular reference between schema Son and B + | +error[E2L23]: CompileError + --> ${CWD}/main.k:9:5 + | +9 | fields: "asa", + | ^ Cannot add member 'fields' to schema 'Son', did you mean '["field"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_3/stderr.golden.py b/test/grammar/schema/inherit/cycle_inherit_fail_3/stderr.golden.py deleted file mode 100644 index adffa131f..000000000 --- a/test/grammar/schema/inherit/cycle_inherit_fail_3/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CycleInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg/c.k", - line_no=1, - col_no=1 - ), - ], - arg_msg="C and B") - , file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_4/stderr.golden b/test/grammar/schema/inherit/cycle_inherit_fail_4/stderr.golden new file mode 100644 index 000000000..929c5f54d --- /dev/null +++ b/test/grammar/schema/inherit/cycle_inherit_fail_4/stderr.golden @@ -0,0 +1,18 @@ +error[E2L23]: CompileError + --> ${CWD}/pkg/c.k:1:8 + | +1 | schema C(B): + | ^ There is a circular reference between schema C and B + | +error[E2L23]: CompileError + --> ${CWD}/main.k:3:8 + | +3 | schema Son(pkg.B): + | ^ There is a circular reference between schema Son and B + | +error[E2L23]: CompileError + --> ${CWD}/main.k:9:5 + | +9 | fields: "asa", + | ^ Cannot add member 'fields' to schema 'Son', did you mean '["field"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/cycle_inherit_fail_4/stderr.golden.py b/test/grammar/schema/inherit/cycle_inherit_fail_4/stderr.golden.py deleted file mode 100644 index adffa131f..000000000 --- a/test/grammar/schema/inherit/cycle_inherit_fail_4/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CycleInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg/c.k", - line_no=1, - col_no=1 - ), - ], - arg_msg="C and B") - , file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/illegal_inheritance_fail_0/stderr.golden b/test/grammar/schema/inherit/illegal_inheritance_fail_0/stderr.golden new file mode 100644 index 000000000..312827458 --- /dev/null +++ b/test/grammar/schema/inherit/illegal_inheritance_fail_0/stderr.golden @@ -0,0 +1,12 @@ +error[E2D34]: IllegalInheritError + --> ${CWD}/main.k:3:12 + | +3 | schema Son(a): + | ^ invalid schema inherit object type, expect schema, got 'int' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | fields: "asa" + | ^ Cannot add member 'fields' to schema 'Son', did you mean '["field"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/illegal_inheritance_fail_0/stderr.golden.py b/test/grammar/schema/inherit/illegal_inheritance_fail_0/stderr.golden.py deleted file mode 100644 index bbac2d6a5..000000000 --- a/test/grammar/schema/inherit/illegal_inheritance_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=1 - ) - ], - arg_msg="illegal schema inherit object type 'int'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/inherit_change_field_type_0/stderr.golden b/test/grammar/schema/inherit/inherit_change_field_type_0/stderr.golden new file mode 100644 index 000000000..20f87b3ca --- /dev/null +++ b/test/grammar/schema/inherit/inherit_change_field_type_0/stderr.golden @@ -0,0 +1,17 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:5 + | +6 | firstName: int + | ^ can't change schema field type of 'firstName' from int to int + | +error[E2G22]: TypeError + --> ${CWD}/main.k:16:5 + | +16 | "firstName": "John", + | ^ expected int, got str(John) + | + --> ${CWD}/main.k:6:5 + | +6 | firstName: int + | ^ variable is defined here, its type is int, but got str(John) + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/inherit_change_field_type_0/stderr.golden.py b/test/grammar/schema/inherit/inherit_change_field_type_0/stderr.golden.py deleted file mode 100644 index 7e3673ca7..000000000 --- a/test/grammar/schema/inherit/inherit_change_field_type_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=5 - ) - ], - arg_msg="can't change schema field type of 'firstName'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/inherit_change_field_type_2/stderr.golden b/test/grammar/schema/inherit/inherit_change_field_type_2/stderr.golden new file mode 100644 index 000000000..526d31700 --- /dev/null +++ b/test/grammar/schema/inherit/inherit_change_field_type_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | name: pkg.Name0 + | ^ can't change schema field type of 'name' from Name0 to Name0 + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/inherit_change_field_type_2/stderr.golden.py b/test/grammar/schema/inherit/inherit_change_field_type_2/stderr.golden.py deleted file mode 100644 index 6db11703e..000000000 --- a/test/grammar/schema/inherit/inherit_change_field_type_2/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5 - ) - ], - arg_msg="can't change schema field type of 'name'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/inherit_change_field_type_3/stderr.golden b/test/grammar/schema/inherit/inherit_change_field_type_3/stderr.golden new file mode 100644 index 000000000..f270419fe --- /dev/null +++ b/test/grammar/schema/inherit/inherit_change_field_type_3/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:4:5 + | +4 | name: pkg.Name0 + | ^ can't change schema field type of 'name' from Name0 to Name0 + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/inherit_change_field_type_3/stderr.golden.py b/test/grammar/schema/inherit/inherit_change_field_type_3/stderr.golden.py deleted file mode 100644 index 5e50f2e73..000000000 --- a/test/grammar/schema/inherit/inherit_change_field_type_3/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=5 - ) - ], - arg_msg="can't change schema field type of 'name'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/inherit_mixin_fail/stderr.golden b/test/grammar/schema/inherit/inherit_mixin_fail/stderr.golden new file mode 100644 index 000000000..94b79ef50 --- /dev/null +++ b/test/grammar/schema/inherit/inherit_mixin_fail/stderr.golden @@ -0,0 +1,18 @@ +error[E2D34]: IllegalInheritError + --> ${CWD}/main.k:8:16 + | +8 | schema Scholar(FullnameMixin): + | ^ invalid schema inherit object type, expect schema, got 'FullnameMixin' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:12:5 + | +12 | "firstName": "Jon", + | ^ Cannot add member 'firstName' to schema 'Scholar' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:13:5 + | +13 | "lastName": "Doe" + | ^ Cannot add member 'lastName' to schema 'Scholar' + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/inherit_mixin_fail/stderr.golden.py b/test/grammar/schema/inherit/inherit_mixin_fail/stderr.golden.py deleted file mode 100644 index 165aec4a6..000000000 --- a/test/grammar/schema/inherit/inherit_mixin_fail/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=1 - ) - ], - arg_msg="mixin inheritance FullnameMixin is prohibited" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/multi_inherit_fail_0/stderr.golden b/test/grammar/schema/inherit/multi_inherit_fail_0/stderr.golden new file mode 100644 index 000000000..e7797695e --- /dev/null +++ b/test/grammar/schema/inherit/multi_inherit_fail_0/stderr.golden @@ -0,0 +1,54 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:22 + | +9 | schema Scholar(Person, Knowledge): + | ^ expected one of [")"] got , + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:24 + | +9 | schema Scholar(Person, Knowledge): + | ^ expected one of [":"] got identifier + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:33 + | +9 | schema Scholar(Person, Knowledge): + | ^ unexpected token ')' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:34 + | +9 | schema Scholar(Person, Knowledge): + | ^ unexpected token ':' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:10:5 + | +10 | school: str + | ^ unexpected token 'indent' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:1 + | +12 | JonSnow = Person { + | expected one of ["="] got dedent + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:1 + | +12 | JonSnow = Person { + | unexpected token 'dedent' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:20:5 + | +20 | "subject": "CS", + | ^ Cannot add member 'subject' to schema 'Scholar' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:21:5 + | +21 | "school": "PKU" + | ^ Cannot add member 'school' to schema 'Scholar' + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/multi_inherit_fail_0/stderr.golden.py b/test/grammar/schema/inherit/multi_inherit_fail_0/stderr.golden.py deleted file mode 100644 index 5c8f2cc43..000000000 --- a/test/grammar/schema/inherit/multi_inherit_fail_0/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.MultiInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=16, - end_col_no=33, - ) - ], - arg_msg=kcl_error.MULTI_INHERIT_MSG.format("Scholar") - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/inherit/multi_inherit_fail_1/stderr.golden b/test/grammar/schema/inherit/multi_inherit_fail_1/stderr.golden new file mode 100644 index 000000000..f0f361c42 --- /dev/null +++ b/test/grammar/schema/inherit/multi_inherit_fail_1/stderr.golden @@ -0,0 +1,72 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:30 + | +9 | schema Scholar(KnowledgeMixin, Person): + | ^ expected one of [")"] got , + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:32 + | +9 | schema Scholar(KnowledgeMixin, Person): + | ^ expected one of [":"] got identifier + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:38 + | +9 | schema Scholar(KnowledgeMixin, Person): + | ^ unexpected token ')' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:9:39 + | +9 | schema Scholar(KnowledgeMixin, Person): + | ^ unexpected token ':' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:10:5 + | +10 | school: str + | ^ unexpected token 'indent' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:1 + | +12 | JonSnow = Person { + | expected one of ["="] got dedent + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:12:1 + | +12 | JonSnow = Person { + | unexpected token 'dedent' + | +error[E2D34]: IllegalInheritError + --> ${CWD}/main.k:9:16 + | +9 | schema Scholar(KnowledgeMixin, Person): + | ^ invalid schema inherit object type, expect schema, got 'KnowledgeMixin' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:18:5 + | +18 | "firstName": "John", + | ^ Cannot add member 'firstName' to schema 'Scholar' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:19:5 + | +19 | "lastName": "Doe", + | ^ Cannot add member 'lastName' to schema 'Scholar' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:20:5 + | +20 | "subject": "CS", + | ^ Cannot add member 'subject' to schema 'Scholar' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:21:5 + | +21 | "school": "PKU" + | ^ Cannot add member 'school' to schema 'Scholar' + | \ No newline at end of file diff --git a/test/grammar/schema/inherit/multi_inherit_fail_1/stderr.golden.py b/test/grammar/schema/inherit/multi_inherit_fail_1/stderr.golden.py deleted file mode 100644 index b00dd4090..000000000 --- a/test/grammar/schema/inherit/multi_inherit_fail_1/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.MultiInheritError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=16, - end_col_no=38 - ) - ], - arg_msg=kcl_error.MULTI_INHERIT_MSG.format("Scholar") - ), - file=sys.stdout -) diff --git a/test/grammar/schema/init/init_add_member_fail_0/stderr.golden b/test/grammar/schema/init/init_add_member_fail_0/stderr.golden new file mode 100644 index 000000000..f4375381d --- /dev/null +++ b/test/grammar/schema/init/init_add_member_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:8:5 + | +8 | fullName = "full name" + | ^ Cannot add member 'fullName' to schema 'Person' + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_add_member_fail_0/stderr.golden.py b/test/grammar/schema/init/init_add_member_fail_0/stderr.golden.py deleted file mode 100644 index a4c8d2879..000000000 --- a/test/grammar/schema/init/init_add_member_fail_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=5, - arg_msg="'fullName' is not defined in schema 'Person'" - ), - ], - arg_msg="Cannot add member 'fullName' to schema 'Person'") - , file=sys.stdout -) - diff --git a/test/grammar/schema/init/init_add_member_fail_1/stderr.golden b/test/grammar/schema/init/init_add_member_fail_1/stderr.golden new file mode 100644 index 000000000..de04fb307 --- /dev/null +++ b/test/grammar/schema/init/init_add_member_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:8:9 + | +8 | "fullName": "full name" + | ^ Cannot add member 'fullName' to schema 'Name' + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_add_member_fail_1/stderr.golden.py b/test/grammar/schema/init/init_add_member_fail_1/stderr.golden.py deleted file mode 100644 index eaf744eb6..000000000 --- a/test/grammar/schema/init/init_add_member_fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=9, - arg_msg="'fullName' is not defined in schema 'Name'" - ), - ], - arg_msg="Cannot add member 'fullName' to schema 'Name'") - , file=sys.stdout -) diff --git a/test/grammar/schema/init/init_add_member_fail_2/stderr.golden b/test/grammar/schema/init/init_add_member_fail_2/stderr.golden new file mode 100644 index 000000000..844ca6341 --- /dev/null +++ b/test/grammar/schema/init/init_add_member_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:15:5 + | +15 | error = "CannotAddMembers" + | ^ Cannot add member 'error' to schema 'Person' + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_add_member_fail_2/stderr.golden.py b/test/grammar/schema/init/init_add_member_fail_2/stderr.golden.py deleted file mode 100644 index 689aab545..000000000 --- a/test/grammar/schema/init/init_add_member_fail_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=15, - col_no=5, - arg_msg="'error' is not defined in schema 'Person'" - ), - ], - arg_msg="Cannot add member 'error' to schema 'Person'") - , file=sys.stdout -) - diff --git a/test/grammar/schema/init/init_cycle_fail_0/stderr.golden b/test/grammar/schema/init/init_cycle_fail_0/stderr.golden new file mode 100644 index 000000000..efc799290 --- /dev/null +++ b/test/grammar/schema/init/init_cycle_fail_0/stderr.golden @@ -0,0 +1 @@ +maximum recursion depth exceeded in __instancecheck__ diff --git a/test/grammar/schema/init/init_cycle_fail_0/stderr.golden.py b/test/grammar/schema/init/init_cycle_fail_0/stderr.golden.py deleted file mode 100644 index 5e3d4ee7e..000000000 --- a/test/grammar/schema/init/init_cycle_fail_0/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.RecursionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - ), - ], - arg_msg="maximum recursion depth exceeded in __instancecheck__") - , file=sys.stdout -) - diff --git a/test/grammar/schema/init/init_cycle_fail_1/stderr.golden b/test/grammar/schema/init/init_cycle_fail_1/stderr.golden new file mode 100644 index 000000000..efc799290 --- /dev/null +++ b/test/grammar/schema/init/init_cycle_fail_1/stderr.golden @@ -0,0 +1 @@ +maximum recursion depth exceeded in __instancecheck__ diff --git a/test/grammar/schema/init/init_cycle_fail_1/stderr.golden.py b/test/grammar/schema/init/init_cycle_fail_1/stderr.golden.py deleted file mode 100644 index 5e3d4ee7e..000000000 --- a/test/grammar/schema/init/init_cycle_fail_1/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.RecursionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - ), - ], - arg_msg="maximum recursion depth exceeded in __instancecheck__") - , file=sys.stdout -) - diff --git a/test/grammar/schema/init/init_cycle_fail_2/stderr.golden b/test/grammar/schema/init/init_cycle_fail_2/stderr.golden new file mode 100644 index 000000000..f8a3ae951 --- /dev/null +++ b/test/grammar/schema/init/init_cycle_fail_2/stderr.golden @@ -0,0 +1 @@ +maximum recursion depth exceeded in comparison diff --git a/test/grammar/schema/init/init_cycle_fail_2/stderr.golden.py b/test/grammar/schema/init/init_cycle_fail_2/stderr.golden.py deleted file mode 100644 index 38dbb6236..000000000 --- a/test/grammar/schema/init/init_cycle_fail_2/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.RecursionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - ), - ], - arg_msg="maximum recursion depth exceeded in comparison") - , file=sys.stdout -) - diff --git a/test/grammar/schema/init/init_dict_fail_0/stderr.golden b/test/grammar/schema/init/init_dict_fail_0/stderr.golden new file mode 100644 index 000000000..a8aa62b0f --- /dev/null +++ b/test/grammar/schema/init/init_dict_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:7:9 + | +7 | "gender": "female" + | ^ Cannot add member 'gender' to schema 'Name' + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_dict_fail_0/stderr.golden.py b/test/grammar/schema/init/init_dict_fail_0/stderr.golden.py deleted file mode 100644 index 1fd1d45ff..000000000 --- a/test/grammar/schema/init/init_dict_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=9, - arg_msg="'gender' is not defined in schema 'Name'" - ), - ], - arg_msg="Cannot add member 'gender' to schema 'Name'") - , file=sys.stdout -) diff --git a/test/grammar/schema/init/init_err_key_fail_0/stderr.golden b/test/grammar/schema/init/init_err_key_fail_0/stderr.golden new file mode 100644 index 000000000..5e14b3201 --- /dev/null +++ b/test/grammar/schema/init/init_err_key_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:13:21 + | +13 | "name": data.name_err_key, + | ^ attribute 'name_err_key' not found in 'Frontend' + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_err_key_fail_0/stderr.golden.py b/test/grammar/schema/init/init_err_key_fail_0/stderr.golden.py deleted file mode 100644 index 47089180b..000000000 --- a/test/grammar/schema/init/init_err_key_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=13, - col_no=21 - ) - ], - arg_msg="schema 'Frontend' attribute 'name_err_key' not found" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/init/init_kwargs_fail_0/stderr.golden b/test/grammar/schema/init/init_kwargs_fail_0/stderr.golden new file mode 100644 index 000000000..3a65323ff --- /dev/null +++ b/test/grammar/schema/init/init_kwargs_fail_0/stderr.golden @@ -0,0 +1,12 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:4:10 + | +4 | person = Person(_naem="Alice") {} + | ^ expected 1 positional argument, found 0 + | +error[E2L23]: CompileError + --> ${CWD}/main.k:4:17 + | +4 | person = Person(_naem="Alice") {} + | ^ "Person" got an unexpected keyword argument '_naem' + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_kwargs_fail_0/stderr.golden.py b/test/grammar/schema/init/init_kwargs_fail_0/stderr.golden.py deleted file mode 100644 index 58755b842..000000000 --- a/test/grammar/schema/init/init_kwargs_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=17 - ) - ], - arg_msg="arguments got an unexpected keyword argument '_naem'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/init/init_kwargs_fail_1/stderr.golden b/test/grammar/schema/init/init_kwargs_fail_1/stderr.golden new file mode 100644 index 000000000..0da6a032f --- /dev/null +++ b/test/grammar/schema/init/init_kwargs_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:5:32 + | +5 | person = Person(_name="Alice", 12) {} + | ^ positional argument follows keyword argument + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_kwargs_fail_1/stderr.golden.py b/test/grammar/schema/init/init_kwargs_fail_1/stderr.golden.py deleted file mode 100644 index 8dc531b3a..000000000 --- a/test/grammar/schema/init/init_kwargs_fail_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=32, - end_col_no=34 - ) - ], - arg_msg="positional argument follows keyword argument"), - file=sys.stdout -) diff --git a/test/grammar/schema/init/init_schema_fail_0/stderr.golden b/test/grammar/schema/init/init_schema_fail_0/stderr.golden new file mode 100644 index 000000000..09339d402 --- /dev/null +++ b/test/grammar/schema/init/init_schema_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:8:5 + | +8 | name: Name = Name0 { + | ^ expected Name, got Name0 + | \ No newline at end of file diff --git a/test/grammar/schema/init/init_schema_fail_0/stderr.golden.py b/test/grammar/schema/init/init_schema_fail_0/stderr.golden.py deleted file mode 100644 index 2e6182da6..000000000 --- a/test/grammar/schema/init/init_schema_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=5, - arg_msg="got Name0" - ) - ], - arg_msg="expect Name, got Name0" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/instances/invalid/invalid_0/stderr.golden b/test/grammar/schema/instances/invalid/invalid_0/stderr.golden new file mode 100644 index 000000000..457ecfc65 --- /dev/null +++ b/test/grammar/schema/instances/invalid/invalid_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:6:9 + | +6 | count = PersonErr.instances() + | ^ name 'PersonErr' is not defined, did you mean '["Person"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/instances/invalid/invalid_0/stderr.golden.py b/test/grammar/schema/instances/invalid/invalid_0/stderr.golden.py deleted file mode 100644 index 35766480c..000000000 --- a/test/grammar/schema/instances/invalid/invalid_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=9 - ) - ], - arg_msg="name 'PersonErr' is not defined" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/instances/invalid/invalid_1/stderr.golden b/test/grammar/schema/instances/invalid/invalid_1/stderr.golden new file mode 100644 index 000000000..8cb223cdd --- /dev/null +++ b/test/grammar/schema/instances/invalid/invalid_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:9 + | +6 | count = Person.err_instances() + | ^ attribute 'err_instances' not found in 'Person', did you mean '["instances"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/instances/invalid/invalid_1/stderr.golden.py b/test/grammar/schema/instances/invalid/invalid_1/stderr.golden.py deleted file mode 100644 index a4d4d336b..000000000 --- a/test/grammar/schema/instances/invalid/invalid_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=9 - ) - ], - arg_msg="schema 'Person' attribute 'err_instances' not found" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/invalid/add_attribute/stderr.golden b/test/grammar/schema/invalid/add_attribute/stderr.golden new file mode 100644 index 000000000..6e0e588b6 --- /dev/null +++ b/test/grammar/schema/invalid/add_attribute/stderr.golden @@ -0,0 +1,18 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:10:5 + | +10 | "first": "alice", + | ^ Cannot add member 'first' to schema 'Girl' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:11:5 + | +11 | "last": " Green", + | ^ Cannot add member 'last' to schema 'Girl' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:12:5 + | +12 | "age": 10 + | ^ Cannot add member 'age' to schema 'Girl' + | \ No newline at end of file diff --git a/test/grammar/schema/invalid/add_attribute/stderr.golden.py b/test/grammar/schema/invalid/add_attribute/stderr.golden.py deleted file mode 100644 index 5dcf7fe3d..000000000 --- a/test/grammar/schema/invalid/add_attribute/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=5, - arg_msg="'first' is not defined in schema 'Girl'" - ) - ], - arg_msg="Cannot add member 'first' to schema 'Girl'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/invalid/change_field/stderr.golden b/test/grammar/schema/invalid/change_field/stderr.golden new file mode 100644 index 000000000..2634d5d9b --- /dev/null +++ b/test/grammar/schema/invalid/change_field/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:9:1 + | +9 | JohnDoe.lastName = "John0" + | ^ Can not change the value of 'JohnDoe', because it was declared immutable + | + --> ${CWD}/main.k:5:1 + | +5 | JohnDoe = Person { + | ^ The variable 'JohnDoe' is declared here + | +note: change the variable name to '_JohnDoe' to make it mutable \ No newline at end of file diff --git a/test/grammar/schema/invalid/change_field/stderr.golden.py b/test/grammar/schema/invalid/change_field/stderr.golden.py deleted file mode 100644 index 59e12ea97..000000000 --- a/test/grammar/schema/invalid/change_field/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=1, - end_col_no=17 - ) - ], - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/invalid/no_schema/stderr.golden b/test/grammar/schema/invalid/no_schema/stderr.golden new file mode 100644 index 000000000..e77a69162 --- /dev/null +++ b/test/grammar/schema/invalid/no_schema/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:1:11 + | +1 | JohnDoe = Person { + | ^ name 'Person' is not defined + | \ No newline at end of file diff --git a/test/grammar/schema/invalid/no_schema/stderr.golden.py b/test/grammar/schema/invalid/no_schema/stderr.golden.py deleted file mode 100644 index 5b2fddce2..000000000 --- a/test/grammar/schema/invalid/no_schema/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=11 - ) - ], - arg_msg="name 'Person' is not defined" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/mixin/add_member_fail/stderr.golden b/test/grammar/schema/mixin/add_member_fail/stderr.golden new file mode 100644 index 000000000..8dbb17612 --- /dev/null +++ b/test/grammar/schema/mixin/add_member_fail/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:16:9 + | +16 | "frist": first + | ^ Cannot add member 'frist' to schema 'Person', did you mean '["first"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/mixin/add_member_fail/stderr.golden.py b/test/grammar/schema/mixin/add_member_fail/stderr.golden.py deleted file mode 100644 index b7a19ac26..000000000 --- a/test/grammar/schema/mixin/add_member_fail/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=16, - col_no=9, - arg_msg="'frist' is not defined in schema 'Person'" - ) - ], - arg_msg="Cannot add member 'frist' to schema 'Person'" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/mixin/invalid_name_failure/stderr.golden b/test/grammar/schema/mixin/invalid_name_failure/stderr.golden new file mode 100644 index 000000000..d6e083637 --- /dev/null +++ b/test/grammar/schema/mixin/invalid_name_failure/stderr.golden @@ -0,0 +1,24 @@ +error[E1001]: NameError + --> ${CWD}/main.k:10:12 + | +10 | mixin [Fullname] + | ^ a valid mixin name should end with 'Mixin', got 'Fullname' + | +error[E2D34]: IllegalInheritError + --> ${CWD}/main.k:10:12 + | +10 | mixin [Fullname] + | ^ illegal schema mixin object type, expected mixin, got 'Fullname' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:7:31 + | +7 | fullName = "{} {}".format(firstName, lastName) + | ^ name 'firstName' is not defined + | +error[E2L23]: CompileError + --> ${CWD}/main.k:7:42 + | +7 | fullName = "{} {}".format(firstName, lastName) + | ^ name 'lastName' is not defined + | \ No newline at end of file diff --git a/test/grammar/schema/mixin/invalid_name_failure/stderr.golden.py b/test/grammar/schema/mixin/invalid_name_failure/stderr.golden.py deleted file mode 100644 index 7a718bc8f..000000000 --- a/test/grammar/schema/mixin/invalid_name_failure/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.MixinNamingError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=12 - ) - ], - arg_msg="a valid mixin name should end with 'Mixin', got 'Fullname'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/optional_attr/fail_0/stderr.golden b/test/grammar/schema/optional_attr/fail_0/stderr.golden new file mode 100644 index 000000000..dc2bcdf2f --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:5:1 + | +5 | person = Person {} + | attribute 'name' of Person is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_0/stderr.golden.py b/test/grammar/schema/optional_attr/fail_0/stderr.golden.py deleted file mode 100644 index 25adb3b6c..000000000 --- a/test/grammar/schema/optional_attr/fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - ), - ], - arg_msg="attribute 'name' of Person is required and can't be None or Undefined") - , file=sys.stdout -) - diff --git a/test/grammar/schema/optional_attr/fail_1/stderr.golden b/test/grammar/schema/optional_attr/fail_1/stderr.golden new file mode 100644 index 000000000..53d14cb7f --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:8:1 + | +8 | person = Person { + | attribute 'info' of Person is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_1/stderr.golden.py b/test/grammar/schema/optional_attr/fail_1/stderr.golden.py deleted file mode 100644 index d8d89cc67..000000000 --- a/test/grammar/schema/optional_attr/fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - ), - ], - arg_msg="attribute 'info' of Person is required and can't be None or Undefined") - , file=sys.stdout -) - diff --git a/test/grammar/schema/optional_attr/fail_10/stderr.golden b/test/grammar/schema/optional_attr/fail_10/stderr.golden new file mode 100644 index 000000000..f7d60d17c --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_10/stderr.golden @@ -0,0 +1 @@ +attribute 'name' of TeamSpec is required and can't be None or Undefined \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_10/stderr.golden.py b/test/grammar/schema/optional_attr/fail_10/stderr.golden.py deleted file mode 100644 index 9d74b98c9..000000000 --- a/test/grammar/schema/optional_attr/fail_10/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=14, - ), - ], - arg_msg="attribute 'name' of TeamSpec is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_11/stderr.golden b/test/grammar/schema/optional_attr/fail_11/stderr.golden new file mode 100644 index 000000000..f7d60d17c --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_11/stderr.golden @@ -0,0 +1 @@ +attribute 'name' of TeamSpec is required and can't be None or Undefined \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_11/stderr.golden.py b/test/grammar/schema/optional_attr/fail_11/stderr.golden.py deleted file mode 100644 index ef235a164..000000000 --- a/test/grammar/schema/optional_attr/fail_11/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=12, - ), - ], - arg_msg="attribute 'name' of TeamSpec is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_12/stderr.golden b/test/grammar/schema/optional_attr/fail_12/stderr.golden new file mode 100644 index 000000000..f7d60d17c --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_12/stderr.golden @@ -0,0 +1 @@ +attribute 'name' of TeamSpec is required and can't be None or Undefined \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_12/stderr.golden.py b/test/grammar/schema/optional_attr/fail_12/stderr.golden.py deleted file mode 100644 index ef235a164..000000000 --- a/test/grammar/schema/optional_attr/fail_12/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=12, - ), - ], - arg_msg="attribute 'name' of TeamSpec is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_13/stderr.golden b/test/grammar/schema/optional_attr/fail_13/stderr.golden new file mode 100644 index 000000000..e2f20875a --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_13/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | ss = [S {b = "b"}] + | attribute 'a' of S is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_13/stderr.golden.py b/test/grammar/schema/optional_attr/fail_13/stderr.golden.py deleted file mode 100644 index 4f08cb3e5..000000000 --- a/test/grammar/schema/optional_attr/fail_13/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="attribute 'a' of S is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_14/stderr.golden b/test/grammar/schema/optional_attr/fail_14/stderr.golden new file mode 100644 index 000000000..e933623d6 --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_14/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | sss.aa: S {b = "2"} + | attribute 'a' of S is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_14/stderr.golden.py b/test/grammar/schema/optional_attr/fail_14/stderr.golden.py deleted file mode 100644 index 4f08cb3e5..000000000 --- a/test/grammar/schema/optional_attr/fail_14/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="attribute 'a' of S is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_15/stderr.golden b/test/grammar/schema/optional_attr/fail_15/stderr.golden new file mode 100644 index 000000000..b9dcb1dea --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_15/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:1 + | +9 | datas: [Data] = [data] + | attribute 'type' of Data is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_15/stderr.golden.py b/test/grammar/schema/optional_attr/fail_15/stderr.golden.py deleted file mode 100644 index e5a110212..000000000 --- a/test/grammar/schema/optional_attr/fail_15/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=9, - ), - ], - arg_msg="attribute 'type' of Data is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_16/stderr.golden b/test/grammar/schema/optional_attr/fail_16/stderr.golden new file mode 100644 index 000000000..ab276a6ee --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_16/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:1 + | +9 | datas: [[Data]] = [[data]] + | attribute 'type' of Data is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_16/stderr.golden.py b/test/grammar/schema/optional_attr/fail_16/stderr.golden.py deleted file mode 100644 index e5a110212..000000000 --- a/test/grammar/schema/optional_attr/fail_16/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=9, - ), - ], - arg_msg="attribute 'type' of Data is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_17/stderr.golden b/test/grammar/schema/optional_attr/fail_17/stderr.golden new file mode 100644 index 000000000..1c512e6cb --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_17/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | data = data + | attribute 'type' of Data is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_17/stderr.golden.py b/test/grammar/schema/optional_attr/fail_17/stderr.golden.py deleted file mode 100644 index 65fa60d4b..000000000 --- a/test/grammar/schema/optional_attr/fail_17/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="attribute 'type' of Data is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_18/stderr.golden b/test/grammar/schema/optional_attr/fail_18/stderr.golden new file mode 100644 index 000000000..ceb035af4 --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_18/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | data.data = data + | attribute 'type' of Data is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_18/stderr.golden.py b/test/grammar/schema/optional_attr/fail_18/stderr.golden.py deleted file mode 100644 index 65fa60d4b..000000000 --- a/test/grammar/schema/optional_attr/fail_18/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="attribute 'type' of Data is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_19/stderr.golden b/test/grammar/schema/optional_attr/fail_19/stderr.golden new file mode 100644 index 000000000..e11b8c82e --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_19/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | data = [data] + | attribute 'type' of Data is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_19/stderr.golden.py b/test/grammar/schema/optional_attr/fail_19/stderr.golden.py deleted file mode 100644 index 65fa60d4b..000000000 --- a/test/grammar/schema/optional_attr/fail_19/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="attribute 'type' of Data is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_2/stderr.golden b/test/grammar/schema/optional_attr/fail_2/stderr.golden new file mode 100644 index 000000000..984319b3a --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | name?: str + | ^ can't change the required schema attribute of 'name' to optional + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_2/stderr.golden.py b/test/grammar/schema/optional_attr/fail_2/stderr.golden.py deleted file mode 100644 index e7a974a57..000000000 --- a/test/grammar/schema/optional_attr/fail_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - ), - ], - arg_msg="can't change the required schema attribute of 'name' to optional") - , file=sys.stdout -) - diff --git a/test/grammar/schema/optional_attr/fail_20/stderr.golden b/test/grammar/schema/optional_attr/fail_20/stderr.golden new file mode 100644 index 000000000..e11b8c82e --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_20/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | data = [data] + | attribute 'type' of Data is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_20/stderr.golden.py b/test/grammar/schema/optional_attr/fail_20/stderr.golden.py deleted file mode 100644 index 65fa60d4b..000000000 --- a/test/grammar/schema/optional_attr/fail_20/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="attribute 'type' of Data is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_21/main.k b/test/grammar/schema/optional_attr/fail_21/_main.k similarity index 100% rename from test/grammar/schema/optional_attr/fail_21/main.k rename to test/grammar/schema/optional_attr/fail_21/_main.k diff --git a/test/grammar/schema/optional_attr/fail_21/stderr.golden b/test/grammar/schema/optional_attr/fail_21/stderr.golden index 0094f4cb2..ff1928d0f 100644 --- a/test/grammar/schema/optional_attr/fail_21/stderr.golden +++ b/test/grammar/schema/optional_attr/fail_21/stderr.golden @@ -1 +1,6 @@ -attribute 'name' of Name is required and can't be None or Undefined \ No newline at end of file +error[E3M38]: EvaluationError + --> ${CWD}/main.k:10:1 + | +10 | n = Name {} + | attribute 'name' of Name is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_3/stderr.golden b/test/grammar/schema/optional_attr/fail_3/stderr.golden new file mode 100644 index 000000000..9d5b729d4 --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_3/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:9:1 + | +9 | version = Version {} + | attribute 'versions' of Version is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_3/stderr.golden.py b/test/grammar/schema/optional_attr/fail_3/stderr.golden.py deleted file mode 100644 index 6b4e7f49b..000000000 --- a/test/grammar/schema/optional_attr/fail_3/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=8, - ), - ], - arg_msg="attribute 'versions' of Version is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_4/stderr.golden b/test/grammar/schema/optional_attr/fail_4/stderr.golden new file mode 100644 index 000000000..058aeac8d --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_4/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:4:1 + | +4 | values: Values = {} + | attribute 'a' of Values is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_4/stderr.golden.py b/test/grammar/schema/optional_attr/fail_4/stderr.golden.py deleted file mode 100644 index 26652db68..000000000 --- a/test/grammar/schema/optional_attr/fail_4/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=4, - ), - ], - arg_msg="attribute 'a' of Version is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_5/stderr.golden b/test/grammar/schema/optional_attr/fail_5/stderr.golden new file mode 100644 index 000000000..13d28a5d9 --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_5/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:4:1 + | +4 | values: Values = Values {a = 1} | {a = Undefined} + | attribute 'a' of Values is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_5/stderr.golden.py b/test/grammar/schema/optional_attr/fail_5/stderr.golden.py deleted file mode 100644 index 26652db68..000000000 --- a/test/grammar/schema/optional_attr/fail_5/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=4, - ), - ], - arg_msg="attribute 'a' of Version is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_6/stderr.golden b/test/grammar/schema/optional_attr/fail_6/stderr.golden new file mode 100644 index 000000000..ff292179d --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_6/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:4:1 + | +4 | values: Values = Values {a = 1} | {a = 2} | {a = None} + | attribute 'a' of Values is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_6/stderr.golden.py b/test/grammar/schema/optional_attr/fail_6/stderr.golden.py deleted file mode 100644 index 26652db68..000000000 --- a/test/grammar/schema/optional_attr/fail_6/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=4, - ), - ], - arg_msg="attribute 'a' of Version is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_7/stderr.golden b/test/grammar/schema/optional_attr/fail_7/stderr.golden new file mode 100644 index 000000000..ef55f2e28 --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_7/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:5:1 + | +5 | values = Values {} + | attribute 'a' of Values is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_7/stderr.golden.py b/test/grammar/schema/optional_attr/fail_7/stderr.golden.py deleted file mode 100644 index 69aef2b11..000000000 --- a/test/grammar/schema/optional_attr/fail_7/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=5, - ), - ], - arg_msg=" attribute 'a' of Values is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_8/stderr.golden b/test/grammar/schema/optional_attr/fail_8/stderr.golden new file mode 100644 index 000000000..fa4f8ad5c --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_8/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:12:9 + | +12 | c = TeamSpec { + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_8/stderr.golden.py b/test/grammar/schema/optional_attr/fail_8/stderr.golden.py deleted file mode 100644 index ef235a164..000000000 --- a/test/grammar/schema/optional_attr/fail_8/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=12, - ), - ], - arg_msg="attribute 'name' of TeamSpec is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/optional_attr/fail_9/stderr.golden b/test/grammar/schema/optional_attr/fail_9/stderr.golden new file mode 100644 index 000000000..d87bedd16 --- /dev/null +++ b/test/grammar/schema/optional_attr/fail_9/stderr.golden @@ -0,0 +1 @@ +attribute 'fullName' of TeamSpec is required and can't be None or Undefined \ No newline at end of file diff --git a/test/grammar/schema/optional_attr/fail_9/stderr.golden.py b/test/grammar/schema/optional_attr/fail_9/stderr.golden.py deleted file mode 100644 index deecdfd40..000000000 --- a/test/grammar/schema/optional_attr/fail_9/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=7, - ), - ], - arg_msg="attribute 'fullName' of TeamSpec is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/partial_eval/partial_eval_fail_0/stderr.golden b/test/grammar/schema/partial_eval/partial_eval_fail_0/stderr.golden new file mode 100644 index 000000000..6c30bcdaf --- /dev/null +++ b/test/grammar/schema/partial_eval/partial_eval_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:11:1 + | +11 | config = Config { + | attribute 'name' of Config is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/partial_eval/partial_eval_fail_0/stderr.golden.py b/test/grammar/schema/partial_eval/partial_eval_fail_0/stderr.golden.py deleted file mode 100644 index 9e6d367de..000000000 --- a/test/grammar/schema/partial_eval/partial_eval_fail_0/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11 - ), - ], - arg_msg="attribute 'name' of Config is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/partial_eval/partial_eval_fail_1/stderr.golden b/test/grammar/schema/partial_eval/partial_eval_fail_1/stderr.golden new file mode 100644 index 000000000..ef4af60ca --- /dev/null +++ b/test/grammar/schema/partial_eval/partial_eval_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | spec: Spec = Spec { + | attribute 'value' of Spec is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/partial_eval/partial_eval_fail_1/stderr.golden.py b/test/grammar/schema/partial_eval/partial_eval_fail_1/stderr.golden.py deleted file mode 100644 index afe28bde9..000000000 --- a/test/grammar/schema/partial_eval/partial_eval_fail_1/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11 - ), - ], - arg_msg="attribute 'value' of Spec is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/partial_eval/partial_eval_fail_2/stderr.golden b/test/grammar/schema/partial_eval/partial_eval_fail_2/stderr.golden new file mode 100644 index 000000000..91ac98670 --- /dev/null +++ b/test/grammar/schema/partial_eval/partial_eval_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | id = 1 + | attribute 'data' of Spec is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/partial_eval/partial_eval_fail_2/stderr.golden.py b/test/grammar/schema/partial_eval/partial_eval_fail_2/stderr.golden.py deleted file mode 100644 index fa021bf59..000000000 --- a/test/grammar/schema/partial_eval/partial_eval_fail_2/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=17 - ), - ], - arg_msg="attribute 'data' of Spec is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/schema/relaxed/fail_0/main.k b/test/grammar/schema/relaxed/fail_0/_main.k similarity index 100% rename from test/grammar/schema/relaxed/fail_0/main.k rename to test/grammar/schema/relaxed/fail_0/_main.k diff --git a/test/grammar/builtins/file/write/stderr.golden b/test/grammar/schema/relaxed/fail_0/stderr.golden similarity index 100% rename from test/grammar/builtins/file/write/stderr.golden rename to test/grammar/schema/relaxed/fail_0/stderr.golden diff --git a/test/grammar/schema/relaxed/fail_0/stderr.golden.py b/test/grammar/schema/relaxed/fail_0/stderr.golden.py deleted file mode 100644 index fd73da2f1..000000000 --- a/test/grammar/schema/relaxed/fail_0/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="No attribute named 'no_such_attr' in the schema 'Res'") - , file=sys.stdout -) diff --git a/test/grammar/schema/relaxed/fail_1/main.k b/test/grammar/schema/relaxed/fail_1/_main.k similarity index 100% rename from test/grammar/schema/relaxed/fail_1/main.k rename to test/grammar/schema/relaxed/fail_1/_main.k diff --git a/test/grammar/builtins/file/append/stdout.golden b/test/grammar/schema/relaxed/fail_1/stderr.golden similarity index 100% rename from test/grammar/builtins/file/append/stdout.golden rename to test/grammar/schema/relaxed/fail_1/stderr.golden diff --git a/test/grammar/schema/relaxed/fail_1/stderr.golden.py b/test/grammar/schema/relaxed/fail_1/stderr.golden.py deleted file mode 100644 index fd73da2f1..000000000 --- a/test/grammar/schema/relaxed/fail_1/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=os.path.join(cwd, "main.k"), - line_no=10, - ), - ], - arg_msg="No attribute named 'no_such_attr' in the schema 'Res'") - , file=sys.stdout -) diff --git a/test/grammar/schema/rule/fail/stderr.golden b/test/grammar/schema/rule/fail/stderr.golden new file mode 100644 index 000000000..105801d35 --- /dev/null +++ b/test/grammar/schema/rule/fail/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:16:1 + | +16 | ServiceCheckRule { + | ^ Instance check failed + | + --> ${CWD}/main.k:9:1 + | +9 | svc.name != "123" + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/schema/rule/fail/stderr.golden.py b/test/grammar/schema/rule/fail/stderr.golden.py deleted file mode 100644 index 44fc8ae71..000000000 --- a/test/grammar/schema/rule/fail/stderr.golden.py +++ /dev/null @@ -1,26 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - arg_msg = "Check failed on the condition" - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=16, - col_no=1, - arg_msg = "Instance check failed" - ), - ], - arg_msg="Check failed on check conditions") - , file=sys.stdout -) - diff --git a/test/grammar/schema/same_name_fail/stderr.golden b/test/grammar/schema/same_name_fail/stderr.golden new file mode 100644 index 000000000..8cf9e02aa --- /dev/null +++ b/test/grammar/schema/same_name_fail/stderr.golden @@ -0,0 +1,23 @@ +error[E2L28]: UniqueKeyError + --> ${CWD}/main.k:5:1 + | +5 | schema Person: + | ^ unique key error name 'Person' + | +error[E2L28]: UniqueKeyError + --> ${CWD}/main.k:5:8 + | +5 | schema Person: + | ^ Unique key error name 'Person' + | + --> ${CWD}/main.k:1:8 + | +1 | schema Person: + | ^ The variable 'Person' is declared here + | +error[E2L23]: CompileError + --> ${CWD}/main.k:9:13 + | +9 | x1 = Person{age:101} + | ^ Cannot add member 'age' to schema 'Person' + | \ No newline at end of file diff --git a/test/grammar/schema/same_name_fail/stderr.golden.py b/test/grammar/schema/same_name_fail/stderr.golden.py deleted file mode 100644 index ece44c526..000000000 --- a/test/grammar/schema/same_name_fail/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.UniqueKeyError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=1 - ) - ], - arg_msg=kcl_error.UNIQUE_KEY_MSG.format("Person") - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/stmt_block/stmt_block_cycle_fail_0/stderr.golden b/test/grammar/schema/stmt_block/stmt_block_cycle_fail_0/stderr.golden new file mode 100644 index 000000000..f8a3ae951 --- /dev/null +++ b/test/grammar/schema/stmt_block/stmt_block_cycle_fail_0/stderr.golden @@ -0,0 +1 @@ +maximum recursion depth exceeded in comparison diff --git a/test/grammar/schema/stmt_block/stmt_block_cycle_fail_0/stderr.golden.py b/test/grammar/schema/stmt_block/stmt_block_cycle_fail_0/stderr.golden.py deleted file mode 100644 index 5ee369e26..000000000 --- a/test/grammar/schema/stmt_block/stmt_block_cycle_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.RecursionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - ), - ], - arg_msg="maximum recursion depth exceeded in comparison") - , file=sys.stdout -) - diff --git a/test/grammar/schema/stmt_block/stmt_block_cycle_fail_1/stderr.golden b/test/grammar/schema/stmt_block/stmt_block_cycle_fail_1/stderr.golden new file mode 100644 index 000000000..f8a3ae951 --- /dev/null +++ b/test/grammar/schema/stmt_block/stmt_block_cycle_fail_1/stderr.golden @@ -0,0 +1 @@ +maximum recursion depth exceeded in comparison diff --git a/test/grammar/schema/stmt_block/stmt_block_cycle_fail_1/stderr.golden.py b/test/grammar/schema/stmt_block/stmt_block_cycle_fail_1/stderr.golden.py deleted file mode 100644 index a28a83371..000000000 --- a/test/grammar/schema/stmt_block/stmt_block_cycle_fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.RecursionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - ), - ], - arg_msg="maximum recursion depth exceeded in comparison") - , file=sys.stdout -) - diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_0/stderr.golden b/test/grammar/schema/stmt_block/stmt_block_fail_0/stderr.golden new file mode 100644 index 000000000..714b24834 --- /dev/null +++ b/test/grammar/schema/stmt_block/stmt_block_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | name = _name + | ^ expected str, got int + | \ No newline at end of file diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_0/stderr.golden.py b/test/grammar/schema/stmt_block/stmt_block_fail_0/stderr.golden.py deleted file mode 100644 index 92cc27027..000000000 --- a/test/grammar/schema/stmt_block/stmt_block_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got int" - ), - ], - arg_msg='expect str, got int') - , file=sys.stdout -) - diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_1/stderr.golden b/test/grammar/schema/stmt_block/stmt_block_fail_1/stderr.golden new file mode 100644 index 000000000..6d4e80b56 --- /dev/null +++ b/test/grammar/schema/stmt_block/stmt_block_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:6:1 + | +6 | JohnDoe = Person { + | attribute 'name' of Person is required and can't be None or Undefined + | \ No newline at end of file diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_1/stderr.golden.py b/test/grammar/schema/stmt_block/stmt_block_fail_1/stderr.golden.py deleted file mode 100644 index 347394ed5..000000000 --- a/test/grammar/schema/stmt_block/stmt_block_fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - ), - ], - arg_msg="attribute 'name' of Person is required and can't be None or Undefined") - , file=sys.stdout -) - diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_2/stderr.golden b/test/grammar/schema/stmt_block/stmt_block_fail_2/stderr.golden new file mode 100644 index 000000000..f4c08ee31 --- /dev/null +++ b/test/grammar/schema/stmt_block/stmt_block_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | if sonName + "123" == "123": + | unsupported operand type(s) for +: 'NoneType' and 'str' + | \ No newline at end of file diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_2/stderr.golden.py b/test/grammar/schema/stmt_block/stmt_block_fail_2/stderr.golden.py deleted file mode 100644 index 68f167c86..000000000 --- a/test/grammar/schema/stmt_block/stmt_block_fail_2/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg='unsupported operand type(s) for +: \'NoneType\' and \'str\'') - , file=sys.stdout -) diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_3/stderr.golden b/test/grammar/schema/stmt_block/stmt_block_fail_3/stderr.golden new file mode 100644 index 000000000..7cb916b40 --- /dev/null +++ b/test/grammar/schema/stmt_block/stmt_block_fail_3/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | assert False, "assert in schema" + | assert in schema + | \ No newline at end of file diff --git a/test/grammar/schema/stmt_block/stmt_block_fail_3/stderr.golden.py b/test/grammar/schema/stmt_block/stmt_block_fail_3/stderr.golden.py deleted file mode 100644 index c9202e8f0..000000000 --- a/test/grammar/schema/stmt_block/stmt_block_fail_3/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.AssertionError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - ), - ], - arg_msg='assert in schema') - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/combination_5_type_fail/stderr.golden b/test/grammar/schema/type/combination_5_type_fail/stderr.golden new file mode 100644 index 000000000..e711352ab --- /dev/null +++ b/test/grammar/schema/type/combination_5_type_fail/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:26:17 + | +26 | "firstName": "Alice", + | ^ expected int, got str(Alice) + | + --> ${CWD}/main.k:2:5 + | +2 | firstName: int + | ^ variable is defined here, its type is int, but got str(Alice) + | \ No newline at end of file diff --git a/test/grammar/schema/type/combination_5_type_fail/stderr.golden.py b/test/grammar/schema/type/combination_5_type_fail/stderr.golden.py deleted file mode 100644 index 83eb88b56..000000000 --- a/test/grammar/schema/type/combination_5_type_fail/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=26, - col_no=17, - arg_msg="got str(Alice)" - ) - ], - arg_msg="expect int, got str(Alice)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/config_expr_index_signature_fail/stderr.golden b/test/grammar/schema/type/config_expr_index_signature_fail/stderr.golden new file mode 100644 index 000000000..2f845e457 --- /dev/null +++ b/test/grammar/schema/type/config_expr_index_signature_fail/stderr.golden @@ -0,0 +1,28 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:10:9 + | +10 | "classID" = "aa" + | ^ expected int, got str(aa) + | + --> ${CWD}/main.k:6:5 + | +6 | name: Name + | ^ variable is defined here, its type is int, but got str(aa) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:9:5 + | +9 | name: { + | ^ expected schema index signature value type int, got str(aa) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:9:5 + | +9 | name: { + | ^ expected Name, got {str(classID):str(aa)} + | + --> ${CWD}/main.k:6:5 + | +6 | name: Name + | ^ variable is defined here, its type is Name, but got {str(classID):str(aa)} + | \ No newline at end of file diff --git a/test/grammar/schema/type/config_expr_index_signature_fail/stderr.golden.py b/test/grammar/schema/type/config_expr_index_signature_fail/stderr.golden.py deleted file mode 100644 index e27b6925a..000000000 --- a/test/grammar/schema/type/config_expr_index_signature_fail/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=9, - arg_msg="got str(aa)" - ) - ], - arg_msg="expect int, got str(aa)" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/type/config_expr_type_fail_0/stderr.golden b/test/grammar/schema/type/config_expr_type_fail_0/stderr.golden new file mode 100644 index 000000000..cd558378d --- /dev/null +++ b/test/grammar/schema/type/config_expr_type_fail_0/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:42:44 + | +42 | elif False: ID = "123" + | ^ expected int, got str(123) + | + --> ${CWD}/main.k:4:5 + | +4 | ID: int = 1 + | ^ variable is defined here, its type is int, but got str(123) + | \ No newline at end of file diff --git a/test/grammar/schema/type/config_expr_type_fail_0/stderr.golden.py b/test/grammar/schema/type/config_expr_type_fail_0/stderr.golden.py deleted file mode 100644 index 29d577e3b..000000000 --- a/test/grammar/schema/type/config_expr_type_fail_0/stderr.golden.py +++ /dev/null @@ -1,28 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=5, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=42, - col_no=44, - arg_msg="got str(123)" - ), - ], - arg_msg="expect int, got str(123)") - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/config_expr_type_fail_1/stderr.golden b/test/grammar/schema/type/config_expr_type_fail_1/stderr.golden new file mode 100644 index 000000000..b31f9c66b --- /dev/null +++ b/test/grammar/schema/type/config_expr_type_fail_1/stderr.golden @@ -0,0 +1,33 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:12:16 + | +12 | name.name0.name = 123 + | ^ expected str, got int(123) + | + --> ${CWD}/main.k:2:5 + | +2 | name: str = "Kiki" + | ^ variable is defined here, its type is str, but got int(123) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:12:10 + | +12 | name.name0.name = 123 + | ^ expected str, got int(123) + | + --> ${CWD}/main.k:2:5 + | +2 | name: str = "Kiki" + | ^ variable is defined here, its type is str, but got int(123) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:12:5 + | +12 | name.name0.name = 123 + | ^ expected str, got int(123) + | + --> ${CWD}/main.k:2:5 + | +2 | name: str = "Kiki" + | ^ variable is defined here, its type is str, but got int(123) + | \ No newline at end of file diff --git a/test/grammar/schema/type/config_expr_type_fail_1/stderr.golden.py b/test/grammar/schema/type/config_expr_type_fail_1/stderr.golden.py deleted file mode 100644 index a43657872..000000000 --- a/test/grammar/schema/type/config_expr_type_fail_1/stderr.golden.py +++ /dev/null @@ -1,31 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=12, - col_no=5, - arg_msg="got int(123)" - ), - ], - arg_msg="expect str, got int(123)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/config_expr_type_fail_2/stderr.golden b/test/grammar/schema/type/config_expr_type_fail_2/stderr.golden new file mode 100644 index 000000000..5fa2c6061 --- /dev/null +++ b/test/grammar/schema/type/config_expr_type_fail_2/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:38:21 + | +38 | "name2": 1 + | ^ expected Name1, got int(1) + | + --> ${CWD}/main.k:13:5 + | +13 | name2: Name1 + | ^ variable is defined here, its type is Name1, but got int(1) + | \ No newline at end of file diff --git a/test/grammar/schema/type/config_expr_type_fail_2/stderr.golden.py b/test/grammar/schema/type/config_expr_type_fail_2/stderr.golden.py deleted file mode 100644 index 4910e263a..000000000 --- a/test/grammar/schema/type/config_expr_type_fail_2/stderr.golden.py +++ /dev/null @@ -1,28 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=13, - col_no=5, - arg_msg="expect Name1", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=38, - col_no=21, - arg_msg="got int(1)" - ), - ], - arg_msg="expect Name1, got int(1)") - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/config_expr_type_fail_3/stderr.golden b/test/grammar/schema/type/config_expr_type_fail_3/stderr.golden new file mode 100644 index 000000000..9ef49d3cb --- /dev/null +++ b/test/grammar/schema/type/config_expr_type_fail_3/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:39:25 + | +39 | age = "123" + | ^ expected int, got str(123) + | + --> ${CWD}/main.k:3:5 + | +3 | age: int = 10 + | ^ variable is defined here, its type is int, but got str(123) + | \ No newline at end of file diff --git a/test/grammar/schema/type/config_expr_type_fail_3/stderr.golden.py b/test/grammar/schema/type/config_expr_type_fail_3/stderr.golden.py deleted file mode 100644 index dd5bf12bb..000000000 --- a/test/grammar/schema/type/config_expr_type_fail_3/stderr.golden.py +++ /dev/null @@ -1,28 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=39, - col_no=25, - arg_msg="got str(123)" - ), - ], - arg_msg="expect int, got str(123)") - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/dict_fail_0/stderr.golden b/test/grammar/schema/type/dict_fail_0/stderr.golden new file mode 100644 index 000000000..0e88531df --- /dev/null +++ b/test/grammar/schema/type/dict_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2A31]: IllegalAttributeError + --> ${CWD}/main.k:5:16 + | +5 | "labels": {None: None} + | ^ A attribute must be string type, got 'NoneType' + | \ No newline at end of file diff --git a/test/grammar/schema/type/dict_fail_0/stderr.golden.py b/test/grammar/schema/type/dict_fail_0/stderr.golden.py deleted file mode 100644 index 19959e21b..000000000 --- a/test/grammar/schema/type/dict_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.IllegalAttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=16 - ) - ], - arg_msg="type 'NoneType'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/dict_nested_fail_0/stderr.golden b/test/grammar/schema/type/dict_nested_fail_0/stderr.golden new file mode 100644 index 000000000..006d30a27 --- /dev/null +++ b/test/grammar/schema/type/dict_nested_fail_0/stderr.golden @@ -0,0 +1,44 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:15:17 + | +15 | "name3":123 + | ^ expected str, got int(123) + | + --> ${CWD}/main.k:3:5 + | +3 | ids: {str:{str:{str:str}}} + | ^ variable is defined here, its type is str, but got int(123) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:14:13 + | +14 | "name2":{ + | ^ expected {str:str}, got {str(name3):int(123)} + | + --> ${CWD}/main.k:3:5 + | +3 | ids: {str:{str:{str:str}}} + | ^ variable is defined here, its type is {str:str}, but got {str(name3):int(123)} + | +error[E2G22]: TypeError + --> ${CWD}/main.k:13:9 + | +13 | "name1":{ + | ^ expected {str:{str:str}}, got {str(name2):{str(name3):int(123)}} + | + --> ${CWD}/main.k:3:5 + | +3 | ids: {str:{str:{str:str}}} + | ^ variable is defined here, its type is {str:{str:str}}, but got {str(name2):{str(name3):int(123)}} + | +error[E2G22]: TypeError + --> ${CWD}/main.k:12:5 + | +12 | ids: { + | ^ expected {str:{str:{str:str}}}, got {str(name1):{str(name2):{str(name3):int(123)}}} + | + --> ${CWD}/main.k:3:5 + | +3 | ids: {str:{str:{str:str}}} + | ^ variable is defined here, its type is {str:{str:{str:str}}}, but got {str(name1):{str(name2):{str(name3):int(123)}}} + | \ No newline at end of file diff --git a/test/grammar/schema/type/dict_nested_fail_0/stderr.golden.py b/test/grammar/schema/type/dict_nested_fail_0/stderr.golden.py deleted file mode 100644 index 626b1d7ff..000000000 --- a/test/grammar/schema/type/dict_nested_fail_0/stderr.golden.py +++ /dev/null @@ -1,27 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=15, - col_no=17, - arg_msg="got int(123)" - ), - ], - arg_msg='expect str, got int(123)') - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/multi_types_1/stderr.golden b/test/grammar/schema/type/multi_types_1/stderr.golden new file mode 100644 index 000000000..a8d11a4c0 --- /dev/null +++ b/test/grammar/schema/type/multi_types_1/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | "port": float(80) + | ^ expected int | str, got float + | + --> ${CWD}/main.k:2:5 + | +2 | port: int | str + | ^ variable is defined here, its type is int | str, but got float + | \ No newline at end of file diff --git a/test/grammar/schema/type/multi_types_1/stderr.golden.py b/test/grammar/schema/type/multi_types_1/stderr.golden.py deleted file mode 100644 index 47a35ac0d..000000000 --- a/test/grammar/schema/type/multi_types_1/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect int|str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got float" - ) - ], - arg_msg="expect int|str, got float" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_dict_fail_0/stderr.golden b/test/grammar/schema/type/type_dict_fail_0/stderr.golden new file mode 100644 index 000000000..6f01791cc --- /dev/null +++ b/test/grammar/schema/type/type_dict_fail_0/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:17:11 + | +17 | "lastName": "Terry" + | ^ expected int, got str(Terry) + | + --> ${CWD}/main.k:3:3 + | +3 | lastName: int + | ^ variable is defined here, its type is int, but got str(Terry) + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_dict_fail_0/stderr.golden.py b/test/grammar/schema/type/type_dict_fail_0/stderr.golden.py deleted file mode 100644 index 33e73efff..000000000 --- a/test/grammar/schema/type/type_dict_fail_0/stderr.golden.py +++ /dev/null @@ -1,27 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=3, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=17, - col_no=11, - arg_msg="got str(Terry)" - ), - ], - arg_msg='expect int, got str(Terry)') - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_0/stderr.golden b/test/grammar/schema/type/type_fail_0/stderr.golden new file mode 100644 index 000000000..579dcf59c --- /dev/null +++ b/test/grammar/schema/type/type_fail_0/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "lastName": "Doe" + | ^ expected int, got str(Doe) + | + --> ${CWD}/main.k:3:5 + | +3 | lastName: int + | ^ variable is defined here, its type is int, but got str(Doe) + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_0/stderr.golden.py b/test/grammar/schema/type/type_fail_0/stderr.golden.py deleted file mode 100644 index 829c37abe..000000000 --- a/test/grammar/schema/type/type_fail_0/stderr.golden.py +++ /dev/null @@ -1,31 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got str(Doe)" - ), - ], - arg_msg="expect int, got str(Doe)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_1/stderr.golden b/test/grammar/schema/type/type_fail_1/stderr.golden new file mode 100644 index 000000000..78d4a2753 --- /dev/null +++ b/test/grammar/schema/type/type_fail_1/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | lastName: 12 + | ^ expected str, got int(12) + | + --> ${CWD}/main.k:3:5 + | +3 | lastName: str + | ^ variable is defined here, its type is str, but got int(12) + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_1/stderr.golden.py b/test/grammar/schema/type/type_fail_1/stderr.golden.py deleted file mode 100644 index e6130025b..000000000 --- a/test/grammar/schema/type/type_fail_1/stderr.golden.py +++ /dev/null @@ -1,31 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got int(12)" - ) - ], - arg_msg="expect str, got int(12)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_10/stderr.golden b/test/grammar/schema/type/type_fail_10/stderr.golden new file mode 100644 index 000000000..379723757 --- /dev/null +++ b/test/grammar/schema/type/type_fail_10/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": [1, "2"] + | ^ expected [int], got [int(1) | str(2)] + | + --> ${CWD}/main.k:3:5 + | +3 | cards: [int] + | ^ variable is defined here, its type is [int], but got [int(1) | str(2)] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_10/stderr.golden.py b/test/grammar/schema/type/type_fail_10/stderr.golden.py deleted file mode 100644 index f139cfbb4..000000000 --- a/test/grammar/schema/type/type_fail_10/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [int]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got [int(1)|str(2)]" - ) - ], - arg_msg="expect [int], got [int(1)|str(2)]" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_11/stderr.golden b/test/grammar/schema/type/type_fail_11/stderr.golden new file mode 100644 index 000000000..5e06be275 --- /dev/null +++ b/test/grammar/schema/type/type_fail_11/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": [1] + | ^ expected [{int:any}], got [int(1)] + | + --> ${CWD}/main.k:3:5 + | +3 | cards: [{int:}] + | ^ variable is defined here, its type is [{int:any}], but got [int(1)] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_11/stderr.golden.py b/test/grammar/schema/type/type_fail_11/stderr.golden.py deleted file mode 100644 index f3114005a..000000000 --- a/test/grammar/schema/type/type_fail_11/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [{int:any}]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got [int(1)]" - ) - ], - arg_msg="expect [{int:any}], got [int(1)]" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_12/stderr.golden b/test/grammar/schema/type/type_fail_12/stderr.golden new file mode 100644 index 000000000..574933c0a --- /dev/null +++ b/test/grammar/schema/type/type_fail_12/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": [{"error": "error"}] + | ^ expected [{int:any}], got [{str(error):str(error)}] + | + --> ${CWD}/main.k:3:5 + | +3 | cards: [{int:}] + | ^ variable is defined here, its type is [{int:any}], but got [{str(error):str(error)}] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_12/stderr.golden.py b/test/grammar/schema/type/type_fail_12/stderr.golden.py deleted file mode 100644 index 22a7de3e9..000000000 --- a/test/grammar/schema/type/type_fail_12/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [{int:any}]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got [{str(error):str(error)}]" - ) - ], - arg_msg="expect [{int:any}], got [{str(error):str(error)}]" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_13/stderr.golden b/test/grammar/schema/type/type_fail_13/stderr.golden new file mode 100644 index 000000000..fc53fd578 --- /dev/null +++ b/test/grammar/schema/type/type_fail_13/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": ["error"] + | ^ expected [{str:any}], got [str(error)] + | + --> ${CWD}/main.k:3:5 + | +3 | cards: [{str:}] + | ^ variable is defined here, its type is [{str:any}], but got [str(error)] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_13/stderr.golden.py b/test/grammar/schema/type/type_fail_13/stderr.golden.py deleted file mode 100644 index fd471eb18..000000000 --- a/test/grammar/schema/type/type_fail_13/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [{str:any}]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got [str(error)]" - ) - ], - arg_msg="expect [{str:any}], got [str(error)]" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_14/stderr.golden b/test/grammar/schema/type/type_fail_14/stderr.golden new file mode 100644 index 000000000..ca12eab17 --- /dev/null +++ b/test/grammar/schema/type/type_fail_14/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": ["error"] + | ^ expected [{str:str}], got [str(error)] + | + --> ${CWD}/main.k:3:5 + | +3 | cards: [{str:str}] + | ^ variable is defined here, its type is [{str:str}], but got [str(error)] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_14/stderr.golden.py b/test/grammar/schema/type/type_fail_14/stderr.golden.py deleted file mode 100644 index 1c418fa4e..000000000 --- a/test/grammar/schema/type/type_fail_14/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [{str:str}]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got [str(error)]" - ) - ], - arg_msg="expect [{str:str}], got [str(error)]" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_15/stderr.golden b/test/grammar/schema/type/type_fail_15/stderr.golden new file mode 100644 index 000000000..7744552ce --- /dev/null +++ b/test/grammar/schema/type/type_fail_15/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": [{"error": "error"}] + | ^ expected [str], got [{str(error):str(error)}] + | + --> ${CWD}/main.k:3:5 + | +3 | cards: [str] + | ^ variable is defined here, its type is [str], but got [{str(error):str(error)}] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_15/stderr.golden.py b/test/grammar/schema/type/type_fail_15/stderr.golden.py deleted file mode 100644 index 8bbfb554b..000000000 --- a/test/grammar/schema/type/type_fail_15/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [str]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got [{str(error):str(error)}]" - ) - ], - arg_msg="expect [str], got [{str(error):str(error)}]" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_16/stderr.golden b/test/grammar/schema/type/type_fail_16/stderr.golden new file mode 100644 index 000000000..cb5b295c6 --- /dev/null +++ b/test/grammar/schema/type/type_fail_16/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": {"error":"error"} + | ^ expected [str], got {str(error):str(error)} + | + --> ${CWD}/main.k:3:5 + | +3 | cards : [str] + | ^ variable is defined here, its type is [str], but got {str(error):str(error)} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_16/stderr.golden.py b/test/grammar/schema/type/type_fail_16/stderr.golden.py deleted file mode 100644 index 5a23dc2d4..000000000 --- a/test/grammar/schema/type/type_fail_16/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [str]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got {str(error):str(error)}" - ) - ], - arg_msg="expect [str], got {str(error):str(error)}" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_17/stderr.golden b/test/grammar/schema/type/type_fail_17/stderr.golden new file mode 100644 index 000000000..6edecc121 --- /dev/null +++ b/test/grammar/schema/type/type_fail_17/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": {"error": "error"} + | ^ expected str, got {str(error):str(error)} + | + --> ${CWD}/main.k:3:5 + | +3 | cards: str + | ^ variable is defined here, its type is str, but got {str(error):str(error)} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_17/stderr.golden.py b/test/grammar/schema/type/type_fail_17/stderr.golden.py deleted file mode 100644 index 89f6b69c9..000000000 --- a/test/grammar/schema/type/type_fail_17/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got {str(error):str(error)}" - ) - ], - arg_msg="expect str, got {str(error):str(error)}" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_18/stderr.golden b/test/grammar/schema/type/type_fail_18/stderr.golden new file mode 100644 index 000000000..f023af23a --- /dev/null +++ b/test/grammar/schema/type/type_fail_18/stderr.golden @@ -0,0 +1,22 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:33:21 + | +33 | "cards": [card {"num":123}] + | ^ expected str, got int(123) + | + --> ${CWD}/main.k:2:5 + | +2 | num: str + | ^ variable is defined here, its type is str, but got int(123) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:33:5 + | +33 | "cards": [card {"num":123}] + | ^ expected [{str:any}], got [card] + | + --> ${CWD}/main.k:18:5 + | +18 | cards: [{str:}] + | ^ variable is defined here, its type is [{str:any}], but got [card] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_18/stderr.golden.py b/test/grammar/schema/type/type_fail_18/stderr.golden.py deleted file mode 100644 index 90c064c0c..000000000 --- a/test/grammar/schema/type/type_fail_18/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=33, - col_no=21, - arg_msg="got int(123)" - ) - ], - arg_msg="expect str, got int(123)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_19/stderr.golden b/test/grammar/schema/type/type_fail_19/stderr.golden new file mode 100644 index 000000000..358e230e8 --- /dev/null +++ b/test/grammar/schema/type/type_fail_19/stderr.golden @@ -0,0 +1,22 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:19:25 + | +19 | "cards": [info.card{"num": 123}] + | ^ expected str, got int(123) + | + --> ${CWD}/pkg/info.k:2:5 + | +2 | num: str + | ^ variable is defined here, its type is str, but got int(123) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:19:5 + | +19 | "cards": [info.card{"num": 123}] + | ^ expected [{str:any}], got [card] + | + --> ${CWD}/main.k:5:5 + | +5 | cards: [{str:}] + | ^ variable is defined here, its type is [{str:any}], but got [card] + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_19/stderr.golden.py b/test/grammar/schema/type/type_fail_19/stderr.golden.py deleted file mode 100644 index 41a00aafc..000000000 --- a/test/grammar/schema/type/type_fail_19/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg/info.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=19, - col_no=25, - arg_msg="got int(123)" - ) - ], - arg_msg="expect str, got int(123)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_2/stderr.golden b/test/grammar/schema/type/type_fail_2/stderr.golden new file mode 100644 index 000000000..7886dee4c --- /dev/null +++ b/test/grammar/schema/type/type_fail_2/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:14:5 + | +14 | "name": Name1 { + | ^ expected Name0, got Name1 + | + --> ${CWD}/main.k:10:5 + | +10 | name: Name0 + | ^ variable is defined here, its type is Name0, but got Name1 + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_2/stderr.golden.py b/test/grammar/schema/type/type_fail_2/stderr.golden.py deleted file mode 100644 index 09dd10936..000000000 --- a/test/grammar/schema/type/type_fail_2/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=5, - indent_count=1, - arg_msg="expect Name0", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=14, - col_no=5, - arg_msg="got Name1" - ) - ], - arg_msg="expect Name0, got Name1" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_20/stderr.golden b/test/grammar/schema/type/type_fail_20/stderr.golden new file mode 100644 index 000000000..8077e6021 --- /dev/null +++ b/test/grammar/schema/type/type_fail_20/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:12 + | +6 | info0: info.inf + | ^ attribute 'inf' not found in 'module 'pkg.info'' + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_20/stderr.golden.py b/test/grammar/schema/type/type_fail_20/stderr.golden.py deleted file mode 100644 index a7776263b..000000000 --- a/test/grammar/schema/type/type_fail_20/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.AttributeError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - ) - ], - arg_msg="module 'pkg.info' has no attribute 'inf'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_21/stderr.golden b/test/grammar/schema/type/type_fail_21/stderr.golden new file mode 100644 index 000000000..8e4c42303 --- /dev/null +++ b/test/grammar/schema/type/type_fail_21/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:25 + | +6 | "firstName": "å¼ å¼ å¼ ", "lastName": "Doe" + | ^ expected int, got str(Doe) + | + --> ${CWD}/main.k:3:5 + | +3 | lastName: int + | ^ variable is defined here, its type is int, but got str(Doe) + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_21/stderr.golden.py b/test/grammar/schema/type/type_fail_21/stderr.golden.py deleted file mode 100644 index c39365003..000000000 --- a/test/grammar/schema/type/type_fail_21/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=25, - arg_msg="got str(Doe)" - ) - ], - arg_msg="expect int, got str(Doe)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_22/stderr.golden b/test/grammar/schema/type/type_fail_22/stderr.golden new file mode 100644 index 000000000..ff109589c --- /dev/null +++ b/test/grammar/schema/type/type_fail_22/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:9:5 + | +9 | "firstName": 2, + | ^ expected str | Name, got int(2) + | + --> ${CWD}/main.k:5:5 + | +5 | firstName: str | Name + | ^ variable is defined here, its type is str | Name, but got int(2) + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_22/stderr.golden.py b/test/grammar/schema/type/type_fail_22/stderr.golden.py deleted file mode 100644 index 9ee902514..000000000 --- a/test/grammar/schema/type/type_fail_22/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - indent_count=1, - arg_msg="expect str|Name", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=5, - arg_msg="got int(2)" - ) - ], - arg_msg="expect str|Name, got int(2)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_24/stderr.golden b/test/grammar/schema/type/type_fail_24/stderr.golden new file mode 100644 index 000000000..fa614fe86 --- /dev/null +++ b/test/grammar/schema/type/type_fail_24/stderr.golden @@ -0,0 +1,44 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:13 + | +6 | "image": "image", + | ^ expected Container, got str(image) + | + --> ${CWD}/pkg/person.k:3:5 + | +3 | spec: [Container] + | ^ variable is defined here, its type is Container, but got str(image) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:7:13 + | +7 | "name": "name" + | ^ expected Container, got str(name) + | + --> ${CWD}/pkg/person.k:3:5 + | +3 | spec: [Container] + | ^ variable is defined here, its type is Container, but got str(name) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:5:9 + | +5 | spec: { + | ^ expected [Container], got {str(image) | str(name):str(image) | str(name)} + | + --> ${CWD}/pkg/person.k:3:5 + | +3 | spec: [Container] + | ^ variable is defined here, its type is [Container], but got {str(image) | str(name):str(image) | str(name)} + | +error[E2G22]: TypeError + --> ${CWD}/main.k:4:5 + | +4 | name: { + | ^ expected [Container], got {str(image) | str(name):str(image) | str(name)} + | + --> ${CWD}/pkg/person.k:3:5 + | +3 | spec: [Container] + | ^ variable is defined here, its type is [Container], but got {str(image) | str(name):str(image) | str(name)} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_24/stderr.golden.py b/test/grammar/schema/type/type_fail_24/stderr.golden.py deleted file mode 100644 index 734a41fa4..000000000 --- a/test/grammar/schema/type/type_fail_24/stderr.golden.py +++ /dev/null @@ -1,27 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/pkg/person.k", - line_no=3, - col_no=5, - arg_msg="expect [pkg.Container]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=9, - arg_msg="got {str(image)|str(name):str(image)|str(name)}" - ), - ], - arg_msg="expect [pkg.Container], got {str(image)|str(name):str(image)|str(name)}") - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_25/stderr.golden b/test/grammar/schema/type/type_fail_25/stderr.golden new file mode 100644 index 000000000..e52000ea5 --- /dev/null +++ b/test/grammar/schema/type/type_fail_25/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:5:11 + | +5 | name: ErrOther + | ^ name 'ErrOther' is not defined, did you mean '["Other"]'? + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_25/stderr.golden.py b/test/grammar/schema/type/type_fail_25/stderr.golden.py deleted file mode 100644 index 591bedfb0..000000000 --- a/test/grammar/schema/type/type_fail_25/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - ) - ], - arg_msg="name 'ErrOther' is not defined" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_26/stderr.golden b/test/grammar/schema/type/type_fail_26/stderr.golden new file mode 100644 index 000000000..0ac2719d1 --- /dev/null +++ b/test/grammar/schema/type/type_fail_26/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:4:5 + | +4 | affinity: {str:str} = { + | ^ expected {str:str}, got {str(podAntiAffinity):{str(preferredDuringSchedulingIgnoredDuringExecution):[{str(weight) | str(podAffinityTerm):int(100) | {str(labelSelector) | str(topologyKey):{str(matchExpressions):[{str(key) | str(operator) | str(values):str(cluster.k8s/app-name) | str(In) | [str]}]} | str(kubernetes.io/hostname)}}]}} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_26/stderr.golden.py b/test/grammar/schema/type/type_fail_26/stderr.golden.py deleted file mode 100644 index 8ca6006b8..000000000 --- a/test/grammar/schema/type/type_fail_26/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=5, - arg_msg="got {str(podAntiAffinity):{str(preferredDuringSchedulingIgnoredDuringExecution):[{str(weight)|str(podAffinityTerm):int(100)|{str(labelSelector)|str(topologyKey):str(kubernetes.io/hostname)|{str(matchExpressions):[{str(key)|str(operator)|str(values):str(cluster.k8s/app-name)|str(In)|[str]}]}}}]}}" - ) - ], - arg_msg="expect {str:str}, got {str(podAntiAffinity):{str(preferredDuringSchedulingIgnoredDuringExecution):[{str(weight)|str(podAffinityTerm):int(100)|{str(labelSelector)|str(topologyKey):str(kubernetes.io/hostname)|{str(matchExpressions):[{str(key)|str(operator)|str(values):str(cluster.k8s/app-name)|str(In)|[str]}]}}}]}}" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_27/_main.k b/test/grammar/schema/type/type_fail_27/main.k similarity index 100% rename from test/grammar/schema/type/type_fail_27/_main.k rename to test/grammar/schema/type/type_fail_27/main.k diff --git a/test/grammar/schema/type/type_fail_27/stderr.golden b/test/grammar/schema/type/type_fail_27/stderr.golden new file mode 100644 index 000000000..1538d41fa --- /dev/null +++ b/test/grammar/schema/type/type_fail_27/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:4:1 + | +4 | config?: [str] + | expect [str], got Person + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_27/stderr.golden.py b/test/grammar/schema/type/type_fail_27/stderr.golden.py deleted file mode 100644 index 503a986d5..000000000 --- a/test/grammar/schema/type/type_fail_27/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=5, - ) - ], - arg_msg="expect [str], got Person" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_3/stderr.golden b/test/grammar/schema/type/type_fail_3/stderr.golden new file mode 100644 index 000000000..a2ab26486 --- /dev/null +++ b/test/grammar/schema/type/type_fail_3/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:18:13 + | +18 | "fullName": "Alice Terry" + | ^ Cannot add member 'fullName' to schema 'Name' + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_3/stderr.golden.py b/test/grammar/schema/type/type_fail_3/stderr.golden.py deleted file mode 100644 index 1571ede66..000000000 --- a/test/grammar/schema/type/type_fail_3/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=18, - col_no=13, - arg_msg="'fullName' is not defined in schema 'Name'" - ), - ], - arg_msg="Cannot add member 'fullName' to schema 'Name'") - , file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_4/stderr.golden b/test/grammar/schema/type/type_fail_4/stderr.golden new file mode 100644 index 000000000..a72ea1d5d --- /dev/null +++ b/test/grammar/schema/type/type_fail_4/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:8:5 + | +8 | "fullName": "John Doe" # undefined field + | ^ Cannot add member 'fullName' to schema 'Person' + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_4/stderr.golden.py b/test/grammar/schema/type/type_fail_4/stderr.golden.py deleted file mode 100644 index f0b203020..000000000 --- a/test/grammar/schema/type/type_fail_4/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - col_no=5, - arg_msg="'fullName' is not defined in schema 'Person'" - ) - ], - arg_msg="Cannot add member 'fullName' to schema 'Person'" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/type/type_fail_5/stderr.golden b/test/grammar/schema/type/type_fail_5/stderr.golden new file mode 100644 index 000000000..dce612a99 --- /dev/null +++ b/test/grammar/schema/type/type_fail_5/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:11:9 + | +11 | "firstName": {"key": "Alice"}, + | ^ expected str, got {str(key):str(Alice)} + | + --> ${CWD}/main.k:2:5 + | +2 | firstName: str + | ^ variable is defined here, its type is str, but got {str(key):str(Alice)} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_5/stderr.golden.py b/test/grammar/schema/type/type_fail_5/stderr.golden.py deleted file mode 100644 index 461d3aee1..000000000 --- a/test/grammar/schema/type/type_fail_5/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11, - col_no=9, - arg_msg="got {str(key):str(Alice)}" - ) - ], - arg_msg="expect str, got {str(key):str(Alice)}" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/type/type_fail_6/stderr.golden b/test/grammar/schema/type/type_fail_6/stderr.golden new file mode 100644 index 000000000..20329ba23 --- /dev/null +++ b/test/grammar/schema/type/type_fail_6/stderr.golden @@ -0,0 +1,22 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:15 + | +7 | "cards": {"error": "error"} + | ^ expected int, got str(error) + | + --> ${CWD}/main.k:3:5 + | +3 | cards: {str:int} + | ^ variable is defined here, its type is int, but got str(error) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": {"error": "error"} + | ^ expected {str:int}, got {str(error):str(error)} + | + --> ${CWD}/main.k:3:5 + | +3 | cards: {str:int} + | ^ variable is defined here, its type is {str:int}, but got {str(error):str(error)} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_6/stderr.golden.py b/test/grammar/schema/type/type_fail_6/stderr.golden.py deleted file mode 100644 index 7e8c12318..000000000 --- a/test/grammar/schema/type/type_fail_6/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect int", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=15, - arg_msg="got str(error)" - ) - ], - arg_msg="expect int, got str(error)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_7/stderr.golden b/test/grammar/schema/type/type_fail_7/stderr.golden new file mode 100644 index 000000000..8f0526378 --- /dev/null +++ b/test/grammar/schema/type/type_fail_7/stderr.golden @@ -0,0 +1,17 @@ +error[E2A31]: IllegalAttributeError + --> ${CWD}/main.k:7:15 + | +7 | "cards": {1: 1} + | ^ A attribute must be string type, got 'int(1)' + | +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": {1: 1} + | ^ expected {int:{int:any}}, got {int(1):int(1)} + | + --> ${CWD}/main.k:3:5 + | +3 | cards: {int:{int:}} + | ^ variable is defined here, its type is {int:{int:any}}, but got {int(1):int(1)} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_7/stderr.golden.py b/test/grammar/schema/type/type_fail_7/stderr.golden.py deleted file mode 100644 index a03ed6d1f..000000000 --- a/test/grammar/schema/type/type_fail_7/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect {int:any}", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=15, - arg_msg="got int(1)" - ) - ], - arg_msg="expect {int:any}, got int(1)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type/type_fail_8/stderr.golden b/test/grammar/schema/type/type_fail_8/stderr.golden new file mode 100644 index 000000000..a706f5ab5 --- /dev/null +++ b/test/grammar/schema/type/type_fail_8/stderr.golden @@ -0,0 +1,28 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:18 + | +7 | "cards": {1:{"error":"error"}} + | ^ expected {int:any}, got str(error) + | + --> ${CWD}/main.k:3:5 + | +3 | cards : {int:{int:}} + | ^ variable is defined here, its type is {int:any}, but got str(error) + | +error[E2A31]: IllegalAttributeError + --> ${CWD}/main.k:7:15 + | +7 | "cards": {1:{"error":"error"}} + | ^ A attribute must be string type, got 'int(1)' + | +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": {1:{"error":"error"}} + | ^ expected {int:{int:any}}, got {int(1):{str(error):str(error)}} + | + --> ${CWD}/main.k:3:5 + | +3 | cards : {int:{int:}} + | ^ variable is defined here, its type is {int:{int:any}}, but got {int(1):{str(error):str(error)}} + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_8/stderr.golden.py b/test/grammar/schema/type/type_fail_8/stderr.golden.py deleted file mode 100644 index 2a9e33d00..000000000 --- a/test/grammar/schema/type/type_fail_8/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect {int:any}", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=15, - arg_msg="got {str(error):str(error)}" - ) - ], - arg_msg="expect {int:any}, got {str(error):str(error)}" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/type/type_fail_9/stderr.golden b/test/grammar/schema/type/type_fail_9/stderr.golden new file mode 100644 index 000000000..2c483268b --- /dev/null +++ b/test/grammar/schema/type/type_fail_9/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | "cards": 1 + | ^ expected [int], got int(1) + | + --> ${CWD}/main.k:3:5 + | +3 | cards: [int] + | ^ variable is defined here, its type is [int], but got int(1) + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_9/stderr.golden.py b/test/grammar/schema/type/type_fail_9/stderr.golden.py deleted file mode 100644 index 936db7c2b..000000000 --- a/test/grammar/schema/type/type_fail_9/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect [int]", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got int(1)" - ) - ], - arg_msg="expect [int], got int(1)" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/type/type_fail_default_value_0/stderr.golden b/test/grammar/schema/type/type_fail_default_value_0/stderr.golden new file mode 100644 index 000000000..8fa1bd6ca --- /dev/null +++ b/test/grammar/schema/type/type_fail_default_value_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:5 + | +3 | firstName: int = "John" + | ^ expected int, got str(John) + | \ No newline at end of file diff --git a/test/grammar/schema/type/type_fail_default_value_0/stderr.golden.py b/test/grammar/schema/type/type_fail_default_value_0/stderr.golden.py deleted file mode 100644 index 19121f6fc..000000000 --- a/test/grammar/schema/type/type_fail_default_value_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - arg_msg="got str(John)" - ) - ], - arg_msg="expect int, got str(John)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid/stderr.golden new file mode 100644 index 000000000..fb9f78508 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_0/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_0/stderr.golden new file mode 100644 index 000000000..b93c1aa0c --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_0/stderr.golden @@ -0,0 +1,14 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_0/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_0/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_1/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_1/stderr.golden new file mode 100644 index 000000000..74fcb8227 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_1/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_1/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_1/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_10/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_10/stderr.golden new file mode 100644 index 000000000..90c431891 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_10/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_10/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_10/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_10/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_11/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_11/stderr.golden new file mode 100644 index 000000000..a587fc8bd --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_11/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1,a2=2) + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_11/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_11/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_11/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_12/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_12/stderr.golden new file mode 100644 index 000000000..31bb4907e --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_12/stderr.golden @@ -0,0 +1,20 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1,a2=2) + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_12/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_12/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_12/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_13/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_13/stderr.golden new file mode 100644 index 000000000..74fcb8227 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_13/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_13/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_13/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_13/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_14/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_14/stderr.golden new file mode 100644 index 000000000..c5ea5a514 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_14/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1,a2=2) + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_14/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_14/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_14/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_15/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_15/stderr.golden new file mode 100644 index 000000000..750d3387c --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_15/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1) + | ^ expected 2 positional arguments, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_15/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_15/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_15/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_16/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_16/stderr.golden new file mode 100644 index 000000000..b16ef52f6 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_16/stderr.golden @@ -0,0 +1,20 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1) + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_16/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_16/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_16/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_17/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_17/stderr.golden new file mode 100644 index 000000000..fe66650d0 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_17/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1) + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_17/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_17/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_17/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_18/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_18/stderr.golden new file mode 100644 index 000000000..1f582032e --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_18/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1) + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_18/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_18/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_18/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_19/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_19/stderr.golden new file mode 100644 index 000000000..f1db9a405 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_19/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a2=2) + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_19/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_19/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_19/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_2/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_2/stderr.golden new file mode 100644 index 000000000..90c431891 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_2/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_2/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_2/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_2/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_20/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_20/stderr.golden new file mode 100644 index 000000000..8101790b0 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_20/stderr.golden @@ -0,0 +1,20 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a2=2) + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_20/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_20/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_20/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_21/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_21/stderr.golden new file mode 100644 index 000000000..74fcb8227 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_21/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_21/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_21/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_21/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_22/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_22/stderr.golden new file mode 100644 index 000000000..4917a8498 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_22/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a2=2) + | ^ expected 2 positional arguments, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_22/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_22/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_22/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_23/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_23/stderr.golden new file mode 100644 index 000000000..a7f2d1fcb --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_23/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a3="3") + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_23/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_23/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_23/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_24/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_24/stderr.golden new file mode 100644 index 000000000..b93c1aa0c --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_24/stderr.golden @@ -0,0 +1,14 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_24/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_24/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_24/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_25/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_25/stderr.golden new file mode 100644 index 000000000..31b0b94ff --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_25/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a3="3") + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_25/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_25/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_25/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_26/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_26/stderr.golden new file mode 100644 index 000000000..d1abce386 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_26/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a3="3") + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_26/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_26/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_26/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_27/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_27/stderr.golden new file mode 100644 index 000000000..4a099e2c5 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_27/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A() + | ^ expected 2 positional arguments, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_27/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_27/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_27/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_28/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_28/stderr.golden new file mode 100644 index 000000000..5dcd3d463 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_28/stderr.golden @@ -0,0 +1,20 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A() + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_28/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_28/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_28/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_29/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_29/stderr.golden new file mode 100644 index 000000000..bf0bb05f5 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_29/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A() + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_29/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_29/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_29/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_3/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_3/stderr.golden new file mode 100644 index 000000000..fb9f78508 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_3/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_3/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_3/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_3/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_30/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_30/stderr.golden new file mode 100644 index 000000000..0d73d4b0c --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_30/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A() + | ^ expected 2 positional arguments, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_30/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_30/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_30/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_4/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_4/stderr.golden new file mode 100644 index 000000000..b93c1aa0c --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_4/stderr.golden @@ -0,0 +1,14 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_4/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_4/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_4/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_5/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_5/stderr.golden new file mode 100644 index 000000000..74fcb8227 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_5/stderr.golden @@ -0,0 +1,7 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_5/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_5/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_5/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_6/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_6/stderr.golden new file mode 100644 index 000000000..4aecd975f --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_6/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:19 + | +1 | schema A[a1, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a2=2,a3="3") + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_6/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_6/stderr.golden.py deleted file mode 100644 index e846328c0..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_6/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=14, - end_col_no=22, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_7/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_7/stderr.golden new file mode 100644 index 000000000..de9d0b08f --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_7/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1,a3="3") + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_7/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_7/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_7/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_8/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_8/stderr.golden new file mode 100644 index 000000000..b93c1aa0c --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_8/stderr.golden @@ -0,0 +1,14 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:25 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2 = 200, a3]: + | ^ non-default argument follows default argument + | +note: A default argument \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_8/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_8/stderr.golden.py deleted file mode 100644 index 3685cf7c4..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_8/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=20, - end_col_no=28, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_9/stderr.golden b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_9/stderr.golden new file mode 100644 index 000000000..ee6c8f250 --- /dev/null +++ b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_9/stderr.golden @@ -0,0 +1,13 @@ +error[E1001]: IllegalParameterError + --> ${CWD}/main.k:1:15 + | +1 | schema A[a1 = 100, a2, a3 = "300"]: + | ^ non-default argument follows default argument + | +note: A default argument +error[E2L23]: CompileError + --> ${CWD}/main.k:7:5 + | +7 | a = A(a1=1,a3="3") + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_9/stderr.golden.py b/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_9/stderr.golden.py deleted file mode 100644 index 2716275fd..000000000 --- a/test/grammar/schema/type_annotation/defaults/default_values_not_full_invalid_9/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.IllegalArgumentError_Syntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - end_col_no=18, - arg_msg="A default argument" - )], - arg_msg="non-default argument follows default argument" - ), - file=sys.stdout) diff --git a/test/grammar/schema/type_annotation/type_annotation_inconsistent/stderr.golden b/test/grammar/schema/type_annotation/type_annotation_inconsistent/stderr.golden new file mode 100644 index 000000000..242812d0a --- /dev/null +++ b/test/grammar/schema/type_annotation/type_annotation_inconsistent/stderr.golden @@ -0,0 +1,12 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:4:5 + | +4 | c: str = a3 + | ^ expected str, got int + | +error[E2G22]: TypeError + --> ${CWD}/main.k:7:17 + | +7 | a = A(a1=1,a2=2,a3="3") + | ^ expected int, got str(3) + | \ No newline at end of file diff --git a/test/grammar/schema/type_annotation/type_annotation_inconsistent/stderr.golden.py b/test/grammar/schema/type_annotation/type_annotation_inconsistent/stderr.golden.py deleted file mode 100644 index c1f9947a9..000000000 --- a/test/grammar/schema/type_annotation/type_annotation_inconsistent/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - arg_msg="got int", - filename=cwd + "/main.k", - line_no=4, - col_no=5, - )], - arg_msg="expect str, got int" - ), - file=sys.stdout) diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_0/stderr.golden b/test/grammar/schema/union/binary_union/bin_union_fail_0/stderr.golden new file mode 100644 index 000000000..05d1e423f --- /dev/null +++ b/test/grammar/schema/union/binary_union/bin_union_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:9 + | +3 | temp3 = temp1 | temp2 + | ^ unsupported operand type(s) for |: '[int]' and '{str:str}' + | \ No newline at end of file diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_0/stderr.golden.py b/test/grammar/schema/union/binary_union/bin_union_fail_0/stderr.golden.py deleted file mode 100644 index 41071e1b2..000000000 --- a/test/grammar/schema/union/binary_union/bin_union_fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - ) - ], - arg_msg="unsupported operand type(s) for |: '[int]' and '{str:str}'" - ), - file=sys.stdout -) \ No newline at end of file diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_1/stderr.golden b/test/grammar/schema/union/binary_union/bin_union_fail_1/stderr.golden new file mode 100644 index 000000000..34b40ffe8 --- /dev/null +++ b/test/grammar/schema/union/binary_union/bin_union_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:9 + | +3 | temp3 = temp1 | temp2 + | ^ unsupported operand type(s) for |: '{str:str}' and '[int]' + | \ No newline at end of file diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_1/stderr.golden.py b/test/grammar/schema/union/binary_union/bin_union_fail_1/stderr.golden.py deleted file mode 100644 index d9a8e1386..000000000 --- a/test/grammar/schema/union/binary_union/bin_union_fail_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - ) - ], - arg_msg="unsupported operand type(s) for |: '{str:str}' and '[int]'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_2/stderr.golden b/test/grammar/schema/union/binary_union/bin_union_fail_2/stderr.golden new file mode 100644 index 000000000..fb22774f2 --- /dev/null +++ b/test/grammar/schema/union/binary_union/bin_union_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:10:7 + | +10 | val = {"key": "value"} | person + | ^ unsupported operand type(s) for |: '{str(key):str(value)}' and 'Person' + | \ No newline at end of file diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_2/stderr.golden.py b/test/grammar/schema/union/binary_union/bin_union_fail_2/stderr.golden.py deleted file mode 100644 index f8ea7d50c..000000000 --- a/test/grammar/schema/union/binary_union/bin_union_fail_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - ) - ], - arg_msg="unsupported operand type(s) for |: '{str(key):str(value)}' and 'Person'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_3/stderr.golden b/test/grammar/schema/union/binary_union/bin_union_fail_3/stderr.golden new file mode 100644 index 000000000..36a7f0ff9 --- /dev/null +++ b/test/grammar/schema/union/binary_union/bin_union_fail_3/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:7 + | +5 | val = [1, 2, 3] | Person { + | ^ unsupported operand type(s) for |: '[int(1) | int(2) | int(3)]' and 'Person' + | \ No newline at end of file diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_3/stderr.golden.py b/test/grammar/schema/union/binary_union/bin_union_fail_3/stderr.golden.py deleted file mode 100644 index 5ce4c6a12..000000000 --- a/test/grammar/schema/union/binary_union/bin_union_fail_3/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - ) - ], - arg_msg="unsupported operand type(s) for |: '[int(1)|int(2)|int(3)]' and 'Person'" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_4/stderr.golden b/test/grammar/schema/union/binary_union/bin_union_fail_4/stderr.golden new file mode 100644 index 000000000..ca882f3fb --- /dev/null +++ b/test/grammar/schema/union/binary_union/bin_union_fail_4/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:10:5 + | +10 | err: "123" + | ^ Cannot add member 'err' to schema 'Person' + | \ No newline at end of file diff --git a/test/grammar/schema/union/binary_union/bin_union_fail_4/stderr.golden.py b/test/grammar/schema/union/binary_union/bin_union_fail_4/stderr.golden.py deleted file mode 100644 index 2f09924ce..000000000 --- a/test/grammar/schema/union/binary_union/bin_union_fail_4/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.CannotAddMembers_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10, - col_no=5, - arg_msg="'err' is not defined in schema 'Person'" - ), - ], - arg_msg="Cannot add member 'err' to schema 'Person'") - , file=sys.stdout -) diff --git a/test/grammar/schema/union/fail/fail_0/stderr.golden b/test/grammar/schema/union/fail/fail_0/stderr.golden new file mode 100644 index 000000000..46ab2f860 --- /dev/null +++ b/test/grammar/schema/union/fail/fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:1 + | +2 | _data |= {"key": "value"} + | ^ unsupported operand type(s) for |: '[int]' and '{str(key):str(value)}' + | \ No newline at end of file diff --git a/test/grammar/schema/union/fail/fail_0/stderr.golden.py b/test/grammar/schema/union/fail/fail_0/stderr.golden.py deleted file mode 100644 index 916ba80a6..000000000 --- a/test/grammar/schema/union/fail/fail_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2 - ) - ], - arg_msg="unsupported operand type(s) for |=: '[int]' and '{str(key):str(value)}'" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/union/fail/fail_1/stderr.golden b/test/grammar/schema/union/fail/fail_1/stderr.golden new file mode 100644 index 000000000..8776698df --- /dev/null +++ b/test/grammar/schema/union/fail/fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:1 + | +2 | _data |= "value" + | ^ unsupported operand type(s) for |: '[int]' and 'str(value)' + | \ No newline at end of file diff --git a/test/grammar/schema/union/fail/fail_1/stderr.golden.py b/test/grammar/schema/union/fail/fail_1/stderr.golden.py deleted file mode 100644 index cec5cc65d..000000000 --- a/test/grammar/schema/union/fail/fail_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - ) - ], - arg_msg="unsupported operand type(s) for |=: '[int]' and 'str(value)'" - ), - file=sys.stdout -) diff --git a/test/grammar/schema/union/fail/fail_3/stderr.golden b/test/grammar/schema/union/fail/fail_3/stderr.golden new file mode 100644 index 000000000..f0ad77c11 --- /dev/null +++ b/test/grammar/schema/union/fail/fail_3/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:30 + | +5 | personB: Person = personA | {"name" = 123} + | ^ expected str, got int(123) + | + --> ${CWD}/main.k:2:5 + | +2 | name: str = "Alice" + | ^ variable is defined here, its type is str, but got int(123) + | \ No newline at end of file diff --git a/test/grammar/schema/union/fail/fail_3/stderr.golden.py b/test/grammar/schema/union/fail/fail_3/stderr.golden.py deleted file mode 100644 index be169371d..000000000 --- a/test/grammar/schema/union/fail/fail_3/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=30, - arg_msg="got int(123)" - ) - ], - arg_msg="expect str, got int(123)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/union/fail/fail_4/stderr.golden b/test/grammar/schema/union/fail/fail_4/stderr.golden new file mode 100644 index 000000000..fc8c8a63f --- /dev/null +++ b/test/grammar/schema/union/fail/fail_4/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:24 + | +5 | _personA = _personA | {"name" = 123.0} + | ^ expected str, got float(123) + | + --> ${CWD}/main.k:2:5 + | +2 | name: str = "Alice" + | ^ variable is defined here, its type is str, but got float(123) + | \ No newline at end of file diff --git a/test/grammar/schema/union/fail/fail_4/stderr.golden.py b/test/grammar/schema/union/fail/fail_4/stderr.golden.py deleted file mode 100644 index dd7a55d69..000000000 --- a/test/grammar/schema/union/fail/fail_4/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=24, - arg_msg="got float(123.0)" - ) - ], - arg_msg="expect str, got float(123.0)" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/union/list/variable_fail_0/stderr.golden b/test/grammar/schema/union/list/variable_fail_0/stderr.golden new file mode 100644 index 000000000..012724e0d --- /dev/null +++ b/test/grammar/schema/union/list/variable_fail_0/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:3:1 + | +3 | lists |= ["val", "value2"] + | ^ Immutable variable 'lists' is modified during compiling + | + --> ${CWD}/main.k:1:1 + | +1 | lists = ["va", "d"] + | ^ The variable 'lists' is declared here firstly + | +note: change the variable name to '_lists' to make it mutable \ No newline at end of file diff --git a/test/grammar/schema/union/list/variable_fail_0/stderr.golden.py b/test/grammar/schema/union/list/variable_fail_0/stderr.golden.py deleted file mode 100644 index 674b2e2aa..000000000 --- a/test/grammar/schema/union/list/variable_fail_0/stderr.golden.py +++ /dev/null @@ -1,17 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=1, - ), - ],) - , file=sys.stdout -) diff --git a/test/grammar/schema/union/variable_fail/int/stderr.golden b/test/grammar/schema/union/variable_fail/int/stderr.golden new file mode 100644 index 000000000..22349a031 --- /dev/null +++ b/test/grammar/schema/union/variable_fail/int/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:4:1 + | +4 | a |= 20 + | ^ Immutable variable 'a' is modified during compiling + | + --> ${CWD}/main.k:3:1 + | +3 | a = 5 + | ^ The variable 'a' is declared here firstly + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/schema/union/variable_fail/int/stderr.golden.py b/test/grammar/schema/union/variable_fail/int/stderr.golden.py deleted file mode 100644 index 3eda7e065..000000000 --- a/test/grammar/schema/union/variable_fail/int/stderr.golden.py +++ /dev/null @@ -1,17 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=1 - ), - ]) - , file=sys.stdout -) diff --git a/test/grammar/schema/union/variable_fail/list/stderr.golden b/test/grammar/schema/union/variable_fail/list/stderr.golden new file mode 100644 index 000000000..6518a9982 --- /dev/null +++ b/test/grammar/schema/union/variable_fail/list/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:2:1 + | +2 | lists1 |= [5] + | ^ Immutable variable 'lists1' is modified during compiling + | + --> ${CWD}/main.k:1:1 + | +1 | lists1 = [1,2,3] + | ^ The variable 'lists1' is declared here firstly + | +note: change the variable name to '_lists1' to make it mutable \ No newline at end of file diff --git a/test/grammar/schema/union/variable_fail/list/stderr.golden.py b/test/grammar/schema/union/variable_fail/list/stderr.golden.py deleted file mode 100644 index f861b1242..000000000 --- a/test/grammar/schema/union/variable_fail/list/stderr.golden.py +++ /dev/null @@ -1,17 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1, - ), - ],) - , file=sys.stdout -) diff --git a/test/grammar/schema/var_not_define_fail/var_not_define_fail_0/stderr.golden b/test/grammar/schema/var_not_define_fail/var_not_define_fail_0/stderr.golden new file mode 100644 index 000000000..a7506676f --- /dev/null +++ b/test/grammar/schema/var_not_define_fail/var_not_define_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:11:9 + | +11 | ccc > 2 + | ^ name 'ccc' is not defined + | \ No newline at end of file diff --git a/test/grammar/schema/var_not_define_fail/var_not_define_fail_0/stderr.golden.py b/test/grammar/schema/var_not_define_fail/var_not_define_fail_0/stderr.golden.py deleted file mode 100644 index 8e9707787..000000000 --- a/test/grammar/schema/var_not_define_fail/var_not_define_fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11, - col_no=9 - ) - ], - arg_msg="name 'ccc' is not defined" - ), - file=sys.stdout -) - diff --git a/test/grammar/schema/var_not_define_fail/var_not_define_fail_1/stderr.golden b/test/grammar/schema/var_not_define_fail/var_not_define_fail_1/stderr.golden new file mode 100644 index 000000000..72fa58bc0 --- /dev/null +++ b/test/grammar/schema/var_not_define_fail/var_not_define_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:8:9 + | +8 | regex.match(image, "^[a-zA-Z]+:\d+\.\d+\.\d+$"), "image name should be like 'nginx:1.14.2'" + | ^ name 'regex' is not defined + | \ No newline at end of file diff --git a/test/grammar/schema/var_not_define_fail/var_not_define_fail_1/stderr.golden.py b/test/grammar/schema/var_not_define_fail/var_not_define_fail_1/stderr.golden.py deleted file mode 100644 index aa42b9e85..000000000 --- a/test/grammar/schema/var_not_define_fail/var_not_define_fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -import sys - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11, - col_no=9 - ) - ], - arg_msg="name 'regex' is not defined" - ), - file=sys.stdout -) diff --git a/test/grammar/syntax/general/multiple_assign/case0/stderr.golden b/test/grammar/syntax/general/multiple_assign/case0/stderr.golden new file mode 100644 index 000000000..073dab06e --- /dev/null +++ b/test/grammar/syntax/general/multiple_assign/case0/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:6 + | +1 | a = 1, 2 + | ^ unexpected token ',' + | \ No newline at end of file diff --git a/test/grammar/syntax/general/multiple_assign/case0/stderr.golden.py b/test/grammar/syntax/general/multiple_assign/case0/stderr.golden.py deleted file mode 100644 index 2a94b0170..000000000 --- a/test/grammar/syntax/general/multiple_assign/case0/stderr.golden.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.InvalidSyntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=6, - arg_msg="Expected one of ['newline']" - )], - ), - file=sys.stdout) diff --git a/test/grammar/syntax/general/multiple_assign/case1/stderr.golden b/test/grammar/syntax/general/multiple_assign/case1/stderr.golden new file mode 100644 index 000000000..e12fe8a42 --- /dev/null +++ b/test/grammar/syntax/general/multiple_assign/case1/stderr.golden @@ -0,0 +1,18 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:2 + | +1 | a, b = 1, 2 + | ^ unexpected token ',' + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:9 + | +1 | a, b = 1, 2 + | ^ unexpected token ',' + | +error[E2L23]: CompileError + --> ${CWD}/main.k:1:1 + | +1 | a, b = 1, 2 + | ^ name 'a' is not defined + | \ No newline at end of file diff --git a/test/grammar/syntax/general/multiple_assign/case1/stderr.golden.py b/test/grammar/syntax/general/multiple_assign/case1/stderr.golden.py deleted file mode 100644 index c6623a871..000000000 --- a/test/grammar/syntax/general/multiple_assign/case1/stderr.golden.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.InvalidSyntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=6, - arg_msg="Expected one of [',', 'newline']" - )], - ), - file=sys.stdout) diff --git a/test/grammar/syntax/general/unnamed/case0/stderr.golden b/test/grammar/syntax/general/unnamed/case0/stderr.golden new file mode 100644 index 000000000..44200c46b --- /dev/null +++ b/test/grammar/syntax/general/unnamed/case0/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:1:3 + | +1 | a== + | ^ expected one of ["identifier", "literal", "(", "[", "{"] got newline + | +error[E2L23]: CompileError + --> ${CWD}/main.k:1:1 + | +1 | a== + | ^ name 'a' is not defined + | \ No newline at end of file diff --git a/test/grammar/syntax/general/unnamed/case0/stderr.golden.py b/test/grammar/syntax/general/unnamed/case0/stderr.golden.py deleted file mode 100644 index 1e99db1a1..000000000 --- a/test/grammar/syntax/general/unnamed/case0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.InvalidSyntax_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=4, - arg_msg="Expected one of ['all', 'any', " - "'bin_number', 'dec_number', 'False', " - "'filter', 'float_number', 'hex_number', 'lambda', " - "'{', '[', '(', 'long_string', 'not', 'map', " - "'-', 'name', 'None', '~', 'oct_number', '+" - "', 'string', 'True', 'Undefined']", - )], - ), - file=sys.stdout) diff --git a/test/grammar/syntax/indent/indent_error_0/stderr.golden b/test/grammar/syntax/indent/indent_error_0/stderr.golden new file mode 100644 index 000000000..327bd0a7e --- /dev/null +++ b/test/grammar/syntax/indent/indent_error_0/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:3:4 + | +3 | age: int + | ^ invalid indentation with 3 spaces, try to align indents by adding or removing spaces + | +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:4:3 + | +4 | info: str + | ^ invalid indentation with 2 spaces, try to align indents by adding or removing spaces + | \ No newline at end of file diff --git a/test/grammar/syntax/indent/indent_error_0/stderr.golden.py b/test/grammar/syntax/indent/indent_error_0/stderr.golden.py deleted file mode 100644 index 5a9a8bf1f..000000000 --- a/test/grammar/syntax/indent/indent_error_0/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IndentationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=4, - ) - ], - arg_msg=kcl_error.INDENTATION_ERROR_MSG.format("3")), - file=sys.stdout -) diff --git a/test/grammar/syntax/indent/indent_error_1/stderr.golden b/test/grammar/syntax/indent/indent_error_1/stderr.golden new file mode 100644 index 000000000..ad007b1cd --- /dev/null +++ b/test/grammar/syntax/indent/indent_error_1/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:4:3 + | +4 | c = 3 + | ^ invalid indentation with 2 spaces, try to align indents by adding or removing spaces + | \ No newline at end of file diff --git a/test/grammar/syntax/indent/indent_error_1/stderr.golden.py b/test/grammar/syntax/indent/indent_error_1/stderr.golden.py deleted file mode 100644 index d59809ba1..000000000 --- a/test/grammar/syntax/indent/indent_error_1/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.IndentationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=3, - ) - ], - arg_msg=kcl_error.INDENTATION_ERROR_MSG.format("2")), - file=sys.stdout -) \ No newline at end of file diff --git a/test/grammar/syntax/tab/tab_error_0/stderr.golden b/test/grammar/syntax/tab/tab_error_0/stderr.golden new file mode 100644 index 000000000..f57157101 --- /dev/null +++ b/test/grammar/syntax/tab/tab_error_0/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:3:2 + | +3 | age: int + | ^ inconsistent use of tabs and spaces in indentation + | \ No newline at end of file diff --git a/test/grammar/syntax/tab/tab_error_0/stderr.golden.py b/test/grammar/syntax/tab/tab_error_0/stderr.golden.py deleted file mode 100644 index 69ef274f5..000000000 --- a/test/grammar/syntax/tab/tab_error_0/stderr.golden.py +++ /dev/null @@ -1,17 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.TabError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=2, - ) - ]), - file=sys.stdout -) diff --git a/test/grammar/syntax/tab/tab_error_1/stderr.golden b/test/grammar/syntax/tab/tab_error_1/stderr.golden new file mode 100644 index 000000000..6c717017e --- /dev/null +++ b/test/grammar/syntax/tab/tab_error_1/stderr.golden @@ -0,0 +1,6 @@ +error[E1001]: InvalidSyntax + --> ${CWD}/main.k:4:2 + | +4 | c = 3 + | ^ inconsistent use of tabs and spaces in indentation + | \ No newline at end of file diff --git a/test/grammar/syntax/tab/tab_error_1/stderr.golden.py b/test/grammar/syntax/tab/tab_error_1/stderr.golden.py deleted file mode 100644 index 1c17a5c34..000000000 --- a/test/grammar/syntax/tab/tab_error_1/stderr.golden.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message(kcl_error.get_exception(err_type=kcl_error.ErrType.TabError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=2 - )], - ) - , file=sys.stdout) diff --git a/test/grammar/test_grammar.py b/test/grammar/test_grammar.py deleted file mode 100644 index a6fbec652..000000000 --- a/test/grammar/test_grammar.py +++ /dev/null @@ -1,138 +0,0 @@ -"""This is a scripts to run KCL grammar test cases""" -import pytest -import os -import subprocess -import re -import yaml -import pathlib - -TEST_FILE = "main.k" -STDOUT_GOLDEN = "stdout.golden" -STDERR_GOLDEN = "stderr.golden" -STDOUT_GOLDEN_PY = "stdout.golden.py" -STDERR_GOLDEN_PY = "stderr.golden.py" -SETTINGS_FILE = "settings.yaml" - - -def find_test_dirs(path, category): - result = [] - for root, dirs, files in os.walk(path + category): - for name in files: - if name == "main.k": - result.append(root) - return result - - -def compare_strings(result_strings, golden_strings): - assert result_strings == golden_strings - - -def compare_results(result, golden_result): - """Convert bytestring (result) and list of strings (golden_lines) both to - list of strings with line ending stripped, then compare. - """ - - result_strings = result.decode().split("\n") - golden_strings = golden_result.decode().split("\n") - compare_strings(result_strings, golden_strings) - - -def compare_results_with_lines(result, golden_lines): - """Convert bytestring (result) and list of strings (golden_lines) both to - list of strings with line ending stripped, then compare. - """ - - result_strings = result.decode().split("\n") - golden_strings = [] - for line in golden_lines: - clean_line = re.sub("\n$", "", line) - golden_strings.append(clean_line) - # List generated by split() has an ending empty string, when the '\n' is - # the last character - assert result_strings[-1] == "", "The result string does not end with a NEWLINE" - golden_strings.append("") - compare_strings(result_strings, golden_strings) - - -def generate_golden_file(py_file_name): - if os.path.isfile(py_file_name): - try: - process = subprocess.Popen( - ["kclvm", py_file_name], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - env=dict(os.environ), - ) - stdout, stderr = process.communicate() - assert ( - process.returncode == 0 - ), "Error executing file {}, exit code = {}".format( - py_file_name, process.returncode - ) - except Exception: - raise - return stdout - return None - - -def read_settings_file(settings_file_name): - if os.path.isfile(settings_file_name): - try: - with open(settings_file_name, "r") as stream: - settings = yaml.safe_load(stream) - except Exception: - raise - return settings - return None - - -print("##### K Language Grammar Test Suite #####") -test_dirs = find_test_dirs(str(pathlib.Path(__file__).parent), "") - - -@pytest.mark.parametrize("test_dir", test_dirs) -def test_grammar(test_dir): - print("Testing {}".format(test_dir)) - test_settings = read_settings_file(os.path.join(test_dir, SETTINGS_FILE)) - kcl_command = ["kcl", TEST_FILE] - if test_settings and test_settings["kcl_options"]: - kcl_command.extend(test_settings["kcl_options"].split()) - process = subprocess.Popen( - kcl_command, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - cwd=os.path.abspath(test_dir), - env=dict(os.environ), - ) - stdout, stderr = process.communicate() - print("STDOUT:\n{}".format(stdout.decode())) - print("STDERR:\n{}".format(stderr.decode())) - RETURN_CODE = 0 - KCLVM_OUTPUT = 1 - GOLDEN_FILE = 2 - GOLDEN_FILE_SCRIPT = 3 - settings = { - "stdout": (None, stdout, STDOUT_GOLDEN, STDOUT_GOLDEN_PY), - "stderr": (1, stderr, STDERR_GOLDEN, STDERR_GOLDEN_PY), - } - for _, setting in settings.items(): - # Attempt to generate a golden stdout. - golden_file_result = generate_golden_file( - os.path.join(test_dir, setting[GOLDEN_FILE_SCRIPT]) - ) - if golden_file_result: - compare_results(setting[KCLVM_OUTPUT], golden_file_result) - else: - # Attempt to use existing golden stdout. - try: - with open( - os.path.join(test_dir, setting[GOLDEN_FILE]), "r" - ) as golden_file: - compare_results_with_lines(setting[KCLVM_OUTPUT], golden_file) - if setting[RETURN_CODE] is not None: - assert process.returncode == setting[RETURN_CODE] - except OSError: - # Ignore when a golden file does not exist. - pass - except Exception: - raise diff --git a/test/grammar/types/args/call_expr_err_too_few_args_0/stderr.golden b/test/grammar/types/args/call_expr_err_too_few_args_0/stderr.golden new file mode 100644 index 000000000..5062bfc57 --- /dev/null +++ b/test/grammar/types/args/call_expr_err_too_few_args_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:1:5 + | +1 | a = "".startswith() + | ^ expected 1 positional argument, found 0 + | \ No newline at end of file diff --git a/test/grammar/types/args/call_expr_err_too_few_args_0/stderr.golden.py b/test/grammar/types/args/call_expr_err_too_few_args_0/stderr.golden.py deleted file mode 100644 index 7a4521194..000000000 --- a/test/grammar/types/args/call_expr_err_too_few_args_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=5, - ) - ], - arg_msg='expected 1 argument, found 0' - ), - file=sys.stdout -) diff --git a/test/grammar/types/args/call_expr_err_too_few_args_1/stderr.golden b/test/grammar/types/args/call_expr_err_too_few_args_1/stderr.golden new file mode 100644 index 000000000..49a7bade6 --- /dev/null +++ b/test/grammar/types/args/call_expr_err_too_few_args_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:1:5 + | +1 | a = "".replace("old") + | ^ expected 2 positional arguments, found 1 + | \ No newline at end of file diff --git a/test/grammar/types/args/call_expr_err_too_few_args_1/stderr.golden.py b/test/grammar/types/args/call_expr_err_too_few_args_1/stderr.golden.py deleted file mode 100644 index 7a4521194..000000000 --- a/test/grammar/types/args/call_expr_err_too_few_args_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=5, - ) - ], - arg_msg='expected 1 argument, found 0' - ), - file=sys.stdout -) diff --git a/test/grammar/types/args/lambda_types_err_01/stderr.golden b/test/grammar/types/args/lambda_types_err_01/stderr.golden new file mode 100644 index 000000000..aebc67a12 --- /dev/null +++ b/test/grammar/types/args/lambda_types_err_01/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:18 + | +6 | x1 = typeFunc(1, "Golang") + | ^ expected str(KCL) | str(CUE), got str(Golang) + | \ No newline at end of file diff --git a/test/grammar/types/args/lambda_types_err_01/stderr.golden.py b/test/grammar/types/args/lambda_types_err_01/stderr.golden.py deleted file mode 100644 index 113d483f2..000000000 --- a/test/grammar/types/args/lambda_types_err_01/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=18, - arg_msg="got str(Golang)" - ) - ], - arg_msg="expect str(KCL)|str(CUE), got str(Golang)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/args/lambda_types_err_02/stderr.golden b/test/grammar/types/args/lambda_types_err_02/stderr.golden new file mode 100644 index 000000000..df2d031c3 --- /dev/null +++ b/test/grammar/types/args/lambda_types_err_02/stderr.golden @@ -0,0 +1,12 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:15 + | +6 | x1 = typeFunc("1", "Golang") + | ^ expected int, got str(1) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:6:20 + | +6 | x1 = typeFunc("1", "Golang") + | ^ expected str(KCL) | str(CUE), got str(Golang) + | \ No newline at end of file diff --git a/test/grammar/types/args/lambda_types_err_02/stderr.golden.py b/test/grammar/types/args/lambda_types_err_02/stderr.golden.py deleted file mode 100644 index d90e9898f..000000000 --- a/test/grammar/types/args/lambda_types_err_02/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=15, - arg_msg="got str(1)" - ) - ], - arg_msg="expect int, got str(1)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/args/schema_types_err_01/stderr.golden b/test/grammar/types/args/schema_types_err_01/stderr.golden new file mode 100644 index 000000000..a80dc54c3 --- /dev/null +++ b/test/grammar/types/args/schema_types_err_01/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:22 + | +5 | x1 = CheckArgType(1, "Golang") {} + | ^ expected str(KCL) | str(CUE), got str(Golang) + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_01/stderr.golden.py b/test/grammar/types/args/schema_types_err_01/stderr.golden.py deleted file mode 100644 index 9442f883c..000000000 --- a/test/grammar/types/args/schema_types_err_01/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=22, - arg_msg="got str(Golang)" - ) - ], - arg_msg="expect str(KCL)|str(CUE), got str(Golang)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/args/schema_types_err_02_schema/stderr.golden b/test/grammar/types/args/schema_types_err_02_schema/stderr.golden new file mode 100644 index 000000000..bbdfc41e0 --- /dev/null +++ b/test/grammar/types/args/schema_types_err_02_schema/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:13:19 + | +13 | x1 = CheckArgType(_x) {} + | ^ expected Person, got Person + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_02_schema/stderr.golden.py b/test/grammar/types/args/schema_types_err_02_schema/stderr.golden.py deleted file mode 100644 index 52849e382..000000000 --- a/test/grammar/types/args/schema_types_err_02_schema/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=13, - col_no=19, - arg_msg="got Person" - ) - ], - arg_msg='expect sub.Person, got Person' - ), - file=sys.stdout -) - diff --git a/test/grammar/types/args/schema_types_err_03_list/stderr.golden b/test/grammar/types/args/schema_types_err_03_list/stderr.golden new file mode 100644 index 000000000..19ffb962d --- /dev/null +++ b/test/grammar/types/args/schema_types_err_03_list/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:46 + | +6 | x1 = CheckArgType([123, True], ["abc", 456], ["aa", True]) {} + | ^ expected [str], got [str(aa) | bool(True)] + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_03_list/stderr.golden.py b/test/grammar/types/args/schema_types_err_03_list/stderr.golden.py deleted file mode 100644 index a361f5f3a..000000000 --- a/test/grammar/types/args/schema_types_err_03_list/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=46, - arg_msg="got [bool(True)|str(aa)]" - ) - ], - arg_msg='expect [str], got [bool(True)|str(aa)]' - ), - file=sys.stdout -) - diff --git a/test/grammar/types/args/schema_types_err_04_without_config/stderr.golden b/test/grammar/types/args/schema_types_err_04_without_config/stderr.golden new file mode 100644 index 000000000..fac1bffaf --- /dev/null +++ b/test/grammar/types/args/schema_types_err_04_without_config/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:46 + | +6 | x1 = CheckArgType([123, True], ["abc", 456], ["aa", True]) + | ^ expected [str], got [str(aa) | bool(True)] + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_04_without_config/stderr.golden.py b/test/grammar/types/args/schema_types_err_04_without_config/stderr.golden.py deleted file mode 100644 index 42785b85c..000000000 --- a/test/grammar/types/args/schema_types_err_04_without_config/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=46, - arg_msg='got [bool(True)|str(aa)]' - ) - ], - arg_msg='expect [str], got [bool(True)|str(aa)]' - ), - file=sys.stdout -) diff --git a/test/grammar/types/args/schema_types_err_05_kwargs/stderr.golden b/test/grammar/types/args/schema_types_err_05_kwargs/stderr.golden new file mode 100644 index 000000000..0d5874669 --- /dev/null +++ b/test/grammar/types/args/schema_types_err_05_kwargs/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:31 + | +5 | person = Person(data="Alice", n="1") + | ^ expected int, got str(1) + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_05_kwargs/stderr.golden.py b/test/grammar/types/args/schema_types_err_05_kwargs/stderr.golden.py deleted file mode 100644 index 338fc8cb6..000000000 --- a/test/grammar/types/args/schema_types_err_05_kwargs/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=31, - arg_msg="got str(1)" - ) - ], - arg_msg='expect int, got str(1)' - ), - file=sys.stdout -) - diff --git a/test/grammar/types/args/schema_types_err_too_many_args_0/stderr.golden b/test/grammar/types/args/schema_types_err_too_many_args_0/stderr.golden new file mode 100644 index 000000000..8d3ca4ea2 --- /dev/null +++ b/test/grammar/types/args/schema_types_err_too_many_args_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:4:34 + | +4 | schema_in_main_k = SchemaInMainK(msg='I am the instance of SchemaInMainK') + | ^ "SchemaInMainK" got an unexpected keyword argument 'msg' + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_too_many_args_0/stderr.golden.py b/test/grammar/types/args/schema_types_err_too_many_args_0/stderr.golden.py deleted file mode 100644 index 7dc21d230..000000000 --- a/test/grammar/types/args/schema_types_err_too_many_args_0/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=34, - ) - ], - arg_msg='"SchemaInMainK" got an unexpected keyword argument \'msg\'' - ), - file=sys.stdout -) diff --git a/test/grammar/types/args/schema_types_err_too_many_args_1/stderr.golden b/test/grammar/types/args/schema_types_err_too_many_args_1/stderr.golden new file mode 100644 index 000000000..703e17daa --- /dev/null +++ b/test/grammar/types/args/schema_types_err_too_many_args_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:4:34 + | +4 | schema_in_main_k = SchemaInMainK('I am the instance of SchemaInMainK') + | ^ "SchemaInMainK" takes 0 positional argument but 1 were given + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_too_many_args_1/stderr.golden.py b/test/grammar/types/args/schema_types_err_too_many_args_1/stderr.golden.py deleted file mode 100644 index 51132d69c..000000000 --- a/test/grammar/types/args/schema_types_err_too_many_args_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=34, - ) - ], - arg_msg='"SchemaInMainK" takes 0 positional argument but 1 were given' - ), - file=sys.stdout -) diff --git a/test/grammar/types/args/schema_types_err_too_many_args_2/stderr.golden b/test/grammar/types/args/schema_types_err_too_many_args_2/stderr.golden new file mode 100644 index 000000000..1713de883 --- /dev/null +++ b/test/grammar/types/args/schema_types_err_too_many_args_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:4:44 + | +4 | schema_in_main_k = SchemaInMainK('param1', "param2") + | ^ "SchemaInMainK" takes 1 positional argument but 2 were given + | \ No newline at end of file diff --git a/test/grammar/types/args/schema_types_err_too_many_args_2/stderr.golden.py b/test/grammar/types/args/schema_types_err_too_many_args_2/stderr.golden.py deleted file mode 100644 index a479cb2ca..000000000 --- a/test/grammar/types/args/schema_types_err_too_many_args_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=34, - ) - ], - arg_msg='"SchemaInMainK" takes 1 positional argument but 2 were given' - ), - file=sys.stdout -) diff --git a/test/grammar/types/binary_expr/binary_expr_fail_3/main.k b/test/grammar/types/binary_expr/binary_expr_4/main.k similarity index 51% rename from test/grammar/types/binary_expr/binary_expr_fail_3/main.k rename to test/grammar/types/binary_expr/binary_expr_4/main.k index f7bf4fb80..9877069bd 100644 --- a/test/grammar/types/binary_expr/binary_expr_fail_3/main.k +++ b/test/grammar/types/binary_expr/binary_expr_4/main.k @@ -1 +1,2 @@ a = 1 > False +b = 2 < True diff --git a/test/grammar/types/binary_expr/binary_expr_4/stdout.golden b/test/grammar/types/binary_expr/binary_expr_4/stdout.golden new file mode 100644 index 000000000..97890b200 --- /dev/null +++ b/test/grammar/types/binary_expr/binary_expr_4/stdout.golden @@ -0,0 +1,2 @@ +a: true +b: false diff --git a/test/grammar/types/binary_expr/binary_expr_fail_0/stderr.golden b/test/grammar/types/binary_expr/binary_expr_fail_0/stderr.golden new file mode 100644 index 000000000..1646e4cfd --- /dev/null +++ b/test/grammar/types/binary_expr/binary_expr_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:10 + | +1 | a: int = 1 + True + | ^ unsupported operand type(s) for +: 'int(1)' and 'bool(True)' + | \ No newline at end of file diff --git a/test/grammar/types/binary_expr/binary_expr_fail_0/stderr.golden.py b/test/grammar/types/binary_expr/binary_expr_fail_0/stderr.golden.py deleted file mode 100644 index fd69ab344..000000000 --- a/test/grammar/types/binary_expr/binary_expr_fail_0/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - ) - ], - arg_msg="unsupported operand type(s) for +: 'int(1)' and 'bool(True)'" - ) - , file=sys.stdout -) diff --git a/test/grammar/types/binary_expr/binary_expr_fail_1/stderr.golden b/test/grammar/types/binary_expr/binary_expr_fail_1/stderr.golden new file mode 100644 index 000000000..99e980bc5 --- /dev/null +++ b/test/grammar/types/binary_expr/binary_expr_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:5 + | +1 | a = [0] < [1] + | ^ unsupported operand type(s) for <: '[int(0)]' and '[int(1)]' + | \ No newline at end of file diff --git a/test/grammar/types/binary_expr/binary_expr_fail_1/stderr.golden.py b/test/grammar/types/binary_expr/binary_expr_fail_1/stderr.golden.py deleted file mode 100644 index efe29daa1..000000000 --- a/test/grammar/types/binary_expr/binary_expr_fail_1/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=11, - ) - ], - arg_msg="unsupported operand type(s) for <: '[int(0)]' and '[int(1)]'" - ) - , file=sys.stdout -) diff --git a/test/grammar/types/binary_expr/binary_expr_fail_2/stderr.golden b/test/grammar/types/binary_expr/binary_expr_fail_2/stderr.golden new file mode 100644 index 000000000..31742c510 --- /dev/null +++ b/test/grammar/types/binary_expr/binary_expr_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:5 + | +1 | a = {} < {} + | ^ unsupported operand type(s) for <: '{any:any}' and '{any:any}' + | \ No newline at end of file diff --git a/test/grammar/types/binary_expr/binary_expr_fail_2/stderr.golden.py b/test/grammar/types/binary_expr/binary_expr_fail_2/stderr.golden.py deleted file mode 100644 index 612acfb90..000000000 --- a/test/grammar/types/binary_expr/binary_expr_fail_2/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=10, - ) - ], - arg_msg="unsupported operand type(s) for <: '{any:any}' and '{any:any}'" - ) - , file=sys.stdout -) diff --git a/test/grammar/types/binary_expr/binary_expr_fail_3/stderr.golden.py b/test/grammar/types/binary_expr/binary_expr_fail_3/stderr.golden.py deleted file mode 100644 index 6da53b136..000000000 --- a/test/grammar/types/binary_expr/binary_expr_fail_3/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=9, - ) - ], - arg_msg="unsupported operand type(s) for >: 'int(1)' and 'bool(False)'" - ) - , file=sys.stdout -) diff --git a/test/grammar/types/literal/lit_err_01_bool_01/stderr.golden b/test/grammar/types/literal/lit_err_01_bool_01/stderr.golden new file mode 100644 index 000000000..cc277e9e4 --- /dev/null +++ b/test/grammar/types/literal/lit_err_01_bool_01/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | bool_01 = False + | ^ expected bool(True), got bool(False) + | + --> ${CWD}/main.k:2:5 + | +2 | bool_01: True + | ^ variable is defined here, its type is bool(True), but got bool(False) + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_01_bool_01/stderr.golden.py b/test/grammar/types/literal/lit_err_01_bool_01/stderr.golden.py deleted file mode 100644 index ec79eee44..000000000 --- a/test/grammar/types/literal/lit_err_01_bool_01/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect bool(True)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got bool(False)" - ) - ], - arg_msg="expect bool(True), got bool(False)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/literal/lit_err_01_bool_02/stderr.golden b/test/grammar/types/literal/lit_err_01_bool_02/stderr.golden new file mode 100644 index 000000000..302209019 --- /dev/null +++ b/test/grammar/types/literal/lit_err_01_bool_02/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | bool_01 = 123 + | ^ expected bool(True), got int(123) + | + --> ${CWD}/main.k:2:5 + | +2 | bool_01: True + | ^ variable is defined here, its type is bool(True), but got int(123) + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_01_bool_02/stderr.golden.py b/test/grammar/types/literal/lit_err_01_bool_02/stderr.golden.py deleted file mode 100644 index a557519e8..000000000 --- a/test/grammar/types/literal/lit_err_01_bool_02/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect bool(True)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got int(123)" - ) - ], - arg_msg="expect bool(True), got int(123)" - ), - file=sys.stdout -) diff --git a/test/grammar/types/literal/lit_err_02_int_01/stderr.golden b/test/grammar/types/literal/lit_err_02_int_01/stderr.golden new file mode 100644 index 000000000..40f94a359 --- /dev/null +++ b/test/grammar/types/literal/lit_err_02_int_01/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:5 + | +7 | int_02: 789 + | ^ expected int(123) | int(456), got int(789) + | + --> ${CWD}/main.k:3:5 + | +3 | int_02: 123 | 456 + | ^ variable is defined here, its type is int(123) | int(456), but got int(789) + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_02_int_01/stderr.golden.py b/test/grammar/types/literal/lit_err_02_int_01/stderr.golden.py deleted file mode 100644 index cd5eab6c2..000000000 --- a/test/grammar/types/literal/lit_err_02_int_01/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=5, - indent_count=1, - arg_msg="expect int(123)|int(456)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=5, - arg_msg="got int(789)" - ) - ], - arg_msg="expect int(123)|int(456), got int(789)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/literal/lit_err_02_int_02/stderr.golden b/test/grammar/types/literal/lit_err_02_int_02/stderr.golden new file mode 100644 index 000000000..bcc4f3c9c --- /dev/null +++ b/test/grammar/types/literal/lit_err_02_int_02/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | int_0: 0.0 + | ^ expected int(0), got float(0) + | + --> ${CWD}/main.k:2:5 + | +2 | int_0: 0 + | ^ variable is defined here, its type is int(0), but got float(0) + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_02_int_02/stderr.golden.py b/test/grammar/types/literal/lit_err_02_int_02/stderr.golden.py deleted file mode 100644 index 75906d989..000000000 --- a/test/grammar/types/literal/lit_err_02_int_02/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect int(0)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got float(0.0)" - ) - ], - arg_msg="expect int(0), got float(0.0)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/literal/lit_err_03_float_01/stderr.golden b/test/grammar/types/literal/lit_err_03_float_01/stderr.golden new file mode 100644 index 000000000..bcc7b9de7 --- /dev/null +++ b/test/grammar/types/literal/lit_err_03_float_01/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | float_01: 0.0 + | expect 0.0, got int + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_03_float_01/stderr.golden.py b/test/grammar/types/literal/lit_err_03_float_01/stderr.golden.py deleted file mode 100644 index ca5d449bd..000000000 --- a/test/grammar/types/literal/lit_err_03_float_01/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect float(0.0)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got int(0)" - ) - ], - arg_msg="expect float(0.0), got int(0)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/literal/lit_err_03_float_02/stderr.golden b/test/grammar/types/literal/lit_err_03_float_02/stderr.golden new file mode 100644 index 000000000..d1559f1dd --- /dev/null +++ b/test/grammar/types/literal/lit_err_03_float_02/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | x_01: 0.0 | 3.14 | 9527 + | expect 0.0 | 3.14 | 9527, got int + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_03_float_02/stderr.golden.py b/test/grammar/types/literal/lit_err_03_float_02/stderr.golden.py deleted file mode 100644 index f54ca85cc..000000000 --- a/test/grammar/types/literal/lit_err_03_float_02/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect int(9527)|float(0.0)|float(3.14)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got int(0)" - ) - ], - arg_msg="expect int(9527)|float(0.0)|float(3.14), got int(0)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/literal/lit_err_04_str_01/stderr.golden b/test/grammar/types/literal/lit_err_04_str_01/stderr.golden new file mode 100644 index 000000000..1b6ee6c05 --- /dev/null +++ b/test/grammar/types/literal/lit_err_04_str_01/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | x_01: "HTTP" + | ^ expected str(TCP) | str(UDP), got str(HTTP) + | + --> ${CWD}/main.k:2:5 + | +2 | x_01: "TCP" | 'UDP' + | ^ variable is defined here, its type is str(TCP) | str(UDP), but got str(HTTP) + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_04_str_01/stderr.golden.py b/test/grammar/types/literal/lit_err_04_str_01/stderr.golden.py deleted file mode 100644 index 3f899a78a..000000000 --- a/test/grammar/types/literal/lit_err_04_str_01/stderr.golden.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str(TCP)|str(UDP)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got str(HTTP)" - ) - ], - arg_msg='expect str(TCP)|str(UDP), got str(HTTP)' - ), - file=sys.stdout -) - diff --git a/test/grammar/types/literal/lit_err_04_str_02/stderr.golden b/test/grammar/types/literal/lit_err_04_str_02/stderr.golden new file mode 100644 index 000000000..c53fa8905 --- /dev/null +++ b/test/grammar/types/literal/lit_err_04_str_02/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:5:5 + | +5 | x_01: 443 + | ^ expected str(TCP) | str(UDP), got int(443) + | + --> ${CWD}/main.k:2:5 + | +2 | x_01: "TCP" | 'UDP' + | ^ variable is defined here, its type is str(TCP) | str(UDP), but got int(443) + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_04_str_02/stderr.golden.py b/test/grammar/types/literal/lit_err_04_str_02/stderr.golden.py deleted file mode 100644 index 284fee05e..000000000 --- a/test/grammar/types/literal/lit_err_04_str_02/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect str(TCP)|str(UDP)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got int(443)" - ) - ], - arg_msg='expect str(TCP)|str(UDP), got int(443)' - ), - file=sys.stdout -) diff --git a/test/grammar/types/literal/lit_err_05_union_01/stderr.golden b/test/grammar/types/literal/lit_err_05_union_01/stderr.golden new file mode 100644 index 000000000..ca2da25a6 --- /dev/null +++ b/test/grammar/types/literal/lit_err_05_union_01/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:2:1 + | +2 | x_1?: True|123|3.14|"abc"|[]|{str:} + | expect True | 123 | 3.14 | "abc" | [] | {str:}, got int + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_05_union_01/stderr.golden.py b/test/grammar/types/literal/lit_err_05_union_01/stderr.golden.py deleted file mode 100644 index ba16a2272..000000000 --- a/test/grammar/types/literal/lit_err_05_union_01/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect bool(True)|int(123)|float(3.14)|str(abc)|[any]|{str:any}", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - col_no=5, - arg_msg="got int(443)" - ) - ], - arg_msg='expect bool(True)|int(123)|float(3.14)|str(abc)|[any]|{str:any}, got int(443)' - ), - file=sys.stdout -) diff --git a/test/grammar/types/literal/lit_err_06_unit/stderr.golden b/test/grammar/types/literal/lit_err_06_unit/stderr.golden new file mode 100644 index 000000000..4f108971a --- /dev/null +++ b/test/grammar/types/literal/lit_err_06_unit/stderr.golden @@ -0,0 +1,11 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:6:5 + | +6 | int_01 = 123 + | ^ expected number_multiplier(123K) | int(456), got int(123) + | + --> ${CWD}/main.k:2:5 + | +2 | int_01: 123K | 456 + | ^ variable is defined here, its type is number_multiplier(123K) | int(456), but got int(123) + | \ No newline at end of file diff --git a/test/grammar/types/literal/lit_err_06_unit/stderr.golden.py b/test/grammar/types/literal/lit_err_06_unit/stderr.golden.py deleted file mode 100644 index 5ca3f54e8..000000000 --- a/test/grammar/types/literal/lit_err_06_unit/stderr.golden.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5, - indent_count=1, - arg_msg="expect int(456)|number_multiplier(123K)", - err_level=kcl_error.ErrLevel.ORDINARY - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=6, - col_no=5, - arg_msg="got int(123)" - ) - ], - arg_msg='expect int(456)|number_multiplier(123K), got int(123)' - ), - file=sys.stdout -) diff --git a/test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden b/test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden new file mode 100644 index 000000000..95f352159 --- /dev/null +++ b/test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden @@ -0,0 +1,6 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:7:1 + | +7 | person: Person = json.decode('{"err_name": "Alice", "age": 18}') + | expect Person, got dict + | \ No newline at end of file diff --git a/test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden.py b/test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden.py deleted file mode 100644 index b1307da48..000000000 --- a/test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - ) - ], - arg_msg="err_name: No such member in the schema 'Person'" - ), - file=sys.stdout -) diff --git a/test/grammar/types/runtime_ty/runtime_ty_err_1/stderr.golden b/test/grammar/types/runtime_ty/runtime_ty_err_1/stderr.golden new file mode 100644 index 000000000..ffd3fb239 --- /dev/null +++ b/test/grammar/types/runtime_ty/runtime_ty_err_1/stderr.golden @@ -0,0 +1 @@ +expect [Person], got list diff --git a/test/grammar/types/runtime_ty/runtime_ty_err_1/stderr.golden.py b/test/grammar/types/runtime_ty/runtime_ty_err_1/stderr.golden.py deleted file mode 100644 index b1307da48..000000000 --- a/test/grammar/types/runtime_ty/runtime_ty_err_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - ) - ], - arg_msg="err_name: No such member in the schema 'Person'" - ), - file=sys.stdout -) diff --git a/test/grammar/types/type_alias/type_alias_err_0/stderr.golden b/test/grammar/types/type_alias/type_alias_err_0/stderr.golden new file mode 100644 index 000000000..5cd856b3a --- /dev/null +++ b/test/grammar/types/type_alias/type_alias_err_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:22 + | +7 | x1 = CheckArgType(1, "Golang") {} + | ^ expected str(KCL) | str(CUE), got str(Golang) + | \ No newline at end of file diff --git a/test/grammar/types/type_alias/type_alias_err_0/stderr.golden.py b/test/grammar/types/type_alias/type_alias_err_0/stderr.golden.py deleted file mode 100644 index 417f01bd8..000000000 --- a/test/grammar/types/type_alias/type_alias_err_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=22, - arg_msg="got str(Golang)" - ) - ], - arg_msg="expect str(KCL)|str(CUE), got str(Golang)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/type_alias/type_alias_err_1/stderr.golden b/test/grammar/types/type_alias/type_alias_err_1/stderr.golden new file mode 100644 index 000000000..ffe260563 --- /dev/null +++ b/test/grammar/types/type_alias/type_alias_err_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:1 + | +3 | _name: Int = "Green" + | ^ expected int, got str(Green) + | \ No newline at end of file diff --git a/test/grammar/types/type_alias/type_alias_err_1/stderr.golden.py b/test/grammar/types/type_alias/type_alias_err_1/stderr.golden.py deleted file mode 100644 index 2808775f5..000000000 --- a/test/grammar/types/type_alias/type_alias_err_1/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=3, - col_no=1, - arg_msg="got str(Green)" - ) - ], - arg_msg="expect int, got str(Green)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/type_alias/type_alias_err_2/stderr.golden b/test/grammar/types/type_alias/type_alias_err_2/stderr.golden new file mode 100644 index 000000000..e99ae0985 --- /dev/null +++ b/test/grammar/types/type_alias/type_alias_err_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:4:1 + | +4 | _name: String = 1 + | ^ expected str, got int(1) + | \ No newline at end of file diff --git a/test/grammar/types/type_alias/type_alias_err_2/stderr.golden.py b/test/grammar/types/type_alias/type_alias_err_2/stderr.golden.py deleted file mode 100644 index 13bdcd2d1..000000000 --- a/test/grammar/types/type_alias/type_alias_err_2/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=1, - arg_msg="got int(1)" - ) - ], - arg_msg="expect str, got int(1)" - ), - file=sys.stdout -) diff --git a/test/grammar/types/type_alias/type_alias_err_3/stderr.golden b/test/grammar/types/type_alias/type_alias_err_3/stderr.golden new file mode 100644 index 000000000..e79a06a56 --- /dev/null +++ b/test/grammar/types/type_alias/type_alias_err_3/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:4:1 + | +4 | _name: List = [1.1] + | ^ expected [str | int], got [float(1.1)] + | \ No newline at end of file diff --git a/test/grammar/types/type_alias/type_alias_err_3/stderr.golden.py b/test/grammar/types/type_alias/type_alias_err_3/stderr.golden.py deleted file mode 100644 index caefb2b20..000000000 --- a/test/grammar/types/type_alias/type_alias_err_3/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=4, - col_no=1, - arg_msg="got [float(1.1)]" - ) - ], - arg_msg="expect [int|str], got [float(1.1)]" - ), - file=sys.stdout -) diff --git a/test/grammar/types/type_as/type_as_err_0/stderr.golden b/test/grammar/types/type_as/type_as_err_0/stderr.golden new file mode 100644 index 000000000..3c386b3df --- /dev/null +++ b/test/grammar/types/type_as/type_as_err_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:5 + | +1 | a = 1 as str + | ^ Conversion of type 'int(1)' to type 'str' may be a mistake because neither type sufficiently overlaps with the other + | \ No newline at end of file diff --git a/test/grammar/types/type_as/type_as_err_0/stderr.golden.py b/test/grammar/types/type_as/type_as_err_0/stderr.golden.py deleted file mode 100644 index 795286494..000000000 --- a/test/grammar/types/type_as/type_as_err_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - ) - ], - arg_msg="Conversion of type 'int(1)' to type 'str' may be a mistake because neither type sufficiently overlaps with the other" - ), - file=sys.stdout -) diff --git a/test/grammar/types/type_as/type_as_err_1/stderr.golden b/test/grammar/types/type_as/type_as_err_1/stderr.golden new file mode 100644 index 000000000..8e12e3119 --- /dev/null +++ b/test/grammar/types/type_as/type_as_err_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:12 + | +2 | b: float = a as float + | ^ Conversion of type 'int | str' to type 'float' may be a mistake because neither type sufficiently overlaps with the other + | \ No newline at end of file diff --git a/test/grammar/types/type_as/type_as_err_1/stderr.golden.py b/test/grammar/types/type_as/type_as_err_1/stderr.golden.py deleted file mode 100644 index 2e3ee4c80..000000000 --- a/test/grammar/types/type_as/type_as_err_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - ) - ], - arg_msg="Conversion of type 'int|str' to type 'float' may be a mistake because neither type sufficiently overlaps with the other" - ), - file=sys.stdout -) diff --git a/test/grammar/types/union_ty/union_ty_err_0/stderr.golden b/test/grammar/types/union_ty/union_ty_err_0/stderr.golden new file mode 100644 index 000000000..1c5283530 --- /dev/null +++ b/test/grammar/types/union_ty/union_ty_err_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:11:7 + | +11 | x.c = 1 + | ^ Cannot add member 'c' to 'schemas ["A", "B"]' + | \ No newline at end of file diff --git a/test/grammar/types/union_ty/union_ty_err_0/stderr.golden.py b/test/grammar/types/union_ty/union_ty_err_0/stderr.golden.py deleted file mode 100644 index fd10182e7..000000000 --- a/test/grammar/types/union_ty/union_ty_err_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=8, - ) - ], - arg_msg="expect A|B, got dict" - ), - file=sys.stdout -) diff --git a/test/grammar/types/union_ty/union_ty_err_1/stderr.golden b/test/grammar/types/union_ty/union_ty_err_1/stderr.golden new file mode 100644 index 000000000..17e9a0ce7 --- /dev/null +++ b/test/grammar/types/union_ty/union_ty_err_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2L23]: CompileError + --> ${CWD}/main.k:14:7 + | +14 | x.d = 1 + | ^ Cannot add member 'd' to 'schemas ["A", "B", "C"]' + | \ No newline at end of file diff --git a/test/grammar/types/union_ty/union_ty_err_1/stderr.golden.py b/test/grammar/types/union_ty/union_ty_err_1/stderr.golden.py deleted file mode 100644 index 3754d2dc5..000000000 --- a/test/grammar/types/union_ty/union_ty_err_1/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.CompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11, - ) - ], - arg_msg="expect A|B|C, got dict" - ), - file=sys.stdout -) diff --git a/test/grammar/types/var_type_annotation/type_fail_0/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_0/stderr.golden new file mode 100644 index 000000000..f1d3258f2 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_0/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | _name: int = "Green" + | ^ expected int, got str(Green) + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_0/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_0/stderr.golden.py deleted file mode 100644 index 668619141..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_0/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg="got str(Green)" - ) - ], - arg_msg="expect int, got str(Green)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/var_type_annotation/type_fail_1/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_1/stderr.golden new file mode 100644 index 000000000..4128e3ce6 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_1/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | _name: str = 1 + | ^ expected str, got int(1) + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_1/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_1/stderr.golden.py deleted file mode 100644 index 6442aca70..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_1/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg="got int(1)" - ) - ], - arg_msg="expect str, got int(1)" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/var_type_annotation/type_fail_10/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_10/stderr.golden new file mode 100644 index 000000000..05a596bbb --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_10/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:1 + | +7 | foo: Foo = Bar { + | ^ expected Foo, got Bar + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_10/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_10/stderr.golden.py deleted file mode 100644 index e51997ed8..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_10/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=1, - arg_msg='got Bar', - ) - ], - arg_msg='expect Foo, got Bar', - ), - file=sys.stdout, -) diff --git a/test/grammar/types/var_type_annotation/type_fail_11/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_11/stderr.golden new file mode 100644 index 000000000..e47dbc781 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_11/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:1 + | +7 | foo: Foo = 1 + | ^ expected Foo, got int(1) + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_11/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_11/stderr.golden.py deleted file mode 100644 index c94b92240..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_11/stderr.golden.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=7, - col_no=1, - arg_msg='got int(1)', - ) - ], - arg_msg='expect Foo, got int(1)', - ), - file=sys.stdout, -) diff --git a/test/grammar/types/var_type_annotation/type_fail_12/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_12/stderr.golden new file mode 100644 index 000000000..0bdabe257 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_12/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:7:1 + | +7 | foo: int = Foo { + | ^ expected int, got Foo + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_12/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_12/stderr.golden.py deleted file mode 100644 index fc1529ddc..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_12/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", line_no=7, col_no=1, arg_msg="got Foo" - ) - ], - arg_msg="expect int, got Foo", - ), - file=sys.stdout, -) diff --git a/test/grammar/types/var_type_annotation/type_fail_13/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_13/stderr.golden new file mode 100644 index 000000000..83711e8c4 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_13/stderr.golden @@ -0,0 +1,17 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:3:9 + | +3 | A = "2" + | ^ expected int, got str(2) + | + --> ${CWD}/main.k:1:1 + | +1 | config: {"A"|"B": int} = { + | ^ variable is defined here, its type is int, but got str(2) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | config: {"A"|"B": int} = { + | ^ expected {str(A) | str(B):int}, got {str(A):str(2)} + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_13/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_13/stderr.golden.py deleted file mode 100644 index a896780c5..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_13/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg="got {str(A):str(2)}" - ) - ], - arg_msg="expect {str(A)|str(B):int}, got {str(A):str(2)}" - ), - file=sys.stdout -) diff --git a/test/grammar/types/var_type_annotation/type_fail_14/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_14/stderr.golden new file mode 100644 index 000000000..aeb321f0a --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_14/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | config: {"A"|"B": int} = { + | ^ expected {str(A) | str(B):int}, got {str(C):int(1)} + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_14/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_14/stderr.golden.py deleted file mode 100644 index 7cfa59996..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_14/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg="got {str(C):int(1)}" - ) - ], - arg_msg="expect {str(A)|str(B):int}, got {str(C):int(1)}" - ), - file=sys.stdout -) diff --git a/test/grammar/types/var_type_annotation/type_fail_2/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_2/stderr.golden new file mode 100644 index 000000000..d95421823 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_2/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:1 + | +2 | _name = "s" + | ^ expected int, got str(s) + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_2/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_2/stderr.golden.py deleted file mode 100644 index e2dfd60c7..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_2/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1, - arg_msg="got str(s)" - ) - ], - arg_msg="expect int, got str(s)" - ), - file=sys.stdout -) diff --git a/test/grammar/types/var_type_annotation/type_fail_3/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_3/stderr.golden new file mode 100644 index 000000000..b3d1f3f57 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_3/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:1 + | +2 | _name = 1 + | ^ expected str, got int(1) + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_3/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_3/stderr.golden.py deleted file mode 100644 index 7d9b6c6b1..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_3/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1, - arg_msg="got int(1)" - ) - ], - arg_msg="expect str, got int(1)" - ), - file=sys.stdout -) diff --git a/test/grammar/types/var_type_annotation/type_fail_4/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_4/stderr.golden new file mode 100644 index 000000000..18319fcf8 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_4/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:1 + | +2 | _name = [1] + | ^ expected [str], got [int(1)] + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_4/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_4/stderr.golden.py deleted file mode 100644 index 489f83b52..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_4/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1, - arg_msg="got [int(1)]" - ) - ], - arg_msg="expect [str], got [int(1)]" - ), - file=sys.stdout -) - diff --git a/test/grammar/types/var_type_annotation/type_fail_5/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_5/stderr.golden new file mode 100644 index 000000000..9f6415eb1 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_5/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:1 + | +2 | _name = [1.1] + | ^ expected [str | int], got [float(1.1)] + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_5/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_5/stderr.golden.py deleted file mode 100644 index f0387221d..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_5/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1, - arg_msg="got [float(1.1)]" - ) - ], - arg_msg="expect [int|str], got [float(1.1)]" - ), - file=sys.stdout -) diff --git a/test/grammar/types/var_type_annotation/type_fail_6/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_6/stderr.golden new file mode 100644 index 000000000..955c1d961 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_6/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | name: "aa\"ab|" = "aa\"ab" + | ^ expected str(aa"ab|), got str(aa"ab) + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_6/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_6/stderr.golden.py deleted file mode 100644 index 86b1bd64c..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_6/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg='got str(aa"ab)' - ) - ], - arg_msg='expect str(aa"ab|), got str(aa"ab)' - ), - file=sys.stdout -) - diff --git a/test/grammar/types/var_type_annotation/type_fail_7/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_7/stderr.golden new file mode 100644 index 000000000..da4c9e69a --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_7/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | name: "aa\"ab|" | "abc" = "aa\"ab" + | ^ expected str(aa"ab|) | str(abc), got str(aa"ab) + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_7/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_7/stderr.golden.py deleted file mode 100644 index 30d594587..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_7/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg='got str(aa"ab)' - ) - ], - arg_msg='expect str(aa"ab|)|str(abc), got str(aa"ab)' - ), - file=sys.stdout -) - diff --git a/test/grammar/types/var_type_annotation/type_fail_8/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_8/stderr.golden new file mode 100644 index 000000000..7dd67ed81 --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_8/stderr.golden @@ -0,0 +1,6 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | name: ["aa\"ab|"] = ["aa\"ab"] + | ^ expected [str(aa"ab|)], got [str(aa"ab)] + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_8/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_8/stderr.golden.py deleted file mode 100644 index 9cb15209b..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_8/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg='got [str(aa"ab)]' - ) - ], - arg_msg='expect [str(aa"ab|)], got [str(aa"ab)]' - ), - file=sys.stdout -) - diff --git a/test/grammar/types/var_type_annotation/type_fail_9/stderr.golden b/test/grammar/types/var_type_annotation/type_fail_9/stderr.golden new file mode 100644 index 000000000..2372faaad --- /dev/null +++ b/test/grammar/types/var_type_annotation/type_fail_9/stderr.golden @@ -0,0 +1,50 @@ +error[E2G22]: TypeError + --> ${CWD}/main.k:2:1 + | +2 | _a: {str:int} = {"key2": 1} + | ^ can not change the type of '_a' to {str:str} + | + --> ${CWD}/main.k:1:1 + | +1 | _a: {str:str} = {"key": "value"} + | ^ expected {str:str} + | +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | _a: {str:str} = {"key": "value"} + | ^ can not change the type of '_a' to {str:int} + | + --> ${CWD}/main.k:2:1 + | +2 | _a: {str:int} = {"key2": 1} + | ^ expected {str:int} + | +error[E2G22]: TypeError + --> ${CWD}/main.k:1:18 + | +1 | _a: {str:str} = {"key": "value"} + | ^ expected int, got str(value) + | + --> ${CWD}/main.k:1:1 + | +1 | _a: {str:str} = {"key": "value"} + | ^ variable is defined here, its type is int, but got str(value) + | +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | _a: {str:str} = {"key": "value"} + | ^ can not change the type of '_a' to {str:str} + | + --> ${CWD}/main.k:2:1 + | +2 | _a: {str:int} = {"key2": 1} + | ^ expected {str:int} + | +error[E2G22]: TypeError + --> ${CWD}/main.k:1:1 + | +1 | _a: {str:str} = {"key": "value"} + | ^ expected {str:int}, got {str(key):str(value)} + | \ No newline at end of file diff --git a/test/grammar/types/var_type_annotation/type_fail_9/stderr.golden.py b/test/grammar/types/var_type_annotation/type_fail_9/stderr.golden.py deleted file mode 100644 index e749a64ef..000000000 --- a/test/grammar/types/var_type_annotation/type_fail_9/stderr.golden.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.TypeError_Compile_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=1, - col_no=1, - arg_msg='expect {str:str}', - err_level=kcl_error.ErrLevel.ORDINARY, - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1, - arg_msg='got {str:int}', - ), - ], - arg_msg='can not change type of _a', - ), - file=sys.stdout, -) diff --git a/test/grammar/unification/fail_0/stderr.golden b/test/grammar/unification/fail_0/stderr.golden new file mode 100644 index 000000000..63f6c2bf2 --- /dev/null +++ b/test/grammar/unification/fail_0/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:9:1 + | +9 | alice.age = 18 + | ^ Can not change the value of 'alice', because it was declared immutable + | + --> ${CWD}/main.k:5:1 + | +5 | alice = Person { + | ^ The variable 'alice' is declared here + | +note: change the variable name to '_alice' to make it mutable \ No newline at end of file diff --git a/test/grammar/unification/fail_0/stderr.golden.py b/test/grammar/unification/fail_0/stderr.golden.py deleted file mode 100644 index 3d8d30018..000000000 --- a/test/grammar/unification/fail_0/stderr.golden.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=9, - col_no=1, - end_col_no=10 - ) - ], - ), - file=sys.stdout -) - diff --git a/test/grammar/unification/fail_1/stderr.golden b/test/grammar/unification/fail_1/stderr.golden new file mode 100644 index 000000000..a7ea45460 --- /dev/null +++ b/test/grammar/unification/fail_1/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:10:1 + | +10 | config = Config { + | ^ Can not change the value of 'config', because it was declared immutable + | + --> ${CWD}/main.k:6:1 + | +6 | config = Config { + | ^ The variable 'config' is declared here + | +note: change the variable name to '_config' to make it mutable \ No newline at end of file diff --git a/test/grammar/unification/fail_1/stderr.golden.py b/test/grammar/unification/fail_1/stderr.golden.py deleted file mode 100644 index 8c6abaff1..000000000 --- a/test/grammar/unification/fail_1/stderr.golden.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os - -import kclvm.kcl.error as kcl_error - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=10 - ), - ], - arg_msg="attribute 'hc' of Config is required and can't be None or Undefined") - , file=sys.stdout -) diff --git a/test/grammar/unification/fail_2/stderr.golden b/test/grammar/unification/fail_2/stderr.golden new file mode 100644 index 000000000..fb020aa7c --- /dev/null +++ b/test/grammar/unification/fail_2/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:11:1 + | +11 | _config.age = -1 + | ^ Instance check failed + | + --> ${CWD}/main.k:5:1 + | +5 | age > 0 if age + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/unification/fail_2/stderr.golden.py b/test/grammar/unification/fail_2/stderr.golden.py deleted file mode 100644 index 7d1d3e7d4..000000000 --- a/test/grammar/unification/fail_2/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) diff --git a/test/grammar/unification/fail_3/stderr.golden b/test/grammar/unification/fail_3/stderr.golden new file mode 100644 index 000000000..ff38aa176 --- /dev/null +++ b/test/grammar/unification/fail_3/stderr.golden @@ -0,0 +1,11 @@ +error[E3M38]: EvaluationError + --> ${CWD}/main.k:11:1 + | +11 | _config |= {age = -1} + | ^ Instance check failed + | + --> ${CWD}/main.k:5:1 + | +5 | age > 0 if age + | Check failed on the condition + | \ No newline at end of file diff --git a/test/grammar/unification/fail_3/stderr.golden.py b/test/grammar/unification/fail_3/stderr.golden.py deleted file mode 100644 index 7d1d3e7d4..000000000 --- a/test/grammar/unification/fail_3/stderr.golden.py +++ /dev/null @@ -1,23 +0,0 @@ - -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception(err_type=kcl_error.ErrType.SchemaCheckFailure_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=5, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_COND - ), - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=11, - arg_msg=kcl_error.SCHEMA_CHECK_FILE_MSG_ERR - ), - ]) - , file=sys.stdout -) diff --git a/test/grammar/variable/export/immutable_0/stderr.golden b/test/grammar/variable/export/immutable_0/stderr.golden new file mode 100644 index 000000000..0f1342fbf --- /dev/null +++ b/test/grammar/variable/export/immutable_0/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:2:1 + | +2 | a = 2 + | ^ Can not change the value of 'a', because it was declared immutable + | + --> ${CWD}/main.k:1:1 + | +1 | a = 1 + | ^ The variable 'a' is declared here + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/variable/export/immutable_0/stderr.golden.py b/test/grammar/variable/export/immutable_0/stderr.golden.py deleted file mode 100644 index 7b85a3b1d..000000000 --- a/test/grammar/variable/export/immutable_0/stderr.golden.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1 - ) - ], - ), - file=sys.stdout -) diff --git a/test/grammar/variable/export/immutable_1/stderr.golden b/test/grammar/variable/export/immutable_1/stderr.golden new file mode 100644 index 000000000..5927edeef --- /dev/null +++ b/test/grammar/variable/export/immutable_1/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:2:1 + | +2 | a = b = 2 + | ^ Can not change the value of 'a', because it was declared immutable + | + --> ${CWD}/main.k:1:1 + | +1 | a = 1 + | ^ The variable 'a' is declared here + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/variable/export/immutable_1/stderr.golden.py b/test/grammar/variable/export/immutable_1/stderr.golden.py deleted file mode 100644 index c8b15b5a3..000000000 --- a/test/grammar/variable/export/immutable_1/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=1 - ) - ], - ), - file=sys.stdout -) - diff --git a/test/grammar/variable/export/immutable_2/stderr.golden b/test/grammar/variable/export/immutable_2/stderr.golden new file mode 100644 index 000000000..84bf87e87 --- /dev/null +++ b/test/grammar/variable/export/immutable_2/stderr.golden @@ -0,0 +1,12 @@ +error[E1001]: ImmutableError + --> ${CWD}/main.k:2:5 + | +2 | b = a = 2 + | ^ Can not change the value of 'a', because it was declared immutable + | + --> ${CWD}/main.k:1:1 + | +1 | a = 1 + | ^ The variable 'a' is declared here + | +note: change the variable name to '_a' to make it mutable \ No newline at end of file diff --git a/test/grammar/variable/export/immutable_2/stderr.golden.py b/test/grammar/variable/export/immutable_2/stderr.golden.py deleted file mode 100644 index 665417538..000000000 --- a/test/grammar/variable/export/immutable_2/stderr.golden.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import kclvm.kcl.error as kcl_error -import os - -cwd = os.path.dirname(os.path.realpath(__file__)) - -kcl_error.print_kcl_error_message( - kcl_error.get_exception( - err_type=kcl_error.ErrType.ImmutableCompileError_TYPE, - file_msgs=[ - kcl_error.ErrFileMsg( - filename=cwd + "/main.k", - line_no=2, - col_no=5 - ) - ], - ), - file=sys.stdout -) -