-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: runtime ty check and add more test cases. (#563)
- Loading branch information
Showing
14 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import json | ||
|
||
schema Person: | ||
name: str | ||
age: int | ||
|
||
person: Person = json.decode('{"name": "Alice", "age": 18}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
person: | ||
name: Alice | ||
age: 18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import json | ||
|
||
schema Person: | ||
name: str | ||
age: int | ||
|
||
persons: [Person] = json.decode('[{"name": "Alice", "age": 18}, {"name": "Bob", "age": 10}]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
persons: | ||
- name: Alice | ||
age: 18 | ||
- name: Bob | ||
age: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import json | ||
|
||
schema Person: | ||
name: str | ||
age: int | ||
|
||
person: Person = json.decode('{"err_name": "Alice", "age": 18}') |
19 changes: 19 additions & 0 deletions
19
test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import json | ||
|
||
schema Person: | ||
name: str | ||
age: int | ||
|
||
persons: [Person] = json.decode('[{"name": "Alice", "age": 18}, {"err_name": "Bob", "age": 10}]') |
19 changes: 19 additions & 0 deletions
19
test/grammar/types/runtime_ty/runtime_ty_err_1/stderr.golden.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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 | ||
) |
Submodule konfig
updated
5 files