bork
[clean-tests.git] / test.icl
index 99d51e1..8a75a61 100644 (file)
--- a/test.icl
+++ b/test.icl
@@ -1,9 +1,104 @@
 module test
 
+import Debug.Trace
 import iTasks
+
 import iTasks.Extensions.DateTime
+import iTasks.UI.Layout.Minimal
+
+Start w = doTasksWithOptions opt w2 w
+where
+       t :: Task DateTime
+       t = waitForTimer 7
+       t2 :: Task Int
+       t2 = enterInformation () [] >>= viewInformation () []
+       t3 :: Task String 
+       t3 = withShared 3 \sh->
+               withTemporaryDirectory (viewInformation () [])
+               >>= viewInformation () []
+       t4 = updateInformation () [] 42
+
+       t5 = sequence [return i\\i<-[0..1000]] >>= viewInformation () []
+       t6 = waitForTimer 10
+
+       t7 :: Int -> Task Int
+       t7 i = viewInformation () [] i >>= \x->t7 (x + 1)
+
+       t8 = viewInformation () [] 1
+               >>= \_->(viewInformation () [] 2
+               >>= \_->viewInformation () [] 3
+               >>= \_->viewInformation () [] 4)
+
+       p = parallel [(Embedded, \_->waitForTimer 5)] []
+       p1 = waitForTimer 5 -||- waitForTimer 10
+       p2 = withShared 3 \sh->watch sh
+
+       w1 = withShared 0 \sds -> (watch sds @? trace_stdout) -&&- updateInformation () [] 0 -&&- updateSharedInformation () [] sds
+
+       w2 = withShared 0 \sds ->
+                     updateSharedInformation () [] sds
+               -&&- (whileUnchanged sds (viewInformation () []) @? trace_stdout)
+
+       w3 = forever (viewInformation () [] 32) @? trace_stdout
+       
+       opt args eo = Ok eo
+//     opt args eo = Ok {eo & autoLayout=False}
+
+/*
+//import StdEnv
+//import Data.Error
+//import Data.Maybe
+//import Network.IP
+//import System.Socket
+//import System.Socket.Ipv4
+////import System.Select
+//
+from Data.Map import singleton
+import Data.Map.GenJSON
+//import Data.Func
+import iTasks
+
+import iTasks.Extensions.Files
+
+//Start w = doTasks (onStartup (copyFile "/home/mrl/test.txt" "/home/mrl/test2.txt")) w
+//Start w = doTasks (onStartup (workAs SystemUser (return 42))) w 
+Start w = doTasks t w
+
+t = viewInformation () [] ()
+       >>* [OnAction ActionOk (always (return ()))
+           ,OnAction ActionQuit (always (return ()))
+               ]
+
+//Start w = doTasks t w
+//
+//t :: Task [(Int, TaskValue Int)]
+//t = parallel
+//     [(Embedded, \stl->
+//             appendTask Embedded (\_->viewInformation "Int" [] 42) stl
+//             >>! \i->set (singleton "focus" "true") (sdsFocus i (taskListEntryMeta stl))
+//             >>~ \_->viewSharedInformation "Parallel task list" []
+//                     (sdsFocus {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=True,includeProgress=True,includeAttributes=True} stl)
+//             @! 42
+//     )] []
+
 
-Start w = doTasks (onStartup t) w
+//import StdGeneric
+//
+//generic g a :: a
+//
+//g{|*|} = 42
 
-t :: Task Int
-t = throw "bork"
+//Start :: *World -> (MaybeOSError String, *World)
+//Start w
+//     = case socket SocketStream w of
+//             (Error e, w) = (Error e, w)
+//             (Ok sockfd, w)
+//                     #! (merr, sockfd) = connect {ipv4_socket_port=8124,ipv4_socket_addr=Just (fromString "127.0.0.1")} sockfd
+//                     | isError merr = (liftError merr, w)
+//                     #! (merr, sockfd) = recv 128 [] sockfd
+//                     | isError merr = (merr, w)
+//                     # (Ok msg) = merr
+//                     # (merr, w) = close sockfd w
+//                     | isError merr = (liftError merr, w)
+//                     = (Ok msg, w)
+*/