Files
codeql/cpp/ql/test/library-tests
copilot-swe-agent[bot] e7ccb1f2ce 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.
2026-07-21 10:27:55 +00:00
..
2020-03-19 09:18:32 -04:00
2019-09-09 11:25:53 +02:00
2025-11-26 13:42:43 +01:00
2019-09-09 11:25:53 +02:00
2020-10-07 13:14:54 -04:00
2024-12-20 13:53:35 +01:00
2024-04-09 15:15:41 +02:00
2019-09-09 11:25:53 +02:00
2025-04-23 16:56:56 +02:00
2019-09-09 11:25:53 +02:00
2019-09-09 11:25:53 +02:00
2024-11-12 09:49:10 +00:00
2025-06-27 14:42:08 +02:00
2025-06-11 11:41:50 +02:00
2019-09-09 11:25:53 +02:00
2020-01-20 15:00:09 +00:00
2020-01-29 13:11:50 +01:00
2019-09-09 11:25:53 +02:00
2019-09-09 11:25:53 +02:00
2019-09-09 11:25:53 +02:00
2024-10-16 11:33:18 +02:00
2022-08-25 20:52:27 +02:00
2019-09-09 11:25:53 +02:00
2022-10-21 18:36:12 +01:00
2020-11-03 13:39:33 -05:00
2019-09-09 11:25:53 +02:00
2022-08-25 20:52:27 +02:00
2020-06-30 17:46:08 +01:00
2019-09-09 11:25:53 +02:00
2019-09-09 11:25:53 +02:00
2025-06-13 09:44:03 +02:00
2024-01-29 14:11:07 +00:00
2019-09-09 11:25:53 +02:00
2025-11-18 20:03:24 +00:00
2025-08-03 12:17:34 +01:00