Merge branch 'master' of git.martlubbers.net:clean-tests
authorMart Lubbers <mart@martlubbers.net>
Fri, 21 Sep 2018 07:03:17 +0000 (09:03 +0200)
committerMart Lubbers <mart@martlubbers.net>
Fri, 21 Sep 2018 07:03:17 +0000 (09:03 +0200)
filepicker/prj [new file with mode: 0644]
filepicker/test.icl
filepickerbas/test.icl [new file with mode: 0644]
runtasks/test.dcl [new file with mode: 0644]
runtasks/test.icl [new file with mode: 0644]
shared_selection/test.icl [new file with mode: 0644]

diff --git a/filepicker/prj b/filepicker/prj
new file mode 100644 (file)
index 0000000..ff38448
--- /dev/null
@@ -0,0 +1,3 @@
+\e[?25l\e[J\e[J\e[J\e[J\e[J\e[J\e[34h\e[?25h\e[?1049h\e[?1h\e=\e[1;54r\e[23m\e[24m\e[0m\e[H\e[J\e[?25l\e[54;1H"Clean System Files" is a directory\e[2;1H\e[1m\e[34m~                                                                                                                                                                    \e[3;1H~                                                                                                                                                                    \e[4;1H~                                                                                                                                                                    \e[5;1H~                                                                                                                                                                    \e[6;1H~                                                                                                                                                                    \e[7;1H~                                                                                                                                                                    \e[8;1H~                                                                                                                                                                    \e[9;1H~                                                                                                                                                                    \e[10;1H~                                                                                                                                                                    \e[11;1H~                                                                                                                                                                    \e[12;1H~                                                                                                                                                                    \e[13;1H~                                                                                                                                                                    \e[14;1H~                                                                                                                                                                    \e[15;1H~                                                                                                                                                                    \e[16;1H~                                                                                                                                                                    \e[17;1H~                                                                                                                                                                    \e[18;1H~                                                                                                                                                                    \e[19;1H~                                                                                                                                                                    \e[20;1H~                                                                                                                                                                    \e[21;1H~                                                                                                                                                                    \e[22;1H~                                                                                                                                                                    \e[23;1H~                                                                                                                                                                    \e[24;1H~                                                                                                                                                                    \e[25;1H~                                                                                                                                                                    \e[26;1H~                                                                                                                                                                    \e[27;1H~                                                                                                                                                                    \e[28;1H~                                                                                                                                                                    \e[29;1H~                                                                                                                                                                    \e[30;1H~                                                                                                                                                                    \e[31;1H~                                                                                                                                                                    \e[32;1H~                                                                                                                                                                    \e[33;1H~                                                                                                                                                                    \e[34;1H~                                                                                                                                                                    \e[35;1H~                                                                                                                                                                    \e[36;1H~                                                                                                                                                                    \e[37;1H~                                                                                                                                                                    \e[38;1H~                                                                                                                                                                    \e[39;1H~                                                                                                                                                                    \e[40;1H~                                                                                                                                                                    \e[41;1H~                                                                                                                                                                    \e[42;1H~                                                                                                                                                                    \e[43;1H~                                                                                                                                                                    \e[44;1H~                                                                                                                                                                    \e[45;1H~                                                                                                                                                                    \e[46;1H~                                                                                                                                                                    \e[47;1H~                                                                                                                                                                    \e[48;1H~                                                                                                                                                                    \e[49;1H~                                                                                                                                                                    \e[50;1H~                                                                                                                                                                    \e[51;1H~                                                                                                                                                                    \e[52;1H~                                                                                                                                                                    \e[53;1H~                                                                                                                                                                    \e[1;1H\e[34h\e[?25h\e[?25l\e[0m\e[54;1H\e[1m-- VISUAL --\e[0m\e[54;13H\e[K\e[1;1H\e[34h\e[?25h\a\e[?25l\e[34h\e[?25h\e[?25l\e[34h\e[?25h\a\e[?25l\e[34h\e[?25h\e[?25l\e[34h\e[?25h\e[?25l\e[34h\e[?25h\e[?25l\e[54;1H\e[K\e[1;1H\e[34h\e[?25h\e[?25l\e[54;1HType  :qa!  and press <Enter> to abandon all changes and exit Vim\a\e[1;1H\e[34h\e[?25h\e[?25l\e[34h\e[?25h\e[?25l\e[34h\e[?25h\e[?25l\e[34h\e[?25h\a\a\e[54;1H\e[?1l\e>\e[?1049lVim: Error reading input, exiting...\r
+Vim: Finished.\r
+\e[54;1H\e[34h\e[?25h6 files to edit
index f308b33..a306d2c 100644 (file)
@@ -1,83 +1,8 @@
 module test
 
-from StdFunc import seq, seqList, :: St
-import StdFunctions
-import System.Directory
-import System.File
-import System.FilePath
-import Data.Tuple
-import Data.Func
-import Data.Bifunctor
-import iTasks
-import iTasks.Internal.Util
+import iTasks.Extensions.Files
 
-derive class iTask RTree, FileInfo, Tm
-
-Start w = startEngine
-       (viewSharedInformation () []
-               $ mapRead (map fst)
-               $ sdsFocus "/opt/clean/lib/StdLib" directoryShare
-       ) w
-
-instance toString OSError where toString (_, e) = e
-instance Bifunctor MaybeError
-where
-       bifmap fa fb (Error a) = Error (fa a)
-       bifmap fa fb (Ok b) = Ok (fb b)
-       first fa fab = bifmap fa id fab
-       second fb fab = bifmap id fb fab
-
-selectFile :: FilePath -> Task FilePath
-selectFile root = get (sdsFocus root directoryShare)
-       >>= \cs->withShared (RNode root (map fst cs)) \tree->
-       editSelectionWithShared () False selectOption (mapRead numberTree tree)
-               (\tree->[i\\(i, (f, _))<-leafs tree])
-
-selectFile :: !FilePath !d !Bool [FilePath]-> Task [FilePath] | toPrompt d
-selectFile root prompt multi initial
-       = accWorld (createDirectoryTree root) @ numberTree
-       >>= \tree->editSelection prompt multi selectOption tree
-               [i\\(i, (f, _))<-leafs tree | elem f initial]
-where
-       selectOption = SelectInTree
-               (\tree->[{foldTree fp2cn tree & label=root}])
-               (\tree sel->[f\\(i, (f, _))<-leafs tree | isMember i sel])
-
-       fp2cn (i, (fp, mfi)) cs =
-               { id = case mfi of
-                       Error e = ~i
-                       Ok {directory=True} = ~i
-                       _ = i
-               , label=dropDirectory fp
-               , icon=Nothing
-               , expanded=False
-               , children=cs
-               }
-
-       numberTree :: ((RTree a) -> RTree (Int, a))
-       numberTree = flip evalState zero o foldTree \a cs->
-               (\lvs i->RNode (i, a) lvs) <$> 'CM'.sequence cs <*> getState <* modify inc
-       
-
-       
-       
-       
-       = 
-
-directoryShare :: ROShared FilePath [(FilePath, MaybeOSError FileInfo)]
-directoryShare = SDSSource {SDSSource | name = "directoryShare", read = read, write=write}
-where
-       read p iw
-               # (merr, iw) = liftIWorld (readDirectory p) iw
-               | isError merr = (liftError (first exception merr), iw)
-               # (Ok files) = merr
-               # (fis, iw) = liftIWorld (seqList (map getFileInfo files)) iw
-               = (Ok $ sortBy fst [(f, fi)\\f<-files & fi<-fis], iw)
-
-       write p w iw = (Ok (const (const False)), iw)
-//import iTasks
-//import iTasks.Extensions.Files
-//
-//Start w = startEngine (
-//     selectFile "/opt/clean/lib" () False []
-//     >&> viewSharedInformation "Selection" []) w
+Start w = startEngine (
+       selectFileTreeLazy "select a file" False "/opt/clean"
+       -&&- selectFileTree False "select a file" False "/opt/clean"[]
+       >&> viewSharedInformation "selection" []) w
diff --git a/filepickerbas/test.icl b/filepickerbas/test.icl
new file mode 100644 (file)
index 0000000..c77ef2a
--- /dev/null
@@ -0,0 +1,6 @@
+module test
+
+import iTasks
+import iTasks.Extensions.FileDialog
+
+Start w = startEngine (editFilePath "bork" (Action "Ok") (Just "/opt/clean")) w
diff --git a/runtasks/test.dcl b/runtasks/test.dcl
new file mode 100644 (file)
index 0000000..a102fe3
--- /dev/null
@@ -0,0 +1,6 @@
+definition module test
+
+class c c
+where
+       m1 :: c
+       m2 :: c
diff --git a/runtasks/test.icl b/runtasks/test.icl
new file mode 100644 (file)
index 0000000..e84c95e
--- /dev/null
@@ -0,0 +1,7 @@
+implementation module test
+
+class c c
+where
+       m1 :: c
+
+Start = 42
diff --git a/shared_selection/test.icl b/shared_selection/test.icl
new file mode 100644 (file)
index 0000000..4ac4faa
--- /dev/null
@@ -0,0 +1,17 @@
+module test
+
+import Data.Func, StdFunctions, iTasks
+
+derive gDefault ChoiceNode
+
+Start w = flip startEngine w $
+       withShared 5 \sharedInt->
+       withShared [] \sharedSel->
+       editSharedSelectionWithShared "test" False
+               (SelectInTree
+                       (\l->[{defaultValue & id=i,label=toString i}\\i<-[0..l]])
+                       (\_ s->s)
+               ) sharedInt sharedSel
+       -|| updateSharedInformation "Number of items" [] sharedInt
+       -|| updateSharedInformation "Current selection" [] sharedSel
+       >&> viewSharedInformation "Current task value" [] o mapRead toSingleLineText