| ... | ... | @@ -97,6 +97,24 @@ describe("extractTerminalLinks", () => { |
| 97 | 97 | }, |
| 98 | 98 | ]); |
| 99 | 99 | }); |
| 100 | |
| 101 | it("keeps a trailing colon on URLs", () => { |
| 102 | expect(extractTerminalLinks("GET https://example.test/items/foo:")).toEqual([ |
| 103 | { kind: "url", text: "https://example.test/items/foo:", start: 4, end: 35 }, |
| 104 | ]); |
| 105 | }); |
| 106 | |
| 107 | it.each([ |
| 108 | ["./main.go:10:5: undefined: x", "./main.go:10:5"], |
| 109 | ["/home/dev/app/src/main.c:10:5: error: expected ';'", "/home/dev/app/src/main.c:10:5"], |
| 110 | ["C:\\dev\\app\\src\\main.c:10:5: error: expected ';'", "C:\\dev\\app\\src\\main.c:10:5"], |
| 111 | ["wrote ./out/report.txt:", "./out/report.txt"], |
| 112 | ])("drops the colon that ends a compiler diagnostic location in %s", (line, text) => { |
| 113 | const start = line.indexOf(text); |
| 114 | expect(extractTerminalLinks(line)).toEqual([ |
| 115 | { kind: "path", text, start, end: start + text.length }, |
| 116 | ]); |
| 117 | }); |
| 100 | 118 | }); |
| 101 | 119 | |
| 102 | 120 | describe("collectWrappedTerminalLinkLine", () => { |
| ... | ... | @@ -173,6 +191,13 @@ describe("resolvePathLinkTarget", () => { |
| 173 | 191 | resolvePathLinkTarget("C:/Users/julius/project/src/main.ts:12", "C:\\Users\\julius\\project"), |
| 174 | 192 | ).toBe("C:/Users/julius/project/src/main.ts:12"); |
| 175 | 193 | }); |
| 194 | |
| 195 | it("keeps the line and column of a compiler diagnostic", () => { |
| 196 | const [link] = extractTerminalLinks("/Users/julius/project/main.c:10:5: error: expected ';'"); |
| 197 | expect(resolvePathLinkTarget(link?.text ?? "", "/Users/julius/project")).toBe( |
| 198 | "/Users/julius/project/main.c:10:5", |
| 199 | ); |
| 200 | }); |
| 176 | 201 | }); |
| 177 | 202 | |
| 178 | 203 | describe("isTerminalLinkActivation", () => { |