[M3devel] quake extensions for tests / RFC
Olaf Wagner
wagner at elegosoft.com
Thu Jan 31 01:34:25 CET 2008
Hi,
I've added a utilities library package from the DCVS project and
a whole bunch of quake builtin functions based on it.
As I've often found that just the functions I'd need to express
something in quake without using platform dependent means (exec cmd)
are not available, I've now decided to add some.
Most of them are string and file system related. There are standard
text and text array functions, and functions that deal with files,
directories, and their content.
A third group are three new exec calls: one to execute a command list
with the usual redirection options known from shell; one to pipe
the contents of a quake variable to an external program, and one to
capture the contents of an external program in a quake variable
(shell's process or command substitution). I think they will be
rather useful.
I've also added some standard functions that were always missing in
quake: a generic len() function (length of text, array, table),
embedded quake code evaluation from a string (quake), and string
encode and decode (from libm3).
There are 80 short quake tests added in m3quake/test/src/m3makefile
which can be run by a simple `cm3 -build'.
Before I proceed, I'd like to hear comments about the interfaces
and functionality, and especially the function names (always the part
that takes most of the time in programming ;-). Several things could
probably be better named or improved by adding or altering some
parameters. Let me know what you think about it before these functions
get used in CM3 packages.
I'll write up an HTML documentation and add it to the existing quake
language description (which is already a bit old and needs an update)
on the WWW pages during the next days.
Find attached the function overview and tests.
Olaf
PS: Some things are still missing and may be added during the next weeks,
like directory stacks, system information access and pathname
functions.
--
Olaf Wagner -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23 45 86 96 mobile: +49 177 2345 869 fax: +49 30 23 45 86 95
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
-------------- next part --------------
system information
------------------
hostname() --> text
command execution
-----------------
q_exec( cmd ) --> int # execute with redirections (>, >>,...)
q_exec_put( cmd, text ) --> int # execute cmd with stdin from text
q_exec_get( cmd ) --> [int, text] # execute cmd and return output
text utilities
--------------
split( text, seps ) --> text[]
sub( text, off, len ) --> text
skipl( text ) --> text
skipr( text ) --> text
compress( text ) --> text
squeeze( text ) --> text
pos( text, text ) --> int
contains( text, text ) --> boolean
bool( text ) --> boolean
subst_chars( text, a, b ) --> text
del_chars( text, a, b ) --> text
subst( text, a, b, n ) --> text
subst_env( text ) --> text
add_prefix( text[], text ) --> text[]
add_suffix( text[], text ) --> text[]
file system utilities
---------------------
pn -> pathname: text
dir -> pn
( not yet; really needed?
pn_native( pn ) --> text
pn_posix( pn ) --> text
pn_win( pn ) --> text
pn_root( pn ) --> text
pn_sep() --> text
)
fs_exists( pn ) --> boolean
fs_readable( pn ) --> boolean
fs_writable( pn ) --> boolean
fs_executable( pn ) --> boolean
fs_isdir( pn ) --> boolean
fs_isfile( pn ) --> boolean
fs_lsdirs( pn, baseonly ) --> text[]
fs_lsfiles( pn, baseonly ) --> text[]
( fs_canonical_pn( pn ) --> text )
fs_touch( pn ) # update access time of file
fs_rm( pn ) # remove file
fs_rmdir( pn ) # remove dir
fs_rmrec( pn ) # remove dir and everything below
fs_mkdir( pn ) # create directories (mkdir -p)
fs_cp( pn, pn ) # copy file
fs_contents( pn ) --> text # return file contents as text
fs_putfile( pn, text ) # (over)write text into file
directory stack
---------------
( not yet
pushd( dir )
popd()
setwd( dir )
getwd() --> text
)
-------------- next part --------------
proc test( code, expected ) is
write( "quake(", code, ")", CR, "expected: ", expected, CR, "result: ")
quake( code )
write( CR )
end
proc quote( s ) is
return encode( s )
end
proc header( id ) is
write( CR, "------ " & id &
" ------------------------------------------------------------------",
CR )
end
proc section( name ) is
write( CR, CR, "---------------------------------------" &
"---------------------------------------", CR )
write( name )
write( CR, "---------------------------------------" &
"---------------------------------------", CR, CR )
end
oks = []
kos = []
proc summary() is
section( "summary" )
nok = len( oks )
nko = len( kos )
write( nok, " tests succeeded:", CR, oks, CR, CR )
write( nko, " tests failed:", CR, kos, CR )
end
proc check( id, code, expected ) is
header( id )
write( "quake(", quote(code), ")", CR, "expected: ",
sub(quote(expected), 0, 68), CR)
quake( code )
write( "result: " & sub(quote(res), 0, 68), CR )
if equal( res & "", expected & "")
write( "==> OK", CR )
oks += id
%return "T"
else
write( "==> FAILED", CR )
kos += id
%return ""
end
end
proc checkExec( id, code ) is
header( id )
write( "quake(", code, ") --> " )
quake( code )
if equal( res, 0 )
write( "OK", CR )
oks += id
else
write( "FAILED", CR )
kos += id
end
end
write( "quake extension tests", CR, CR )
proc findexe( cmd ) is
write( "findexe(" & cmd & ")", CR )
local paths = []
if equal( OS_TYPE, "WIN32" )
paths = split( $PATH, ";" )
else
paths = split( $PATH, ":" )
end
local p = ""
foreach p in paths
local pn = p & SL & cmd
if fs_isfile( pn ) and fs_executable( pn )
return pn
end
if equal( OS_TYPE, "WIN32" )
local ext = ""
foreach ext in [ "exe", "cmd", "bat" ]
local pne = pn & "." & ext
if fs_isfile( pne ) and fs_executable( pne )
return pne
end
end
end
end
return "false"
end
%-----------------------------------------------------------------------------
section( "string function tests" )
%tx = "x = 3 write(\"x = \" & x, CR)"
%test( tx, "x = 3" )
t = "a = \" \t ha ha\" res = skipl( a )"
check( "t001", t, "ha ha" )
t = "a = \" ha\" res = skipl( a )"
check( "t002", t, "ha" )
t = "a = \" ha \" res = skipr( a ) & \"x\""
check( "t003", t, " hax" )
t = "a = \" ha \" res = compress( a ) & \"x\""
check( "t004", t, "hax" )
t = "a = \"apple plum orange\" b = split(a, \" \") res = b[0] & b[2]"
check( "t005", t, "appleorange" )
t = "a = \"applepie\" res = sub(a, 5, 3)"
check( "t006", t, "pie" )
t = "a = \"applepie\" res = sub(a, 7, 3)"
check( "t007", t, "e" )
t = "a = \"a\n\n\nb\n\n\n\nc\n\" res = squeeze(a)"
check( "t008", t, "a\n\nb\n\nc\n" )
t = "a = \"applepie\" res = tcontains(a, \"pie\")"
check( "t009", t, "TRUE" )
t = "a = \"applepie\" res = tcontains(a, \"pies\")"
check( "t010", t, "" )
t = "a = \"applepie\" res = pos(a, \"pie\")"
check( "t011", t, 5 )
t = "a = \"applepie\" res = pos(a, \"pies\")"
check( "t012", t, "-1" )
t = "a = \"applepie\" n = pos(a, \"pie\") res = sub(a, n, 1)"
check( "t013", t, "p" )
t = "res = bool(\"true\")"
check( "t014", t, "TRUE")
t = "res = bool(\"tRuE\")"
check( "t015", t, "TRUE")
t = "res = bool(\"TRUE\")"
check( "t016", t, "TRUE")
t = "res = bool(\"y\")"
check( "t017", t, "TRUE")
t = "res = bool(\"yes\")"
check( "t018", t, "TRUE")
t = "res = bool(\"Y\")"
check( "t019", t, "TRUE")
t = "res = bool(\"YES \")"
check( "t020", t, "TRUE")
t = "res = bool(\"no\")"
check( "t021", t, "")
t = "res = bool(\"false\")"
check( "t022", t, "")
t = "res = bool(\"foo\")"
check( "t023", t, "")
t = "res = bool(\"0\")"
check( "t024", t, "")
t = "res = bool(\"1\")"
check( "t025", t, "TRUE")
t = "a = \"aabaacabbbaccbca\" res = subst_chars(a, \"b\", \"d\")"
check( "t026", t, "aadaacadddaccdca")
t = "a = \"aabaacabbbaccbca\" res = subst_chars(a, \"bc\", \"dd\")"
check( "t027", t, "aadaadadddadddda")
t = "a = \"aabaacabbbaccbca\" res = del_chars(a, \"b\")"
check( "t028", t, "aaaacaaccca")
t = "a = \"aabaacabbbaccbca\" res = del_chars(a, \"bc\")"
check( "t029", t, "aaaaaaa")
t = "a = \"aabaacabbbaaccbca\" res = subst(a, \"aa\", \" 42 \", 1)"
check( "t030", t, " 42 baacabbbaaccbca")
t = "a = \"aabaacabbbaaccbca\" res = subst(a, \"aa\", \" 42 \", 2)"
check( "t031", t, " 42 b 42 cabbbaaccbca")
t = "a = \"aabaacabbbaaccbca\" res = subst(a, \"aa\", \" 42 \", 99)"
check( "t032", t, " 42 b 42 cabbb 42 ccbca")
t = "a = [ \"a\", \"b\", \"c\" ] res = add_prefix(a, \"pre-\")"
check( "t033", t, [ "pre-a", "pre-b", "pre-c" ] )
t = "a = [ \"a\", \"b\", \"c\" ] res = add_suffix(a, \"-suf\")"
check( "t034", t, [ "a-suf", "b-suf", "c-suf" ] )
t = "a = \"0123456789\"res = len( a )"
check( "t035", t, "10")
t = "a = [ \"a\", \"b\", \"c\" ] res = len( a )"
check( "t036", t, "3")
t = "a = { \"a\" : \"b\", \"c\" : \"d\" } res = len( a )"
check( "t037", t, "2")
%-----------------------------------------------------------------------------
section( "large string tests" )
SP = " "
write( "16", SP )
b = "0123456789abcdef"
write( "32", SP )
b = b & b
write( "64", SP )
b = b & b
write( "128", SP )
b = b & b
write( "256", SP )
b = b & b
write( "512", SP )
b = b & b
write( "1k", SP )
b = b & b
write( "2k", SP )
b = b & b
write( "4k", SP )
b = b & b
write( "8k", SP )
b = b & b
write( "16k", SP )
b = b & b
write( "32k", SP )
b = b & b
write( "64k", SP )
b = b & b
write( "128k", SP )
b = b & b
write( "256k", SP )
b = b & b
write( "512k", SP )
b = b & b
write( "1m", SP )
b = b & b
write( "OK", CR )
t = "a = subst_chars(b, \"bc\", \"xy\") res = subst_chars(b, \"xy\", \"bc\")"
check( "t100", t, b)
t = "res = sub(del_chars(b, \"0123456789cdef\"), 0, 10)"
check( "t101", t, "ababababab")
t = "res = len( b )"
check( "t102", t, "1048576")
%-----------------------------------------------------------------------------
section( "file system tests" )
f = "res = fs_exists(\".\")"
check( "f001", f, "TRUE" )
f = "res = fs_exists(\"..\")"
check( "f002", f, "TRUE" )
f = "res = fs_exists(\"..\" & SL & \"src\")"
check( "f003", f, "TRUE" )
f = "res = fs_isdir(\".\")"
check( "f004", f, "TRUE" )
f = "res = fs_isdir(\"..\")"
check( "f005", f, "TRUE" )
f = "res = fs_isdir(\"..\" & SL & \"src\")"
check( "f006", f, "TRUE" )
f = "res = fs_isfile(\".\")"
check( "f007", f, "" )
f = "res = fs_isfile(\"..\")"
check( "f008", f, "" )
f = "res = fs_isfile(\"..\" & SL & \"src\")"
check( "f009", f, "" )
f = "res = fs_isfile(\"..\" & SL & \"src\" & SL & \"m3makefile\")"
check( "f010", f, "TRUE" )
f = "res = fs_isdir(\"..\" & SL & \"src\" & SL & \"m3makefile\")"
check( "f011", f, "" )
more = findexe( "more" )
f = "res = fs_executable( more )"
check( "f012", f, "TRUE" )
f = "res = fs_writable( more )"
check( "f013", f, "" )
f = "res = fs_writable(\"..\" & SL & \"src\" & SL & \"m3makefile\")"
check( "f014", f, "TRUE" )
%write( pn, CR )
cm3 = findexe( "cm3" )
%write( pn , CR )
orange = "orange" data = "line1\nline2\line3\n"
f = "fs_putfile( orange, data ) res = fs_contents( orange )"
check( "f015", f, data )
dirs = "a" & SL & "b"
dirs_0 = dirs & SL & "c"
dirs_1 = dirs & SL & "cc"
dirs_2 = dirs & SL & "ccc"
dirs_3 = "a" & SL & "bb"
fn_a = dirs_0 & SL & "a"
fn_b = dirs_0 & SL & "b"
fn_c = dirs_0 & SL & "c"
write( CR, "--------------------------------------", CR )
write( "dirs = ", dirs, CR )
write( "dirs_0 = ", dirs_0, CR )
write( "dirs_1 = ", dirs_1, CR )
write( "dirs_2 = ", dirs_2, CR )
write( "dirs_3 = ", dirs_3, CR )
write( "fn_a = ", fn_a, CR )
write( "fn_b = ", fn_b, CR )
write( "fn_c = ", fn_c, CR )
f = "fs_mkdir( dirs_0 ) res = fs_isdir( dirs_0 )"
check( "f016", f, "TRUE" )
f = "fs_mkdir( dirs_1 ) res = fs_isdir( dirs_1 )"
check( "f017", f, "TRUE" )
f = "fs_mkdir( dirs_2 ) res = fs_isdir( dirs_2 )"
check( "f018", f, "TRUE" )
f = "fs_mkdir( dirs_3 ) res = fs_isdir( dirs_3 )"
check( "f019", f, "TRUE" )
f = "res = fs_lsdirs( dirs, \"\" )"
check( "f020", f, [dirs_0, dirs_1, dirs_2] )
f = "res = fs_lsdirs( dirs, \"T\" )"
check( "f021", f, "c cc ccc" )
f = "fs_touch( fn_a ) res = fs_isfile( fn_a )"
check( "f022", f, "TRUE" )
f = "fs_touch( fn_b ) res = fs_isfile( fn_b )"
check( "f023", f, "TRUE" )
f = "fs_touch( fn_c ) res = fs_isfile( fn_c )"
check( "f024", f, "TRUE" )
f = "res = fs_lsfiles( dirs_0, \"\" )"
check( "f025", f, [fn_a, fn_b, fn_c] )
f = "res = fs_lsfiles( dirs_0, \"T\" )"
check( "f026", f, "a b c" )
f = "res = fs_lsfiles( dirs, \"T\" )"
check( "f027", f, "" )
f = "fs_rmfile(fn_b) res = fs_lsfiles( dirs_0, \"T\" )"
check( "f028", f, "a c" )
f = "fs_rmfile(fn_b) res = fs_lsfiles( dirs_0, \"T\" )"
check( "f029", f, "a c" )
f = "fs_rmdir(dirs_3) res = fs_lsdirs( \"a\", \"T\" )"
check( "f030", f, "b" )
f = "fs_rmdir(dirs_3) res = fs_lsdirs( \"a\", \"T\" )"
check( "f031", f, "b" )
f = "fs_rmrec(dirs) res = fs_lsdirs( \"a\", \"T\" )"
check( "f032", f, "" )
f = "fs_touch(dirs) res = fs_lsfiles( \"a\", \"T\" )"
check( "f033", f, "b" )
apple = "apple"
f = "fs_cp( orange, apple ) res = fs_contents( apple )"
check( "f034", f, data )
apple2 = "a" & SL & apple
f = "fs_cp( orange, apple2 ) res = fs_contents( apple2 )"
check( "f035", f, data )
f = "res = fs_lsfiles( \"a\", \"T\" )"
check( "f036", f, "b apple" )
f = "fs_rmfile(apple2) res = fs_lsfiles( \"a\", \"T\" )"
check( "f037", f, "b" )
%f = "fs_cp( orange, \"a\" ) res = fs_contents( apple2 )"
%check( "f038", f, data )
f = "fs_rmrec(\"a\") res = fs_lsdirs( \".\", \"T\" )"
check( "f099", f, "" )
%-----------------------------------------------------------------------------
section( "exec tests" )
header( "e001" )
res = q_exec_get( "ls -l" )
write( "rc = ", res[0], CR, "out = ", res[1], CR )
checkExec( "e002", "res = q_exec( \"cm3 -version > cm3.version\" )" )
checkExec( "e003", "res = q_exec( \"rm cm3.version\" )" )
header( "e004" )
a = "a\nb\n\c"
res = q_exec_put( "cat -", a )
write( CR, "tests done", CR )
summary()
-------------- next part --------------
--- building in FreeBSD4 ---
quake extension tests
------------------------------------------------------------------------------
string function tests
------------------------------------------------------------------------------
------ t001 ------------------------------------------------------------------
quake("a = \" \t ha ha\" res = skipl( a )")
expected: "ha ha"
result: "ha ha"
==> OK
------ t002 ------------------------------------------------------------------
quake("a = \" ha\" res = skipl( a )")
expected: "ha"
result: "ha"
==> OK
------ t003 ------------------------------------------------------------------
quake("a = \" ha \" res = skipr( a ) & \"x\"")
expected: " hax"
result: " hax"
==> OK
------ t004 ------------------------------------------------------------------
quake("a = \" ha \" res = compress( a ) & \"x\"")
expected: "hax"
result: "hax"
==> OK
------ t005 ------------------------------------------------------------------
quake("a = \"apple plum orange\" b = split(a, \" \") res = b[0] & b[2]")
expected: "appleorange"
result: "appleorange"
==> OK
------ t006 ------------------------------------------------------------------
quake("a = \"applepie\" res = sub(a, 5, 3)")
expected: "pie"
result: "pie"
==> OK
------ t007 ------------------------------------------------------------------
quake("a = \"applepie\" res = sub(a, 7, 3)")
expected: "e"
result: "e"
==> OK
------ t008 ------------------------------------------------------------------
quake("a = \"a\n\n\nb\n\n\n\nc\n\" res = squeeze(a)")
expected: "a\n\nb\n\nc\n"
result: "a\n\nb\n\nc\n"
==> OK
------ t009 ------------------------------------------------------------------
quake("a = \"applepie\" res = tcontains(a, \"pie\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t010 ------------------------------------------------------------------
quake("a = \"applepie\" res = tcontains(a, \"pies\")")
expected: ""
result: ""
==> OK
------ t011 ------------------------------------------------------------------
quake("a = \"applepie\" res = pos(a, \"pie\")")
expected: "5"
result: "5"
==> OK
------ t012 ------------------------------------------------------------------
quake("a = \"applepie\" res = pos(a, \"pies\")")
expected: "-1"
result: "-1"
==> OK
------ t013 ------------------------------------------------------------------
quake("a = \"applepie\" n = pos(a, \"pie\") res = sub(a, n, 1)")
expected: "p"
result: "p"
==> OK
------ t014 ------------------------------------------------------------------
quake("res = bool(\"true\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t015 ------------------------------------------------------------------
quake("res = bool(\"tRuE\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t016 ------------------------------------------------------------------
quake("res = bool(\"TRUE\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t017 ------------------------------------------------------------------
quake("res = bool(\"y\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t018 ------------------------------------------------------------------
quake("res = bool(\"yes\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t019 ------------------------------------------------------------------
quake("res = bool(\"Y\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t020 ------------------------------------------------------------------
quake("res = bool(\"YES \")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t021 ------------------------------------------------------------------
quake("res = bool(\"no\")")
expected: ""
result: ""
==> OK
------ t022 ------------------------------------------------------------------
quake("res = bool(\"false\")")
expected: ""
result: ""
==> OK
------ t023 ------------------------------------------------------------------
quake("res = bool(\"foo\")")
expected: ""
result: ""
==> OK
------ t024 ------------------------------------------------------------------
quake("res = bool(\"0\")")
expected: ""
result: ""
==> OK
------ t025 ------------------------------------------------------------------
quake("res = bool(\"1\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ t026 ------------------------------------------------------------------
quake("a = \"aabaacabbbaccbca\" res = subst_chars(a, \"b\", \"d\")")
expected: "aadaacadddaccdca"
result: "aadaacadddaccdca"
==> OK
------ t027 ------------------------------------------------------------------
quake("a = \"aabaacabbbaccbca\" res = subst_chars(a, \"bc\", \"dd\")")
expected: "aadaadadddadddda"
result: "aadaadadddadddda"
==> OK
------ t028 ------------------------------------------------------------------
quake("a = \"aabaacabbbaccbca\" res = del_chars(a, \"b\")")
expected: "aaaacaaccca"
result: "aaaacaaccca"
==> OK
------ t029 ------------------------------------------------------------------
quake("a = \"aabaacabbbaccbca\" res = del_chars(a, \"bc\")")
expected: "aaaaaaa"
result: "aaaaaaa"
==> OK
------ t030 ------------------------------------------------------------------
quake("a = \"aabaacabbbaaccbca\" res = subst(a, \"aa\", \" 42 \", 1)")
expected: " 42 baacabbbaaccbca"
result: " 42 baacabbbaaccbca"
==> OK
------ t031 ------------------------------------------------------------------
quake("a = \"aabaacabbbaaccbca\" res = subst(a, \"aa\", \" 42 \", 2)")
expected: " 42 b 42 cabbbaaccbca"
result: " 42 b 42 cabbbaaccbca"
==> OK
------ t032 ------------------------------------------------------------------
quake("a = \"aabaacabbbaaccbca\" res = subst(a, \"aa\", \" 42 \", 99)")
expected: " 42 b 42 cabbb 42 ccbca"
result: " 42 b 42 cabbb 42 ccbca"
==> OK
------ t033 ------------------------------------------------------------------
quake("a = [ \"a\", \"b\", \"c\" ] res = add_prefix(a, \"pre-\")")
expected: "pre-a pre-b pre-c"
result: "pre-a pre-b pre-c"
==> OK
------ t034 ------------------------------------------------------------------
quake("a = [ \"a\", \"b\", \"c\" ] res = add_suffix(a, \"-suf\")")
expected: "a-suf b-suf c-suf"
result: "a-suf b-suf c-suf"
==> OK
------ t035 ------------------------------------------------------------------
quake("a = \"0123456789\"res = len( a )")
expected: "10"
result: "10"
==> OK
------ t036 ------------------------------------------------------------------
quake("a = [ \"a\", \"b\", \"c\" ] res = len( a )")
expected: "3"
result: "3"
==> OK
------ t037 ------------------------------------------------------------------
quake("a = { \"a\" : \"b\", \"c\" : \"d\" } res = len( a )")
expected: "2"
result: "2"
==> OK
------------------------------------------------------------------------------
large string tests
------------------------------------------------------------------------------
16 32 64 128 256 512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1m OK
------ t100 ------------------------------------------------------------------
quake("a = subst_chars(b, \"bc\", \"xy\") res = subst_chars(b, \"xy\", \"bc\")")
expected: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012
result: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012
==> OK
------ t101 ------------------------------------------------------------------
quake("res = sub(del_chars(b, \"0123456789cdef\"), 0, 10)")
expected: "ababababab"
result: "ababababab"
==> OK
------ t102 ------------------------------------------------------------------
quake("res = len( b )")
expected: "1048576"
result: "1048576"
==> OK
------------------------------------------------------------------------------
file system tests
------------------------------------------------------------------------------
------ f001 ------------------------------------------------------------------
quake("res = fs_exists(\".\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ f002 ------------------------------------------------------------------
quake("res = fs_exists(\"..\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ f003 ------------------------------------------------------------------
quake("res = fs_exists(\"..\" & SL & \"src\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ f004 ------------------------------------------------------------------
quake("res = fs_isdir(\".\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ f005 ------------------------------------------------------------------
quake("res = fs_isdir(\"..\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ f006 ------------------------------------------------------------------
quake("res = fs_isdir(\"..\" & SL & \"src\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ f007 ------------------------------------------------------------------
quake("res = fs_isfile(\".\")")
expected: ""
result: ""
==> OK
------ f008 ------------------------------------------------------------------
quake("res = fs_isfile(\"..\")")
expected: ""
result: ""
==> OK
------ f009 ------------------------------------------------------------------
quake("res = fs_isfile(\"..\" & SL & \"src\")")
expected: ""
result: ""
==> OK
------ f010 ------------------------------------------------------------------
quake("res = fs_isfile(\"..\" & SL & \"src\" & SL & \"m3makefile\")")
expected: "TRUE"
result: "TRUE"
==> OK
------ f011 ------------------------------------------------------------------
quake("res = fs_isdir(\"..\" & SL & \"src\" & SL & \"m3makefile\")")
expected: ""
result: ""
==> OK
findexe(more)
------ f012 ------------------------------------------------------------------
quake("res = fs_executable( more )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f013 ------------------------------------------------------------------
quake("res = fs_writable( more )")
expected: ""
result: ""
==> OK
------ f014 ------------------------------------------------------------------
quake("res = fs_writable(\"..\" & SL & \"src\" & SL & \"m3makefile\")")
expected: "TRUE"
result: "TRUE"
==> OK
findexe(cm3)
------ f015 ------------------------------------------------------------------
quake("fs_putfile( orange, data ) res = fs_contents( orange )")
expected: "line1\nline2line3\n"
result: "line1\nline2line3\n"
==> OK
--------------------------------------
dirs = a/b
dirs_0 = a/b/c
dirs_1 = a/b/cc
dirs_2 = a/b/ccc
dirs_3 = a/bb
fn_a = a/b/c/a
fn_b = a/b/c/b
fn_c = a/b/c/c
------ f016 ------------------------------------------------------------------
quake("fs_mkdir( dirs_0 ) res = fs_isdir( dirs_0 )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f017 ------------------------------------------------------------------
quake("fs_mkdir( dirs_1 ) res = fs_isdir( dirs_1 )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f018 ------------------------------------------------------------------
quake("fs_mkdir( dirs_2 ) res = fs_isdir( dirs_2 )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f019 ------------------------------------------------------------------
quake("fs_mkdir( dirs_3 ) res = fs_isdir( dirs_3 )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f020 ------------------------------------------------------------------
quake("res = fs_lsdirs( dirs, \"\" )")
expected: "a/b/c a/b/cc a/b/ccc"
result: "a/b/c a/b/cc a/b/ccc"
==> OK
------ f021 ------------------------------------------------------------------
quake("res = fs_lsdirs( dirs, \"T\" )")
expected: "c cc ccc"
result: "c cc ccc"
==> OK
------ f022 ------------------------------------------------------------------
quake("fs_touch( fn_a ) res = fs_isfile( fn_a )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f023 ------------------------------------------------------------------
quake("fs_touch( fn_b ) res = fs_isfile( fn_b )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f024 ------------------------------------------------------------------
quake("fs_touch( fn_c ) res = fs_isfile( fn_c )")
expected: "TRUE"
result: "TRUE"
==> OK
------ f025 ------------------------------------------------------------------
quake("res = fs_lsfiles( dirs_0, \"\" )")
expected: "a/b/c/a a/b/c/b a/b/c/c"
result: "a/b/c/a a/b/c/b a/b/c/c"
==> OK
------ f026 ------------------------------------------------------------------
quake("res = fs_lsfiles( dirs_0, \"T\" )")
expected: "a b c"
result: "a b c"
==> OK
------ f027 ------------------------------------------------------------------
quake("res = fs_lsfiles( dirs, \"T\" )")
expected: ""
result: ""
==> OK
------ f028 ------------------------------------------------------------------
quake("fs_rmfile(fn_b) res = fs_lsfiles( dirs_0, \"T\" )")
expected: "a c"
result: "a c"
==> OK
------ f029 ------------------------------------------------------------------
quake("fs_rmfile(fn_b) res = fs_lsfiles( dirs_0, \"T\" )")
expected: "a c"
result: "a c"
==> OK
------ f030 ------------------------------------------------------------------
quake("fs_rmdir(dirs_3) res = fs_lsdirs( \"a\", \"T\" )")
expected: "b"
result: "b"
==> OK
------ f031 ------------------------------------------------------------------
quake("fs_rmdir(dirs_3) res = fs_lsdirs( \"a\", \"T\" )")
expected: "b"
result: "b"
==> OK
------ f032 ------------------------------------------------------------------
quake("fs_rmrec(dirs) res = fs_lsdirs( \"a\", \"T\" )")
expected: ""
result: ""
==> OK
------ f033 ------------------------------------------------------------------
quake("fs_touch(dirs) res = fs_lsfiles( \"a\", \"T\" )")
expected: "b"
result: "b"
==> OK
------ f034 ------------------------------------------------------------------
quake("fs_cp( orange, apple ) res = fs_contents( apple )")
expected: "line1\nline2line3\n"
result: "line1\nline2line3\n"
==> OK
------ f035 ------------------------------------------------------------------
quake("fs_cp( orange, apple2 ) res = fs_contents( apple2 )")
expected: "line1\nline2line3\n"
result: "line1\nline2line3\n"
==> OK
------ f036 ------------------------------------------------------------------
quake("res = fs_lsfiles( \"a\", \"T\" )")
expected: "b apple"
result: "b apple"
==> OK
------ f037 ------------------------------------------------------------------
quake("fs_rmfile(apple2) res = fs_lsfiles( \"a\", \"T\" )")
expected: "b"
result: "b"
==> OK
------ f099 ------------------------------------------------------------------
quake("fs_rmrec(\"a\") res = fs_lsdirs( \".\", \"T\" )")
expected: ""
result: ""
==> OK
------------------------------------------------------------------------------
exec tests
------------------------------------------------------------------------------
------ e001 ------------------------------------------------------------------
rc = 0
out = total 8
-rw-rw-r-- 1 wagner wheel 17 31 Jan 00:59 apple
-rw-rw-r-- 1 wagner wheel 17 29 Jan 18:43 ls-1
-rw-rw-r-- 1 wagner wheel 97 31 Jan 00:59 m3make.args
-rw-rw-r-- 1 wagner wheel 17 31 Jan 00:59 orange
------ e002 ------------------------------------------------------------------
quake(res = q_exec( "cm3 -version > cm3.version" )) --> OK
------ e003 ------------------------------------------------------------------
quake(res = q_exec( "rm cm3.version" )) --> OK
------ e004 ------------------------------------------------------------------
a
b
c
tests done
------------------------------------------------------------------------------
summary
------------------------------------------------------------------------------
80 tests succeeded:
t001 t002 t003 t004 t005 t006 t007 t008 t009 t010 t011 t012 t013 t014 t015 t016 t017 t018 t019 t020 t021 t022 t023 t024 t025 t026 t027 t028 t029 t030 t031 t032 t033 t034 t035 t036 t037 t100 t101 t102 f001 f002 f003 f004 f005 f006 f007 f008 f009 f010 f011 f012 f013 f014 f015 f016 f017 f018 f019 f020 f021 f022 f023 f024 f025 f026 f027 f028 f029 f030 f031 f032 f033 f034 f035 f036 f037 f099 e002 e003
0 tests failed:
More information about the M3devel
mailing list