From 6a1b5b0a024fa3ddc1864c702dc8ed8d2a4fd257 Mon Sep 17 00:00:00 2001 From: Enrique Zamudio Date: Mon, 5 Aug 2013 13:22:19 -0500 Subject: [PATCH] Test packages for #196 --- src/test/ceylon/metamodel/modules.ceylon | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/ceylon/metamodel/modules.ceylon b/src/test/ceylon/metamodel/modules.ceylon index e91101a7..802da989 100644 --- a/src/test/ceylon/metamodel/modules.ceylon +++ b/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() { @@ -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() 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("repeat") exists, "Package has member repeat"); + } else { + fail("Module functions/0.1 should have package 'functions'"); + } } else { fail("Runtime loading of module search"); }