Commit e7ccb1f
authored
Commit 8: Add location tests exposing term-location off-by-one (pre-fix)
Add location test cases to test.cpp covering various C++ string literal forms:
- r_plain: "a+b" — plain, offset 1 (already correct)
- r_raw: R"(a+b)" — raw, offset 3 (R"( = 3); currently uses 1 (WRONG)
- r_raw2: R"(\s+$)" — raw with metacharacters; currently wrong
- r_raw3: R"(\(([,\w]+)+\)$)" — complex raw; currently wrong
- r_raw4: R"x(a+b)x" — custom-delimiter raw, offset 4; currently uses 1 (WRONG)
- r_wide: L"a+b" — L" prefix, offset 2; currently uses 1 (WRONG)
- r_wide_raw: LR"(a+b)" — combined LR"( prefix, offset 4; currently uses 1 (WRONG)
- r_esc1: "\\s+" — escape-containing plain; offset 1 (correct)
- r_esc2: "a\\.b" — escaped dot; offset 1 (correct)
Added std::wregex typedef to stubs (for L"..." and LR"(...)" wide-char literals).
New locations.ql query reports per-term: litStartCol, valueStart, valueEnd,
termStartCol, termEndCol — restricted to test_locations() function.
Generated locations.expected via codeql test run --learn (CodeQL 2.26.1).
All 3 tests pass. The expected output captures the CURRENT (pre-fix) columns:
raw/prefixed rows show termStartCol = litStartCol + 1 (wrong);
plain rows show litStartCol + 1 (correct).
Commit 9 changes the raw/prefixed rows to their correct values.1 parent cebddbd commit e7ccb1f
5 files changed
Lines changed: 741 additions & 466 deletions
File tree
- cpp/ql/test/library-tests/regex
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments