Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test case for atdgen runtime int64 repr bug #19

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/test_sarif.ml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@ let%expect_test "taxonomies" =
{| {"guid":"1A567403-868F-405E-92CF-771A9ECB03A1","name":"Requirement levels","shortDescription":{"text":"This taxonomy classifies rules according to whether their use is required or recommended by company policy."},"taxa":[{"id":"RQL1001","name":"Required","shortDescription":{"text":"Rules in this category are required by company policy. All violations must be fixed unless an exemption is granted."}},{"id":"RQL1002","name":"Recommended","shortDescription":{"text":"Rules in this category are recommended but not required by company policy. Violations should be fixed but an exemption is not required to suppress a result."}}]} |}]
;;

let%expect_test "atdgen_runtime_int64_bug_checking_rule_index" =
let json = read_all "data/taxonomies.json" in
let parsed_all = Sarif_v_2_1_0_j.sarif_json_schema_of_string json in
let run = Sarif_v_2_1_0_j.string_of_run @@ List.hd @@ parsed_all.runs in
let parsed_run = Sarif_v_2_1_0_j.run_of_string run in
let result = Sarif_v_2_1_0_j.string_of_result @@ List.nth (Option.get parsed_run.results) 1
in
print_endline result;
[%expect
{| {"locations":[{"physicalLocation":{"artifactLocation":{"uri":"file:///C:/code/myProject/io/file.c"}}}],"message":{"text":"This result violates a rule that is classified as 'Recommended'."},"ruleId":"TUT1002","ruleIndex":1} |}]
;;

let%expect_test "sarif_json_schema.version" =
let sarif_json_schema =
Sarif_v_2_1_0_v.create_sarif_json_schema ~version:`TwoDotOneDotZero ~runs:[] ()
Expand Down
Loading