Skip to content

Commit

Permalink
test: update tests for changed ranges (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Aug 19, 2024
1 parent 970d644 commit 386fded
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 32 deletions.
20 changes: 10 additions & 10 deletions test/src/findReferences.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ suite('Find references', () => {
test('Should find references to Equatable.equals signature', async () => {
await testFindReferences(equatableDocUri, new vscode.Position(2, 12), [
new vscode.Location(equatableDocUri, new vscode.Range(2, 12, 2, 18)),
new vscode.Location(equatableDocUri, new vscode.Range(9, 51, 9, 57)),
new vscode.Location(equatableDocUri, new vscode.Range(22, 14, 22, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(29, 14, 29, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(36, 18, 36, 24)),
new vscode.Location(equatableDocUri, new vscode.Range(43, 18, 43, 24)),
new vscode.Location(equatableDocUri, new vscode.Range(9, 41, 9, 57)),
new vscode.Location(equatableDocUri, new vscode.Range(22, 4, 22, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(29, 4, 29, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(36, 8, 36, 24)),
new vscode.Location(equatableDocUri, new vscode.Range(43, 8, 43, 24)),
])
})
test('Should find references to Equatable.equals signature-use', async () => {
await testFindReferences(equatableDocUri, new vscode.Position(29, 14), [
new vscode.Location(equatableDocUri, new vscode.Range(2, 12, 2, 18)),
new vscode.Location(equatableDocUri, new vscode.Range(9, 51, 9, 57)),
new vscode.Location(equatableDocUri, new vscode.Range(22, 14, 22, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(29, 14, 29, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(36, 18, 36, 24)),
new vscode.Location(equatableDocUri, new vscode.Range(43, 18, 43, 24)),
new vscode.Location(equatableDocUri, new vscode.Range(9, 41, 9, 57)),
new vscode.Location(equatableDocUri, new vscode.Range(22, 4, 22, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(29, 4, 29, 20)),
new vscode.Location(equatableDocUri, new vscode.Range(36, 8, 36, 24)),
new vscode.Location(equatableDocUri, new vscode.Range(43, 8, 43, 24)),
])
})

Expand Down
34 changes: 15 additions & 19 deletions test/src/highlight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as assert from 'assert'
import * as vscode from 'vscode'
import { getTestDocUri, init, stringify } from './util'
import { getTestDocUri, init } from './util'

suite('Highlight uses', () => {
const mainDocUri = getTestDocUri('src/Main.flix')
Expand Down Expand Up @@ -49,33 +49,27 @@ suite('Highlight uses', () => {

const actualRanges = r.map(h => h.range)

// TODO: Require that they match exactly (https://github.com/flix/flix/issues/7742)
for (const expectedRange of expectedRanges) {
assert.ok(
actualRanges.some(r => r.isEqual(expectedRange)),
`Expected range ${stringify(expectedRange)} not found in ${stringify(actualRanges)}`,
)
}
assert.deepStrictEqual(new Set(actualRanges), new Set(expectedRanges))
}

test('Should find highlights of Shape.Circle case', async () => {
await testHighlight(mainDocUri, new vscode.Position(3, 9), [
new vscode.Range(3, 9, 3, 22),
new vscode.Range(12, 52, 12, 58),
new vscode.Range(12, 46, 12, 58),
new vscode.Range(17, 17, 17, 29),
])
})
test('Should find highlights of Shape.Circle case-use', async () => {
await testHighlight(mainDocUri, new vscode.Position(12, 52), [
new vscode.Range(3, 9, 3, 22),
new vscode.Range(12, 52, 12, 58),
new vscode.Range(12, 46, 12, 58),
new vscode.Range(17, 17, 17, 29),
])
})
test('Should find highlights of Shape.Circle case-use from pattern match', async () => {
await testHighlight(mainDocUri, new vscode.Position(17, 23), [
new vscode.Range(3, 9, 3, 22),
new vscode.Range(12, 52, 12, 58),
new vscode.Range(12, 46, 12, 58),
new vscode.Range(17, 17, 17, 29),
])
})
Expand All @@ -96,19 +90,21 @@ suite('Highlight uses', () => {
test('Should find highlights of Equatable.equals signature', async () => {
await testHighlight(equatableDocUri, new vscode.Position(2, 12), [
new vscode.Range(2, 12, 2, 18),
new vscode.Range(9, 51, 9, 57),
new vscode.Range(22, 14, 22, 20),
new vscode.Range(29, 14, 29, 20),
new vscode.Range(36, 18, 36, 24),
new vscode.Range(9, 41, 9, 57),
new vscode.Range(22, 4, 22, 20),
new vscode.Range(29, 4, 29, 20),
new vscode.Range(36, 8, 36, 24),
new vscode.Range(43, 8, 43, 24),
])
})
test('Should find highlights of Equatable.equals signature-use', async () => {
await testHighlight(equatableDocUri, new vscode.Position(29, 20), [
new vscode.Range(2, 12, 2, 18),
new vscode.Range(9, 51, 9, 57),
new vscode.Range(22, 14, 22, 20),
new vscode.Range(29, 14, 29, 20),
new vscode.Range(36, 18, 36, 24),
new vscode.Range(9, 41, 9, 57),
new vscode.Range(22, 4, 22, 20),
new vscode.Range(29, 4, 29, 20),
new vscode.Range(36, 8, 36, 24),
new vscode.Range(43, 8, 43, 24),
])
})

Expand Down
8 changes: 5 additions & 3 deletions test/src/rename.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,26 @@ suite('Rename', () => {
assert.deepStrictEqual(new Set(actualRangesString), new Set(expectedRangesString))
}

test('Should rename Shape.Circle case', async () => {
/////// See https://github.com/flix/flix/issues/8355 ///////
test.skip('Should rename Shape.Circle case', async () => {
await testRename(mainDocUri, new vscode.Position(3, 9), [
[mainDocUri, [new vscode.Range(3, 9, 3, 15), new vscode.Range(12, 52, 12, 58), new vscode.Range(17, 17, 17, 29)]],
[areaDocUri, [new vscode.Range(5, 13, 5, 25)]],
])
})
test('Should rename Shape.Circle case-use', async () => {
test.skip('Should rename Shape.Circle case-use', async () => {
await testRename(mainDocUri, new vscode.Position(12, 52), [
[mainDocUri, [new vscode.Range(3, 9, 3, 15), new vscode.Range(12, 52, 12, 58), new vscode.Range(17, 17, 17, 29)]],
[areaDocUri, [new vscode.Range(5, 13, 5, 25)]],
])
})
test('Should rename Shape.Circle case-use from pattern match', async () => {
test.skip('Should rename Shape.Circle case-use from pattern match', async () => {
await testRename(mainDocUri, new vscode.Position(17, 23), [
[mainDocUri, [new vscode.Range(3, 9, 3, 15), new vscode.Range(12, 52, 12, 58), new vscode.Range(17, 17, 17, 29)]],
[areaDocUri, [new vscode.Range(5, 13, 5, 25)]],
])
})
////////////////////////////////////////////////////////////

test('Should rename area function', async () => {
await testRename(areaDocUri, new vscode.Position(3, 4), [
Expand Down

0 comments on commit 386fded

Please sign in to comment.