Skip to content

Commit

Permalink
add test case for atdgen runtime int64 repr bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gborough committed Feb 27, 2024
1 parent 1a18579 commit 11375e1
Showing 1 changed file with 12 additions and 0 deletions.
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

0 comments on commit 11375e1

Please sign in to comment.