diff --git a/languageserver/test/index.test.ts b/languageserver/test/index.test.ts index b73f5c32..47ce11f5 100644 --- a/languageserver/test/index.test.ts +++ b/languageserver/test/index.test.ts @@ -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"], ) ) @@ -288,7 +288,7 @@ describe("diagnostics", () => { access(all) fun main() { let r <- create R() - r[A] + let a = r[A] destroy r } `, @@ -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