]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.osgi/scl/Commands/Tests.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.osgi / scl / Commands / Tests.scl
1 import "String" as String
2
3 importJava "org.simantics.scl.compiler.testing.TestRunnable" where
4     data Test
5     
6     @JavaName getName
7     nameOf :: Test -> String
8     @JavaName run
9     runSilent :: Test -> <Proc> ()
10
11 run :: Test -> <Proc> ()
12 run test = do
13     print "=== \(nameOf test) ======================================="
14     runSilent test
15
16 instance Show Test where
17     show = nameOf
18
19 importJava "org.simantics.scl.osgi.internal.TestUtils" where
20     @JavaName getTests
21     allTests :: <Proc> [Test]
22
23 list :: <Proc> ()
24 list = iter print allTests
25
26 runByName :: String -> <Proc> ()
27 runByName name =
28     for allTests (\test -> if nameOf test == name
29                            then run test
30                            else ())
31
32 runByPattern :: String -> <Proc> ()
33 runByPattern patternText = do
34     pattern = String.compile patternText
35     for allTests (\test -> if String.matches (String.matcher pattern (nameOf test))
36                            then run test
37                            else ())
38
39 runAll :: <Proc> ()
40 runAll = for allTests run
41
42 importJava "org.simantics.scl.osgi.internal.ModuleUtils" where
43     """
44     Tries to compile all modules in SCLOsgi context and prints
45     all compilation errors related to the modules.
46     """
47     validateModules :: <Proc> ()