MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / test_sarif_basic_structure

Function test_sarif_basic_structure

test/cli/sarif_test.py:129–150  ·  view source on GitHub ↗

Test that SARIF output has the correct basic structure.

()

Source from the content-addressed store, hash-verified

127
128
129def test_sarif_basic_structure():
130 """Test that SARIF output has the correct basic structure."""
131 sarif = run_sarif_check(BASIC_TEST_CODE)
132
133 # Check required SARIF fields
134 assert sarif["version"] == "2.1.0"
135 assert "$schema" in sarif
136 assert "sarif-schema" in sarif["$schema"]
137 assert "runs" in sarif
138 assert len(sarif["runs"]) == 1
139
140 run = sarif["runs"][0]
141 assert "tool" in run
142 assert "results" in run
143
144 tool = run["tool"]
145 assert "driver" in tool
146
147 driver = tool["driver"]
148 assert driver["name"] == "Cppcheck"
149 assert "rules" in driver
150 assert "semanticVersion" in driver
151
152
153def test_sarif_null_pointer():

Callers

nothing calls this directly

Calls 1

run_sarif_checkFunction · 0.85

Tested by

no test coverage detected