Browse Source

Fix the eunit-test-dir test on Windows

It was using os:cmd("echo ...") which on Windows preserves
spaces. One possible fix would have been to remove the space,
but I instead removed the use of os:cmd("echo ...") to avoid
similar issues in the future.
Loïc Hoguin 6 years ago
parent
commit
abaa729b46
1 changed files with 2 additions and 2 deletions
  1. 2 2
      test/plugin_eunit.mk

+ 2 - 2
test/plugin_eunit.mk

@@ -312,7 +312,7 @@ eunit-test-dir: init
 		"-module($(APP))." \
 		"-module($(APP))." \
 		"-ifdef(TEST)." \
 		"-ifdef(TEST)." \
 		"-include_lib(\"eunit/include/eunit.hrl\")." \
 		"-include_lib(\"eunit/include/eunit.hrl\")." \
-		"log_test() -> os:cmd(\"echo $(APP) >> eunit.log\")." \
+		"log_test() -> file:write_file(\"eunit.log\", \"$(APP)\n\", [append])." \
 		"-endif." > $(APP)/src/$(APP).erl
 		"-endif." > $(APP)/src/$(APP).erl
 
 
 	$i "Generate a module containing EUnit tests in TEST_DIR"
 	$i "Generate a module containing EUnit tests in TEST_DIR"
@@ -320,7 +320,7 @@ eunit-test-dir: init
 	$t printf "%s\n" \
 	$t printf "%s\n" \
 		"-module($(APP)_tests)." \
 		"-module($(APP)_tests)." \
 		"-include_lib(\"eunit/include/eunit.hrl\")." \
 		"-include_lib(\"eunit/include/eunit.hrl\")." \
-		"log_test() -> os:cmd(\"echo $(APP)_tests >> eunit.log\")." > $(APP)/test/$(APP)_tests.erl
+		"log_test() -> file:write_file(\"eunit.log\", \"$(APP)_tests\n\", [append])." > $(APP)/test/$(APP)_tests.erl
 
 
 	$i "Check that EUnit runs both tests"
 	$i "Check that EUnit runs both tests"
 	$t $(MAKE) -C $(APP) eunit | grep -c "2 tests passed." | grep -q 1
 	$t $(MAKE) -C $(APP) eunit | grep -c "2 tests passed." | grep -q 1