Skip to content

Commit

Permalink
command tests from moa simple & moa map [#16]
Browse files Browse the repository at this point in the history
  • Loading branch information
mfiers committed Apr 1, 2011
1 parent 9392b8b commit 64feb64
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions lib/python/moa/plugin/adhoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def defineCommands(data):
'desc' : 'Create a "simple" adhoc analysis',
'call' : createSimple,
'needsJob' : False,
'usage' : 'moa simple -t "title" -- echo "do something"'
'usage' : 'moa simple -t "title" -- echo "do something"',
'unittest' : SIMPLETEST
}
data['commands']['map'] = {
'desc' : 'Create a "map" adhoc analysis',
Expand Down Expand Up @@ -360,7 +361,11 @@ def createAdhoc(data):
parameters=params)



SIMPLETEST = '''
moa simple --np -t test -- echo "something"
out=`moa run`
[[ "$out" =~ "something" ]] || (echo "invalid output" && false )
'''

MAPTEST = '''
for x in `seq -w 1 20`; do
Expand All @@ -370,6 +375,16 @@ def createAdhoc(data):
moa set process="echo {{ output }}; cp {{input}} {{ output }}"
moa set input="./test.*" output="./out.*"
output=`moa run 2>&1`
[[ "$output" =~ "out\.1" ]] || (echo "invalid output 1" && false )
echo $output
# out.01 should be in the output (since it was processed)
[[ "$output" =~ "out.01" ]] || (echo "invalid output 1" && false )
output=`moa run 2>&1`
# out.01 should not be in the output (it was already processed last time)
[[ ! "$output" =~ "out.01" ]] || (echo "invalid output 2" && false )
touch test.01
output=`moa run 2>&1`
# out.01 should be in the output (it was touched since the last process)
[[ "$output" =~ "out.01" ]] || (echo "invalid output 3" && false )
# but out.02 not
[[ ! "$output" =~ "out.02" ]] || (echo "invalid output 4" && false )
#echo $output
'''

0 comments on commit 64feb64

Please sign in to comment.