Commit ec2cd1f6 authored by Bas Lijnse's avatar Bas Lijnse

Reorganized and cleaned up existing test programs

parent 5c311ff1
Pipeline #12243 failed with stage
in 2 minutes and 42 seconds
......@@ -114,7 +114,7 @@ testTaskOutput name task events exp comparison = {UnitTest|name=name,test=test}
where
test world
# (options,world) = defaultEngineOptions world
# iworld = createIWorld options world
# iworld = createIWorld {options & autoLayout = False} world
//Initialize JS compiler support
# (res,iworld) = initJSCompilerState iworld
| res =:(Error _)
......
module TestButton
import iTasks, iTasks.Internal.Test.Definition
import iTasks, iTasks.Util.Testing
test :: Task Bool
test = testEditor (button <<@ (textAttr "Click")) False Update
......
module TestSVGEditlet
import iTasks
import iTasks.Internal.Test.Definition
import iTasks.Util.Testing
import StdReal
......
module Misc
import iTasks.Internal.Test.Definition
Start world = execTestSuite (testsuite "Miscellaneous" "All tests that don't fit anywhere else, but should not get lost"
[jsonDecodeOfJSONField]) world
:: TestRecord =
{ a :: String
, b :: JSONNode
}
derive class iTask TestRecord
derive gPrettyTrace Maybe, TestRecord, JSONNode
jsonDecodeOfJSONField
= assertEqual "Encoding and decoding of record fields of type JSONNode with value JSONNull"
(Just rec)
(fromJSON (toJSON rec))
where
rec = {TestRecord|a = "Foo", b = JSONNull}
This diff is collapsed.
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/iTasks.Extensions.Process.UnitTests
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 2097152
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: False
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Project}*..*..*Libraries
Path: {Application}*lib*Dynamics
Path: {Application}*lib*GraphCopy
Path: {Application}*lib*Sapl
Path: {Application}*lib*StdEnv
Path: {Application}*lib*TCPIP
Path: {Application}*lib*Platform
Path: {Application}*lib*Platform/Deprecated/StdLib
Precompile:
Postlink:
MainModule
Name: iTasks.Extensions.Process.UnitTests
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/iTasks.Internal.IWorld.UnitTests
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 20971520
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: False
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Project}*..*..*Libraries
Path: {Application}*lib*Dynamics
Path: {Application}*lib*GraphCopy
Path: {Application}*lib*Sapl
Path: {Application}*lib*StdEnv
Path: {Application}*lib*TCPIP
Path: {Application}*lib*Platform
Path: {Application}*lib*Platform/Deprecated/StdLib
Precompile:
Postlink:
MainModule
Name: iTasks.Internal.IWorld.UnitTests
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/iTasks.Internal.TaskStore.UnitTests
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 20971520
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: False
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Project}*..*..*Libraries
Path: {Application}*lib*Dynamics
Path: {Application}*lib*GraphCopy
Path: {Application}*lib*Sapl
Path: {Application}*lib*StdEnv
Path: {Application}*lib*TCPIP
Path: {Application}*lib*Platform
Path: {Application}*lib*Platform/Deprecated/StdLib
Precompile:
Postlink:
MainModule
Name: iTasks.Internal.TaskStore.UnitTests
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/iTasks.UI.Layout.UnitTests
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 20971520
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: False
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Project}*..*..*Libraries
Path: {Application}*lib*Dynamics
Path: {Application}*lib*GraphCopy
Path: {Application}*lib*Sapl
Path: {Application}*lib*StdEnv
Path: {Application}*lib*TCPIP
Path: {Application}*lib*Platform
Path: {Application}*lib*Platform/Deprecated/StdLib
Precompile:
Postlink:
MainModule
Name: iTasks.UI.Layout.UnitTests
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/iTasks.WF.Tasks.Core.UnitTests
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 20971520
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: False
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Project}*..*..*Libraries
Path: {Application}*lib*Dynamics
Path: {Application}*lib*GraphCopy
Path: {Application}*lib*Sapl
Path: {Application}*lib*StdEnv
Path: {Application}*lib*TCPIP
Path: {Application}*lib*Platform
Path: {Application}*lib*Platform/Deprecated/StdLib
Precompile:
Postlink:
MainModule
Name: iTasks.WF.Tasks.Core.UnitTests
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
module iTasks.Internal.IWorld.UnitTests
import iTasks.Util.Testing
import iTasks.Internal.IWorld
testInitIWorld = assertWorld "Init IWorld" id sut
where
sut world
# (options,world) = defaultEngineOptions world
# iworld = createIWorld options world
//Check some properties
//# res = server.paths.dataDirectory == appDir </> "TEST-data"//Is the data directory path correctly initialized
# world = destroyIWorld iworld
= (True,world)
tests = [testInitIWorld]
Start world = runUnitTests tests world
module iTasks.Internal.TaskStore.UnitTests
import iTasks.Util.Testing
import iTasks.Internal.IWorld
import iTasks.Internal.TaskStore
import Data.Error
testCreateTaskInstance = assertWorld "Create task instance" isOk sut
where
sut world
# (options,world) = defaultEngineOptions world
# iworld = createIWorld options world
//Create a task instance
# (res,iworld) = createTaskInstance minimalTask iworld
# world = destroyIWorld iworld
= (res,world)
minimalTask = viewInformation () [] "TEST"
tests = [testCreateTaskInstance]
Start world = runUnitTests tests world
module iTasks.WF.Tasks.Core.UnitTests
import iTasks.Util.Testing
import qualified Data.Map as DM
import Data.Either
import Text.GenJSON
derive JSONEncode TaskOutputMessage
//Test interact
expPromptUI msg
= uiac UIContainer
('DM'.fromList [("marginTop",JSONInt 5),("marginRight",JSONInt 5),("marginBottom",JSONInt 10),("marginLeft",JSONInt 5)
,("width",JSONString "flex"),("minWidth",JSONString "wrap"),("height",JSONString "wrap")])
[uia UITextView ('DM'.fromList [("value",JSONString msg)])]
minimalInteractUI = testTaskOutput "Initial UI of minimal interaction task" task events exp checkEqual
where
task :: Task ((),String)
task = interact "TEST" Update unitShare handlers gEditor{|*|}
handlers = {onInit = \() -> ((),"Hello world"), onEdit = \_ l v -> (l,v,Nothing), onRefresh = \_ l v -> (l,v,Nothing)}
events = [Left ResetEvent]
exp = [TOUIChange (ReplaceUI expMinimalEditorUI)]
expMinimalEditorUI
= uic UIInteract [expPromptUI "TEST",editor]
where
editor = uia UITextField ('DM'.fromList
[("hint-type",JSONString "valid")
,("editorId",JSONString "v")
,("hint",JSONString "You have correctly entered a single line of text")
,("optional",JSONBool False)
,("mode",JSONString "update")
,("taskId",JSONString "1-0")
,("value",JSONString "Hello world")
])
tests = [minimalInteractUI]
Start world = runUnitTests tests world
......@@ -6,9 +6,9 @@ sed -i "s|{Application}/lib/iTasks|$(pwd)/Libraries|g" /opt/clean/etc/IDEEnvs
#Try to compile everything
find . -name "*.prj.default" | while read f; do
mv "$f" "$(dirname $f)/$(basename -s .prj.default $f)".prj
cp "$f" "$(dirname $f)/$(basename -s .prj.default $f)".prj
done
find . -name "*.prj" | xargs dirname | sort -u | xargs -I{} sh -c "cd {}; cpm make"
find . -name "*.prj" -exec dirname {} \; | sort -u | xargs -I{} sh -c "cd {}; cpm make"