Skip to content

Commit

Permalink
style: use consistent wording for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Jun 26, 2024
1 parent b01ba59 commit cd590ef
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
12 changes: 6 additions & 6 deletions test/src/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@ suite('Diagnostics', () => {
)
}

test('Weeder error should be shown', async () => {
test('Shoudl show weeder error', async () => {
await testDiagnostics('WeederError.flix', "Multiple declarations of the formal parameter 'a'.")
})

test('Name error should be shown', async () => {
test('Shoudl show name error', async () => {
await testDiagnostics('NameError.flix', "Duplicate definition of 'sum'.")
})

test('Resolution error should be shown', async () => {
test('Shoudl show resolution error', async () => {
await testDiagnostics('ResolutionError.flix', "Cyclic type aliases: 'Even' references 'Odd' references 'Even'")
})

test('Type error should be shown', async () => {
test('Shoudl show type error', async () => {
await testDiagnostics('TypeError.flix', "Expected type 'String' but found type: 'Float64'.")
})

test('Redundancy error should be shown', async () => {
test('Shoudl show redundancy error', async () => {
await testDiagnostics('RedundancyError.flix', 'Shadowed name.')
})

test('Safety error should be shown', async () => {
test('Shoudl show safety error', async () => {
await testDiagnostics('SafetyError.flix', 'Missing default case.')
})
})
2 changes: 1 addition & 1 deletion test/src/disconnect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ suite('Server disconnect', () => {
await init('disconnect')
})

test('When server is disconnected a reconnection should happen automatically', async () => {
test('Should reconnect automatically when server is disconnected', async () => {
await vscode.commands.executeCommand('flix.simulateDisconnect')

// Wait for the server to disconnect, otherwise the next command will hang
Expand Down
8 changes: 4 additions & 4 deletions test/src/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ suite('File manipulation', () => {
return r.length === 0
}

test('Deleted source-file should be removed', async () => {
test('Should remove deleted source-file', async () => {
await deleteFile(areaDocUri)
assert.strictEqual(await workspaceValid(), false)
})

test('Created source-file should be added', async () => {
test('Should add created source-file', async () => {
const content = await vscode.workspace.fs.readFile(areaDocUri)
await deleteFile(areaDocUri)
await addFile(areaDocUri, content)
assert.strictEqual(await workspaceValid(), true)
})

test('Deleted fpkg-file should be removed', async () => {
test('Should remove deleted fpkg-file', async () => {
await deleteFile(fpkgUri)
assert.strictEqual(await workspaceValid(), false)
})

test('Created fpkg-file should be added', async () => {
test('Should add created fpkg-file', async () => {
const content = await vscode.workspace.fs.readFile(fpkgUri)
await deleteFile(fpkgUri)
await addFile(fpkgUri, content)
Expand Down
24 changes: 12 additions & 12 deletions test/src/goto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as assert from 'assert'
import * as vscode from 'vscode'
import { getTestDocUri, init } from './util'

suite('Goto definition', () => {
suite('Go to definition', () => {
const mainDocUri = getTestDocUri('src/Main.flix')
const areaDocUri = getTestDocUri('src/Area.flix')
const equatableDocUri = getTestDocUri('src/Equatable.flix')
Expand All @@ -28,7 +28,7 @@ suite('Goto definition', () => {
await init('goto')
})

test('Going to definition of empty line should not show anything', async () => {
test('Should not show anything when going to definition of empty line', async () => {
const position = new vscode.Position(0, 0)
const r = await vscode.commands.executeCommand<(vscode.Location | vscode.LocationLink)[]>(
'vscode.executeDefinitionProvider',
Expand Down Expand Up @@ -60,11 +60,11 @@ suite('Goto definition', () => {
assert.deepStrictEqual(receivedRange, expectedRange)
}

test('Go to area definition', async () => {
test('Should go to definition of area def', async () => {
await testGotoDefinition(mainDocUri, new vscode.Position(10, 12), areaDocUri, new vscode.Range(3, 4, 3, 8))
})

test('Go to Equatable.equals definition', async () => {
test('Should go to definition of Equatable.equals signature', async () => {
await testGotoDefinition(
equatableDocUri,
new vscode.Position(9, 51),
Expand All @@ -73,7 +73,7 @@ suite('Goto definition', () => {
)
})

test('Go to function parameter definition', async () => {
test('Should go to definition of x formal parameter', async () => {
await testGotoDefinition(
equatableDocUri,
new vscode.Position(7, 15),
Expand All @@ -82,7 +82,7 @@ suite('Goto definition', () => {
)
})

test('Go to match-extracted variable definition', async () => {
test('Should go to definition of v1 match-extracted variable', async () => {
await testGotoDefinition(
equatableDocUri,
new vscode.Position(9, 58),
Expand All @@ -91,7 +91,7 @@ suite('Goto definition', () => {
)
})

test('Go to let-bound variable definition', async () => {
test('Should go to definition of first let-bound variable', async () => {
await testGotoDefinition(
equatableDocUri,
new vscode.Position(22, 21),
Expand All @@ -100,23 +100,23 @@ suite('Goto definition', () => {
)
})

test('Go to case definition', async () => {
test('Should go to definition of Shape.Square enum case', async () => {
await testGotoDefinition(areaDocUri, new vscode.Position(12, 50), mainDocUri, new vscode.Range(4, 9, 4, 22))
})

test('Go to case definition from match-case', async () => {
test('Should go to definition of Shape.Square enum case from match-case', async () => {
await testGotoDefinition(areaDocUri, new vscode.Position(6, 19), mainDocUri, new vscode.Range(4, 9, 4, 22))
})

test('Go to enum definition', async () => {
test('Should go to definition of Shape enum', async () => {
await testGotoDefinition(areaDocUri, new vscode.Position(3, 12), mainDocUri, new vscode.Range(1, 0, 6, 1))
})

test('Go to effect definition', async () => {
test('Should go to definition of Rewind effect', async () => {
await testGotoDefinition(rewindDocUri, new vscode.Position(14, 30), rewindDocUri, new vscode.Range(2, 4, 2, 10))
})

test('Go to type-variable definition', async () => {
test('Should go to definition of t type-variable', async () => {
await testGotoDefinition(
equatableDocUri,
new vscode.Position(2, 22),
Expand Down
40 changes: 20 additions & 20 deletions test/src/highlight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ suite('Highlight uses', () => {
await init('highlight')
})

test('Empty line should not show anything', async () => {
test('Should not show anything on empty line', async () => {
const position = new vscode.Position(0, 0)
const r = await vscode.commands.executeCommand<vscode.DocumentHighlight[]>(
'vscode.executeDocumentHighlights',
Expand Down Expand Up @@ -58,42 +58,42 @@ suite('Highlight uses', () => {
}
}

test('Find Shape.Circle case highlights', async () => {
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(17, 17, 17, 29),
])
})
test('Find Shape.Circle case-use highlights', async () => {
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(17, 17, 17, 29),
])
})
test('Find Shape.Circle case-use from pattern match highlights', async () => {
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(17, 17, 17, 29),
])
})

test('Find area function highlights', async () => {
test('Should find highlights of area function', async () => {
await testHighlight(areaDocUri, new vscode.Position(3, 4), [
new vscode.Range(3, 4, 3, 8),
new vscode.Range(12, 39, 12, 43),
])
})
test('Find area function-use highlights', async () => {
test('Should find highlights of area function-use', async () => {
await testHighlight(areaDocUri, new vscode.Position(12, 39), [
new vscode.Range(3, 4, 3, 8),
new vscode.Range(12, 39, 12, 43),
])
})

test('Find Equatable.equals signature highlights', async () => {
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),
Expand All @@ -102,7 +102,7 @@ suite('Highlight uses', () => {
new vscode.Range(36, 18, 36, 24),
])
})
test('Find Equatable.equals signature-use highlights', async () => {
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),
Expand All @@ -112,82 +112,82 @@ suite('Highlight uses', () => {
])
})

test('Find Day type alias highlights', async () => {
test('Should find highlights of Day type alias', async () => {
await testHighlight(dateDocUri, new vscode.Position(18, 11), [
new vscode.Range(18, 11, 18, 14),
new vscode.Range(21, 23, 21, 26),
])
})

test('Find Aef associated effect highlights', async () => {
test('Should find highlights of Aef associated effect', async () => {
await testHighlight(dividableDocUri, new vscode.Position(6, 9), [
new vscode.Range(6, 9, 6, 12),
new vscode.Range(7, 33, 7, 46),
new vscode.Range(11, 9, 11, 12),
])
})

test('Find DivByZero effect highlights', async () => {
test('Should find highlights of DivByZero effect', async () => {
await testHighlight(dividableDocUri, new vscode.Position(1, 4), [
new vscode.Range(1, 4, 1, 13),
new vscode.Range(11, 15, 11, 24),
new vscode.Range(12, 45, 12, 54),
])
})

test('Find DivByZero.throw operation highlights', async () => {
test('Should find highlights of DivByZero.throw operation', async () => {
await testHighlight(dividableDocUri, new vscode.Position(2, 12), [
new vscode.Range(2, 12, 2, 17),
new vscode.Range(13, 23, 13, 38),
])
})
test('Find DivByZero.throw operation-use highlights', async () => {
test('Should find highlights of DivByZero.throw operation-use', async () => {
await testHighlight(dividableDocUri, new vscode.Position(13, 23), [
new vscode.Range(2, 12, 2, 17),
new vscode.Range(13, 23, 13, 38),
])
})

test('Find function parameter highlights', async () => {
test('Should find highlights of function parameter', async () => {
await testHighlight(equatableDocUri, new vscode.Position(6, 19), [
new vscode.Range(6, 19, 6, 20),
new vscode.Range(7, 15, 7, 16),
])
})
test('Find function parameter-use highlights', async () => {
test('Should find highlights of function parameter-use', async () => {
await testHighlight(equatableDocUri, new vscode.Position(7, 15), [
new vscode.Range(6, 19, 6, 20),
new vscode.Range(7, 15, 7, 16),
])
})

test('Find match-extracted variable highlights', async () => {
test('Should find highlights of match-extracted variable', async () => {
await testHighlight(equatableDocUri, new vscode.Position(9, 23), [
new vscode.Range(9, 23, 9, 25),
new vscode.Range(9, 58, 9, 60),
])
})
test('Find match-extracted variable-use highlights', async () => {
test('Should find highlights of match-extracted variable-use', async () => {
await testHighlight(equatableDocUri, new vscode.Position(9, 58), [
new vscode.Range(9, 23, 9, 25),
new vscode.Range(9, 58, 9, 60),
])
})

test('Find let-bound variable highlights', async () => {
test('Should find highlights of let-bound variable', async () => {
await testHighlight(equatableDocUri, new vscode.Position(20, 8), [
new vscode.Range(20, 8, 20, 13),
new vscode.Range(22, 21, 22, 26),
])
})
test('Find let-bound variable-use highlights', async () => {
test('Should find highlights of let-bound variable-use', async () => {
await testHighlight(equatableDocUri, new vscode.Position(22, 21), [
new vscode.Range(20, 8, 20, 13),
new vscode.Range(22, 21, 22, 26),
])
})

test('Find record label highlights', async () => {
test('Should find highlights of record label', async () => {
await testHighlight(recordsDocUri, new vscode.Position(3, 6), [
new vscode.Range(2, 13, 2, 14),
new vscode.Range(2, 48, 2, 49),
Expand Down
12 changes: 6 additions & 6 deletions test/src/hover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ suite('Hover info', () => {
await open(docUri)
})

test('Hovering on an empty line should not show anything', async () => {
test('Should not show anything when hovering on empty line', async () => {
const position = new vscode.Position(0, 0)
const r = await vscode.commands.executeCommand<vscode.Hover[]>('vscode.executeHoverProvider', docUri, position)
assert.strictEqual(r.length, 0)
Expand All @@ -52,27 +52,27 @@ suite('Hover info', () => {
assert.strictEqual(actual.includes(expected), true, `Actual: ${actual}\nExpected: ${expected}`)
}

test('Hovering on Unit should show Type', async () => {
test('Should show Type when hovering on Unit', async () => {
const position = new vscode.Position(9, 12)
await testHoverAtPosition(position, 'Type')
})

test('Hovering on IO should show Eff', async () => {
test('Should show Eff when hovering on IO', async () => {
const position = new vscode.Position(9, 19)
await testHoverAtPosition(position, 'Eff')
})

test('Hovering on Shape.Rectangle instantiation should show Shape', async () => {
test('Should show Shape when hovering on Shape.Rectangle instantiation', async () => {
const position = new vscode.Position(10, 13)
await testHoverAtPosition(position, 'Shape')
})

test('Hovering on area()-call should show def', async () => {
test('Should show def when hovering on area()-call', async () => {
const position = new vscode.Position(10, 12)
await testHoverAtPosition(position, 'def area(s: Shape): Int32')
})

test('Hovering on area()-call should show doc', async () => {
test('Should show doc when hovering on area()-call', async () => {
const position = new vscode.Position(10, 12)
await testHoverAtPosition(
position,
Expand Down
4 changes: 2 additions & 2 deletions test/src/implementation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ suite('Find implementations', () => {
await init('implementation')
})

test('Empty line should not show anything', async () => {
test('Should not show anything on empty line', async () => {
const position = new vscode.Position(0, 0)
const r = await vscode.commands.executeCommand<(vscode.Location | vscode.LocationLink)[]>(
'vscode.executeImplementationProvider',
Expand All @@ -47,7 +47,7 @@ suite('Find implementations', () => {
assert.deepStrictEqual(new Set(actualLocations), new Set(expectedLocations))
}

test('Find Dividable trait implementation', async () => {
test('Should find Dividable trait implementation', async () => {
await testImplementations(dividableDocUri, new vscode.Position(5, 6), [
new vscode.Location(dividableDocUri, new vscode.Range(10, 9, 10, 18)),
])
Expand Down
Loading

0 comments on commit cd590ef

Please sign in to comment.