Skip to content

Commit

Permalink
Test packages for #196
Browse files Browse the repository at this point in the history
  • Loading branch information
chochos committed Aug 5, 2013
1 parent f11ddd3 commit 6a1b5b0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/test/ceylon/metamodel/modules.ceylon
@@ -1,4 +1,5 @@
import ceylon.language.model { modules }
import ceylon.language.model.declaration { Import, FunctionDeclaration }
import check { check,fail }

void modulesTests() {
Expand All @@ -7,7 +8,22 @@ void modulesTests() {
check(modules.list nonempty, "Loaded modules");
check(modules.find("check", "0.1") exists, "Loaded module search");
if (exists funmod = modules.find("functions", "0.1")) {
print("``funmod.name``/``funmod.version`` loaded at runtime");
check(funmod.dependencies.size == 2, "functions/0.1 should have 2 deps");
check(funmod.dependencies.find((Import imp) => imp.name=="ceylon.language") exists,
"functions/0.1 should depend on ceylon.language");
check(funmod.dependencies.find((Import imp) => imp.name=="check") exists,
"functions/0.1 should depend on ceylon.language");
if (exists pk = funmod.findPackage("functions")) {
check(pk.name=="functions", "Package name should be functions");
check(pk.annotations<Shared>() nonempty, "Package should have annotations");
//TODO check it's shared
check(pk.getFunction("hello") exists, "Package has function hello");
//TODO should this be visible?
check(pk.getValue("lx") exists, "Package has value lx");
check(pk.getMember<FunctionDeclaration>("repeat") exists, "Package has member repeat");
} else {
fail("Module functions/0.1 should have package 'functions'");
}
} else {
fail("Runtime loading of module search");
}
Expand Down

0 comments on commit 6a1b5b0

Please sign in to comment.