Skip to content

Commit

Permalink
_test: add tests for -e argument (#165)
Browse files Browse the repository at this point in the history
Refs #149
  • Loading branch information
quasilyte authored Dec 31, 2020
1 parent c3a2dac commit 62e3173
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _test/install/binary_gopath/expected2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/root/target.go:8:10: e: add((1), 2)
/root/target.go:9:10: e: add(1, (2))
3 changes: 3 additions & 0 deletions _test/install/binary_gopath/test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ go get -v -u github.com/quasilyte/ruleguard-rules-test
./ruleguard -rules /root/rules.go /root/target.go &> actual.txt || true
diff -u actual.txt /root/expected.txt

./ruleguard -e 'm.Match(`$f($*_, ($x), $*_)`)' /root/target.go &> actual.txt || true
diff -u actual.txt /root/expected2.txt

echo SUCCESS
2 changes: 2 additions & 0 deletions _test/install/binary_nogopath/expected2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/root/target.go:8:10: e: add((1), 2)
/root/target.go:9:10: e: add(1, (2))
3 changes: 3 additions & 0 deletions _test/install/binary_nogopath/test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ go get -v -u github.com/quasilyte/ruleguard-rules-test@master
./ruleguard -rules rules.go /root/target.go &> actual.txt || true
diff -u actual.txt /root/expected.txt

./ruleguard -e 'm.Match(`$f($*_, ($x), $*_)`)' /root/target.go &> actual.txt || true
diff -u actual.txt /root/expected2.txt

echo SUCCESS
2 changes: 2 additions & 0 deletions _test/install/gitclone/expected5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/root/target.go:8:10: e: add((1), 2)
/root/target.go:9:10: e: add(1, (2))
3 changes: 3 additions & 0 deletions _test/install/gitclone/test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ diff -u actual.txt /root/expected3.txt
./go-ruleguard -enable 'testrules/boolExprSimplify' -rules /root/rules2.go /root/target.go &> actual.txt || true
diff -u actual.txt /root/expected4.txt

./go-ruleguard -e 'm.Match(`$f($*_, ($x), $*_)`)' /root/target.go &> actual.txt || true
diff -u actual.txt /root/expected5.txt

echo SUCCESS

0 comments on commit 62e3173

Please sign in to comment.