Skip to content

Commit

Permalink
Test importing missing modules wrt namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
0xd34df00d committed Dec 14, 2023
1 parent 6e0d9c4 commit 2570dd3
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pact-core-tests/Pact/Core/Test/StaticErrorTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,40 @@ staticTests =
(use m)
)
|])
, ("import_unknown_module_namespaced_self", isDesugarError _NoSuchModule, [text|
(env-data { "carl-keys" : ["carl"], "carl.carl-keys": ["carl"] })
(env-keys ["carl"])

(define-namespace 'carl (read-keyset 'carl-keys) (read-keyset 'carl-keys))
(namespace 'carl)
(module m g (defcap g () true)
(use carl.m)
)
|])
, ("import_unknown_module_namespaced_self_nons", isExecutionError _ModuleDoesNotExist, [text|
(env-data { "carl-keys" : ["carl"], "carl.carl-keys": ["carl"] })
(env-keys ["carl"])

(define-namespace 'carl (read-keyset 'carl-keys) (read-keyset 'carl-keys))
(namespace 'carl)
(module m g (defcap g () true)
(use m)
)
|])
, ("import_unknown_module_namespaced_outside", isDesugarError _NoSuchModule, [text|
(begin-tx)
(env-data { "carl-keys" : ["carl"], "carl.carl-keys": ["carl"] })
(env-keys ["carl"])

(define-namespace 'carl (read-keyset 'carl-keys) (read-keyset 'carl-keys))
(namespace 'carl)
(module m g (defcap g () true))
(commit-tx)

(module n ng (defcap ng () true)
(use carl.n)
)
|])
]

tests :: TestTree
Expand Down

0 comments on commit 2570dd3

Please sign in to comment.