Skip to content

Commit

Permalink
adjust tests to new unused results analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Jun 12, 2024
1 parent 09b6943 commit 17cdcc2
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions languageserver/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,28 +250,28 @@ describe("diagnostics", () => {

test("script", async() =>
testCode(
`access(all) fun main() { X }`,
`access(all) fun main() { let x = X }`,
["cannot find variable in this scope: `X`. not found in this scope"]
)
)

test("script auth account", async() =>
testCode(
`access(all) fun main() { getAuthAccount<&Account>(0x01) }`,
`access(all) fun main() { let account = getAuthAccount<&Account>(0x01) }`,
[],
)
)

test("transaction", async() =>
testCode(
`transaction() { execute { X } }`,
`transaction() { execute { let x = X } }`,
["cannot find variable in this scope: `X`. not found in this scope"]
)
)

test("transaction auth account", async() =>
testCode(
`transaction() { execute { getAuthAccount<&Account>(0x01) } }`,
`transaction() { execute { let account = getAuthAccount<&Account>(0x01) } }`,
["cannot find variable in this scope: `getAuthAccount`. not found in this scope"],
)
)
Expand All @@ -288,7 +288,7 @@ describe("diagnostics", () => {
access(all)
fun main() {
let r <- create R()
r[A]
let a = r[A]
destroy r
}
`,
Expand All @@ -301,13 +301,25 @@ describe("diagnostics", () => {
`
access(all)
fun main() {
getAccount(0x1).capabilities.get
let get = getAccount(0x1).capabilities.get
}
`,
[]
)
)

test("unused result", async() =>
testCode(
`
access(all)
fun main() {
getAccount(0x1)
}
`,
["unused result"]
)
)

type TestDoc = {
name: string
code: string
Expand Down

0 comments on commit 17cdcc2

Please sign in to comment.