X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=test.icl;h=dddfbe1a6c9d7473d65aa7aee81aef0e21f935c6;hb=dd851e8574c37cad729a3ba3b4e64a548bb4422e;hp=8a75a613f9a5a0e4e3eebbc7708613be17490c02;hpb=4334ca7b15eb33a8106a0085297c579130a0a64b;p=clean-tests.git diff --git a/test.icl b/test.icl index 8a75a61..dddfbe1 100644 --- a/test.icl +++ b/test.icl @@ -1,104 +1,20 @@ module test -import Debug.Trace -import iTasks +import StdEnv -import iTasks.Extensions.DateTime -import iTasks.UI.Layout.Minimal +import graph_copy_with_names, symbols_in_program +import System.CommandLine -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 +test :: !{#Symbol} a -> a +test symbols a + # (a, b, c) = copy_to_string_with_names a + # (a, r) = copy_from_string_with_names a b c symbols + = a - t5 = sequence [return i\\i<-[0..1000]] >>= viewInformation () [] - t6 = waitForTimer 10 +polyid :: (A.a: a -> a) -> (Int, Bool) +polyid f = (f 42, f True) - 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 -// )] [] - - -//import StdGeneric -// -//generic g a :: a -// -//g{|*|} = 42 - -//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) -*/ +Start w + # ([argv0:_], w) = getCommandLine w + # (symbols, w) = accFiles (read_symbols argv0) w + = test symbols (polyid id)