diff --git a/lib/js/test/tests/Test__Tokens.bs.js b/lib/js/test/tests/Test__Tokens.bs.js index 79d6ce3e..4a39c578 100644 --- a/lib/js/test/tests/Test__Tokens.bs.js +++ b/lib/js/test/tests/Test__Tokens.bs.js @@ -3,6 +3,7 @@ var Curry = require("rescript/lib/js/curry.js"); var Assert = require("assert"); +var Util$AgdaModeVscode = require("../../src/Util/Util.bs.js"); var Editor$AgdaModeVscode = require("../../src/Editor.bs.js"); var Tokens$AgdaModeVscode = require("../../src/Tokens.bs.js"); var Test__Util$AgdaModeVscode = require("./Test__Util.bs.js"); @@ -22,6 +23,17 @@ describe("Tokens", (function () { var tokens = Tokens$AgdaModeVscode.toArray(ctx.state.tokens).map(function (param) { return Editor$AgdaModeVscode.$$Range.toString(param[1]) + " " + Tokens$AgdaModeVscode.Token.toString(param[0]); }); + var version = ctx.state.agdaVersion; + var srcOfPrimitive; + if (version !== undefined) { + srcOfPrimitive = Util$AgdaModeVscode.Version.gte(version, "2.6.4") ? "[src: 388]" : "[src: 320]"; + } else { + throw { + RE_EXN_ID: "Failure", + _1: "No Agda version found", + Error: new Error() + }; + } return Curry._3(Assert.deepEqual, [ "0:0-6 Token (0, 6) [Keyword]", "0:7-21 Token (7, 21) [Module] [src: 1]", @@ -29,7 +41,7 @@ describe("Tokens", (function () { "1:0-4 Token (28, 32) [Keyword]", "1:5-6 Token (33, 34) [Datatype] [src: 34]", "1:7-8 Token (35, 36) [Symbol]", - "1:9-12 Token (37, 40) [Primitive] [src: 388]", + "1:9-12 Token (37, 40) [Primitive] " + srcOfPrimitive, "1:13-18 Token (41, 46) [Keyword]", "2:2-3 Token (49, 50) [ConstructorInductive] [src: 50]", "2:4-5 Token (51, 52) [Symbol]", diff --git a/test/tests/Test__Tokens.res b/test/tests/Test__Tokens.res index 98c06818..cd8c2a95 100644 --- a/test/tests/Test__Tokens.res +++ b/test/tests/Test__Tokens.res @@ -28,6 +28,17 @@ describe("Tokens", () => { ->Array.map( ((token, range)) => Editor.Range.toString(range) ++ " " ++ Tokens.Token.toString(token), ) + + let srcOfPrimitive = switch ctx.state.agdaVersion { + | Some(version) => + if Util.Version.gte(version, "2.6.4") { + "[src: 388]" + } else { + "[src: 320]" + } + | None => raise(Failure("No Agda version found")) + } + Assert.deepEqual( [ "0:0-6 Token (0, 6) [Keyword]", @@ -36,7 +47,7 @@ describe("Tokens", () => { "1:0-4 Token (28, 32) [Keyword]", "1:5-6 Token (33, 34) [Datatype] [src: 34]", "1:7-8 Token (35, 36) [Symbol]", - "1:9-12 Token (37, 40) [Primitive] [src: 388]", + "1:9-12 Token (37, 40) [Primitive] " ++ srcOfPrimitive, "1:13-18 Token (41, 46) [Keyword]", "2:2-3 Token (49, 50) [ConstructorInductive] [src: 50]", "2:4-5 Token (51, 52) [Symbol]",