Skip to content

Commit

Permalink
working tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Sep 19, 2012
1 parent 1d59432 commit 31e16fd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 22 deletions.
4 changes: 2 additions & 2 deletions test/scripts/commands/map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for x in `seq -w 1 20`; do
touch test.$x
done

moa map --np -t test
moa new map -t test
moa set process="echo {{ output }}; cp {{input}} {{ output }}"
moa set input="./test.*" output="./out.*"

Expand Down Expand Up @@ -39,7 +39,7 @@ 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 )
[[ ! "$output" =~ "out.02" ]] || (echo "invalid output 4" && false )
#echo $output


Expand Down
5 changes: 5 additions & 0 deletions test/scripts/commands/moa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# Test if moa works

moa -h

15 changes: 6 additions & 9 deletions test/scripts/commands/set.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/bin/bash

set -e
set -v

tmpdir=`mktemp -d`
cd $tmpdir
echo "Running in $PWD"

moa simple -t test -- echo
moa new simple -t test
moa set process='echo'
moa show | grep title | grep -q test
moa show | grep title | grep -vq otherwise
moa set title=otherwise
Expand All @@ -19,8 +15,9 @@ moa show | grep dummy | grep -q bla
#now try recursive loading of variables
mkdir 10.subdir
cd 10.subdir
moa simple -t subtest -- echo
moa show | grep dummy | grep -q bla
moa show | grep title | grep -q subtest\
moa new simple -t subtest
moa set process=echo
moa show -a | grep dummy | grep -q bla
moa show | grep title | grep -q subtest

rm -rf $tmpdir
5 changes: 3 additions & 2 deletions test/scripts/commands/show.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash

set -e
set -v
Expand All @@ -7,7 +7,8 @@ tmpdir=`mktemp -d`
cd $tmpdir
echo "Running in $PWD"

moa simple -t test -- echo
moa new simple -t test
moa set process='echo'
moa set process='echo blabla'
moa show | grep -q 'echo blabla'
moa show | grep 'title' | grep -q 'test'
Expand Down
5 changes: 3 additions & 2 deletions test/scripts/commands/simple.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash

set -e
set -v
Expand All @@ -7,7 +7,8 @@ tmpdir=`mktemp -d`
cd $tmpdir
echo "Running in $PWD"

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

Expand Down
17 changes: 10 additions & 7 deletions test/scripts/commands/unset.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
#!/bin/bash
#!/bin/bash

set -e
set -v
set -vex

tmpdir=`mktemp -d`
cd $tmpdir
echo "Running in $PWD"

moa simple -t test -- echo

moa new simple -t test
moa set process='echo'
moa show | grep 'title' | grep -q 'test'
moa unset title
moa show | grep 'title' | grep -qv 'test'
[[ ! `moa show | grep 'title' | grep -q 'test'` ]]
# recursive unset
moa set aaa=bbb
moa show | grep 'aaa' | grep -q 'bbb'
mkdir 10.sub
cd 10.sub
moa simple -t sub -- echo
moa new simple -t sub
moa set process=echo

moa set aaa=bbb
moa show | grep 'aaa' | grep -q 'bbb'
cd ..
moa unset -r aaa
moa show | grep -qv 'aaa'
cd 10.sub
moa show | grep -qv 'aaa'
moa show | grep -qv 'aaa'

rm -rf $tmpdir

0 comments on commit 31e16fd

Please sign in to comment.