"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "interprocedural_analyses/taint/test/configurationTest.ml" between
pyre-check-0.0.53.tar.gz and pyre-check-0.0.54.tar.gz

About: Pyre is a performant type checker for Python (ships with Pysa, a security focused static analysis tool).

configurationTest.ml  (pyre-check-0.0.53):configurationTest.ml  (pyre-check-0.0.54)
skipping to change at line 152 skipping to change at line 152
name = "test combined rule"; name = "test combined rule";
}; };
{ {
Taint.TaintConfiguration.Rule.sources = [Sources.NamedSource "B"]; Taint.TaintConfiguration.Rule.sources = [Sources.NamedSource "B"];
sinks = [Sinks.TriggeredPartialSink { kind = "C"; label = "b" }]; sinks = [Sinks.TriggeredPartialSink { kind = "C"; label = "b" }];
code = 2001; code = 2001;
message_format = "some form"; message_format = "some form";
name = "test combined rule"; name = "test combined rule";
}; };
]; ];
assert_equal (List.hd_exn configuration.rules).code 2001;
let configuration =
parse
{|
{ sources: [
{ name: "A" },
{ name: "B" },
{ name: "C" }
],
sinks: [
{ name: "CombinedSink", multi_sink_labels: ["a", "b"] }
],
combined_source_rules: [
{
name: "test combined rule",
sources: {"a": "A", "b": ["B", "C"]},
sinks: ["CombinedSink"],
code: 2001,
message_format: "some form"
}
]
}
|}
in
assert_equal configuration.sources ["A"; "B"; "C"];
assert_equal configuration.sinks ["CombinedSink"];
assert_equal
~printer:(List.to_string ~f:Taint.TaintConfiguration.Rule.show)
~cmp:(List.equal Taint.TaintConfiguration.Rule.equal)
configuration.rules
[
{
Taint.TaintConfiguration.Rule.sources = [Sources.NamedSource "A"];
sinks = [Sinks.TriggeredPartialSink { kind = "CombinedSink"; label = "a"
}];
code = 2001;
message_format = "some form";
name = "test combined rule";
};
{
Taint.TaintConfiguration.Rule.sources = [Sources.NamedSource "B"; Source
s.NamedSource "C"];
sinks = [Sinks.TriggeredPartialSink { kind = "CombinedSink"; label = "b"
}];
code = 2001;
message_format = "some form";
name = "test combined rule";
};
];
assert_equal (List.hd_exn configuration.rules).code 2001 assert_equal (List.hd_exn configuration.rules).code 2001
let test_combined_source_parse_errors _ = let test_combined_source_parse_errors _ =
let assert_fails configuration ~expected = let assert_fails configuration ~expected =
assert_raises expected (fun () -> parse configuration |> ignore) assert_raises expected (fun () -> parse configuration |> ignore)
in in
assert_fails assert_fails
{| {|
{ {
sources: [ sources: [
 End of changes. 1 change blocks. 
0 lines changed or deleted 49 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)