diff --git a/CMakeLists.txt b/CMakeLists.txt index 115c018..36a90b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,12 +65,12 @@ file(GLOB_RECURSE incorrect_use_cases "doc/examples/incorrect/use-case-*.b" ) enable_testing() foreach(test ${correct_use_cases}) add_test(NAME ${test} - COMMAND ${CMAKE_SOURCE_DIR}/compile.sh ${test} + COMMAND ${CMAKE_SOURCE_DIR}/run.sh ${test} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endforeach() foreach(test ${incorrect_use_cases}) add_test(NAME ${test} - COMMAND ${CMAKE_SOURCE_DIR}/compile.sh ${test} + COMMAND ${CMAKE_SOURCE_DIR}/run.sh ${test} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) set_tests_properties(${test} PROPERTIES WILL_FAIL TRUE) endforeach() diff --git a/compile.sh b/compile.sh index addb62c..aad1d4d 100755 --- a/compile.sh +++ b/compile.sh @@ -5,9 +5,3 @@ if [ ! -d "bin" ]; then fi cmake --build bin --clean-first - -if [ -f "$1" ]; then - cat "$1" | ./bin/BFBCompiler -else - echo "$1" | ./bin/BFBCompiler -fi diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..77bbaa6 --- /dev/null +++ b/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ ! -d "bin" ]; then + sh compile.sh +fi + +if [ -f "$1" ]; then + cat "$1" | ./bin/BFBCompiler +else + echo "$1" | ./bin/BFBCompiler +fi