Skip to content

Commit 41478e7

Browse files
committed
[ fix ] Remove hardcoded filepaths from testings
1 parent 04b372c commit 41478e7

File tree

11 files changed

+73
-33
lines changed

11 files changed

+73
-33
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ defaults:
1010
on:
1111
# Triggers the workflow on push or pull request events but only for the master branch
1212
push:
13-
branches: [ master, dev, web, ci, ci-* ]
13+
branches: [ ci ]
14+
# branches: [ master, dev, web, ci, ci-* ]
1415
pull_request:
1516
branches: [ master, dev, ci, ci-* ]
1617

@@ -21,7 +22,8 @@ jobs:
2122
runs-on: ${{ matrix.os }}
2223
strategy:
2324
matrix:
24-
os: [windows-latest, ubuntu-latest, macos-latest]
25+
# os: [windows-latest, ubuntu-latest, macos-latest]
26+
os: [windows-latest]
2527
agda: ["Agda-2.6.3", "Agda-2.6.4", "Agda-2.7.0"]
2628
fail-fast: false
2729

lib/js/src/Connection/Connection.bs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/src/Connection/Shared/Connection__URI.bs.js

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__Connection.bs.js

Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__ShowGoals.bs.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__Util.bs.js

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Connection/Connection.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module Module: Module = {
114114
| Connection__URI.LspURI(_) => Error(Error.Probe.CannotHandleURLsAtTheMoment)
115115
| FileURI(_, vscodeUri) =>
116116
let path = VSCode.Uri.fsPath(vscodeUri)
117-
let result = await Connection__Process__Exec.run(path, ["--version"])
117+
let result = await Connection__Process__Exec.run(path, ["--version"], ~timeout=3000)
118118
switch result {
119119
| Ok(output) =>
120120
// try Agda

src/Connection/Shared/Connection__URI.res

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ let parse = raw => {
7272
}
7373
}
7474

75-
// Returns the original raw input string of the Connection URI.
76-
let getOriginalPath = uri =>
77-
switch uri {
78-
| FileURI(raw, _) => raw
79-
| LspURI(raw, _) => raw
80-
}
81-
8275
// // Extracts the VSCode.Uri from a FileURI variant, if possible.
8376
// // This is useful when you need to work with VSCode APIs that expect VSCode.Uri.t directly.
8477
// //

test/tests/Test__Connection.res

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe("Connection", () => {
105105
)
106106
})
107107

108-
describe("`probeFilepath`", () => {
108+
describe_only("`probeFilepath`", () => {
109109
let agdaMockPath = ref("")
110110
let alsMockPath = ref("")
111111

@@ -286,9 +286,15 @@ describe("Connection", () => {
286286

287287
let result = await Connection.probeFilepath(fileName)
288288

289+
// Normalize fileName through the same URI parsing process for consistent comparison
290+
let normalizedFileName = switch Connection__URI.parse(fileName) {
291+
| FileURI(_, vsCodeUri) => VSCode.Uri.fsPath(vsCodeUri)
292+
| LspURI(_, _) => fileName // fallback, shouldn't happen in this test
293+
}
294+
289295
switch result {
290296
| Ok(path, Error(alsVersion, agdaVersion, Some(lspOptions))) =>
291-
Assert.deepStrictEqual(path, fileName)
297+
Assert.deepStrictEqual(path, normalizedFileName)
292298
Assert.deepStrictEqual(alsVersion, "1.2.3")
293299
Assert.deepStrictEqual(agdaVersion, "2.6.4")
294300
// Should have Agda_datadir environment variable set

test/tests/Test__ShowGoals.res

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ let run = normalization => {
1515
)
1616

1717
let filteredResponses = responses->Array.filter(filteredResponse)
18-
Assert.deepStrictEqual(filteredResponses, [DisplayInfo(AllGoalsWarnings("*All Goals, Errors*", "?0 : ℕ\n?1 : ℕ\n?2 : ℕ\n?3 : _11\nSort _10 [ at /Users/banacorn/rescript/agda-mode-vscode/test/tests/assets/Goals.agda:11,19-31 ]\n_11 : _10 [ at /Users/banacorn/rescript/agda-mode-vscode/test/tests/assets/Goals.agda:11,19-31 ]\n_14 : ℕ [ at /Users/banacorn/rescript/agda-mode-vscode/test/tests/assets/Goals.agda:11,19-31 ]\n\n———— Error —————————————————————————————————————————————————\nUnsolved constraints"))])
18+
19+
let filepath = Path.asset(filename)
20+
let expectedAllGoalsWarningsBody = `?0 : ℕ\n?1 : ℕ\n?2 : ℕ\n?3 : _11\nSort _10 [ at ${filepath}:11,19-31 ]\n_11 : _10 [ at ${filepath}:11,19-31 ]\n_14 : ℕ [ at ${filepath}:11,19-31 ]\n\n———— Error —————————————————————————————————————————————————\nUnsolved constraints`
21+
22+
Assert.deepStrictEqual(
23+
filteredResponses,
24+
[DisplayInfo(AllGoalsWarnings("*All Goals, Errors*", expectedAllGoalsWarningsBody))],
25+
)
1926
})
2027

2128
Async.it("should work", async () => {

0 commit comments

Comments
 (0)