Skip to content

Commit 324242e

Browse files
committed
fix test
1 parent b4b4e4d commit 324242e

2 files changed

Lines changed: 58 additions & 6 deletions

File tree

internal/cadence/lint_test.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,42 @@ func setupMockState(t *testing.T) *flowkit.State {
682682
}
683683
`), 0644)
684684

685+
_ = afero.WriteFile(mockFs, "ConformanceProvider.cdc", []byte(`
686+
access(all) contract ConformanceProvider {
687+
access(all) resource interface Greeter {
688+
access(all) fun greet(): String
689+
}
690+
init() {}
691+
}
692+
`), 0644)
693+
694+
_ = afero.WriteFile(mockFs, "ConformanceUser.cdc", []byte(`
695+
import "ConformanceProvider"
696+
access(all) contract ConformanceUser {
697+
access(all) resource MyGreeter: ConformanceProvider.Greeter {
698+
access(all) fun greet(): String { return "hi" }
699+
}
700+
init() {}
701+
}
702+
`), 0644)
703+
704+
_ = afero.WriteFile(mockFs, "EntitlementProvider.cdc", []byte(`
705+
access(all) contract EntitlementProvider {
706+
access(all) entitlement Admin
707+
init() {}
708+
}
709+
`), 0644)
710+
711+
_ = afero.WriteFile(mockFs, "EntitlementUser.cdc", []byte(`
712+
import "EntitlementProvider"
713+
access(all) contract EntitlementUser {
714+
access(all) resource Admin {
715+
access(EntitlementProvider.Admin) fun doAdminStuff() {}
716+
}
717+
init() {}
718+
}
719+
`), 0644)
720+
685721
_ = afero.WriteFile(mockFs, "TransactionImportingContractWithNestedImports.cdc", []byte(`
686722
import ContractWithNestedImports from "ContractWithNestedImports"
687723
@@ -713,6 +749,22 @@ func setupMockState(t *testing.T) *flowkit.State {
713749
Name: "Scheduler",
714750
Location: "Scheduler.cdc",
715751
})
752+
state.Contracts().AddOrUpdate(config.Contract{
753+
Name: "ConformanceProvider",
754+
Location: "ConformanceProvider.cdc",
755+
})
756+
state.Contracts().AddOrUpdate(config.Contract{
757+
Name: "ConformanceUser",
758+
Location: "ConformanceUser.cdc",
759+
})
760+
state.Contracts().AddOrUpdate(config.Contract{
761+
Name: "EntitlementProvider",
762+
Location: "EntitlementProvider.cdc",
763+
})
764+
state.Contracts().AddOrUpdate(config.Contract{
765+
Name: "EntitlementUser",
766+
Location: "EntitlementUser.cdc",
767+
})
716768

717769
return state
718770
}

internal/cadence/linter.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ import (
4242
)
4343

4444
type linter struct {
45-
checkers map[string]*sema.Checker
46-
exportedIdentifiers map[string][]ast.Identifier
47-
state *flowkit.State
48-
checkerStandardConfig *sema.Config
49-
checkerScriptConfig *sema.Config
50-
currentLocation common.Location
45+
checkers map[string]*sema.Checker
46+
exportedIdentifiers map[string][]ast.Identifier
47+
state *flowkit.State
48+
checkerStandardConfig *sema.Config
49+
checkerScriptConfig *sema.Config
50+
currentLocation common.Location
5151
}
5252

5353
type positionedError interface {

0 commit comments

Comments
 (0)