Skip to content

Commit b9f4dd0

Browse files
committed
Add a version-check to BigInt quick-eval test
1 parent f20476f commit b9f4dd0

File tree

3 files changed

+43
-8
lines changed

3 files changed

+43
-8
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import QuickEvalLib
2+
3+
class InterestingBigInt instanceof InterestingNumber
4+
{
5+
QlBuiltins::BigInt getBigIntValue() {
6+
result = super.getValue().toBigInt().pow(10)
7+
}
8+
9+
string toString() {
10+
result = super.toString()
11+
}
12+
}
13+
14+
class PrimeNumber extends InterestingNumber {
15+
PrimeNumber() {
16+
exists(int n | this = MkNumber(n) |
17+
n in [
18+
2,
19+
3,
20+
5,
21+
7,
22+
11,
23+
13,
24+
17,
25+
19
26+
])
27+
}
28+
}
29+
30+
from InterestingNumber n
31+
select n.toString()

extensions/ql-vscode/test/data/debugger/QuickEvalLib.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,4 @@ abstract class InterestingNumber extends TNumber
1717
final int getValue() {
1818
result = value
1919
}
20-
21-
QlBuiltins::BigInt getBigIntValue() {
22-
result = value.toBigInt()
23-
}
2420
}

extensions/ql-vscode/test/vscode-tests/cli-integration/debugger/debugger.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ describeWithCodeQL()("Debugger", () => {
4949
const quickEvalQueryPath = getDataFolderFilePath(
5050
"debugger/QuickEvalQuery.ql",
5151
);
52+
const quickEvalBigIntQueryPath = getDataFolderFilePath(
53+
"debugger/QuickEvalBigIntQuery.ql",
54+
);
5255
const quickEvalLibPath = getDataFolderFilePath("debugger/QuickEvalLib.qll");
5356

5457
beforeEach(async () => {
@@ -146,11 +149,16 @@ describeWithCodeQL()("Debugger", () => {
146149

147150
it("should run a quick evaluation with a bigint-valued result column", async () => {
148151
await withDebugController(appCommands, async (controller) => {
149-
await selectForQuickEval(quickEvalLibPath, 20, 23, 20, 37);
152+
const semver = await cli.getVersion();
153+
if (semver.compare("2.18.4") < 0) {
154+
// Skip this test if the CLI version is too old to support BigInt
155+
return;
156+
}
150157

151-
await controller.startDebuggingSelection({
152-
query: quickEvalQueryPath, // The query context. This query extends the abstract class.
153-
});
158+
await selectForQuickEval(quickEvalBigIntQueryPath, 4, 23, 4, 37);
159+
160+
// Don't specify a query path, so we'll default to the active document ("QuickEvalBigIntQuery.ql")
161+
await controller.startDebuggingSelection({});
154162
await controller.expectLaunched();
155163
const result = await controller.expectSucceeded();
156164
expect(result.started.quickEvalContext).toBeDefined();

0 commit comments

Comments
 (0)