Skip to content

Commit e158728

Browse files
committed
Add test Makefile target
1 parent bd80a1d commit e158728

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
*.o
2-
/test
2+
/testprog

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ CXX = g++
66
WARN_FLAGS = -O3 -g -Wall -Wextra -Wabi -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wstrict-null-sentinel -Woverloaded-virtual -Wshadow -Wcast-align -Wpointer-arith -Wwrite-strings -Wundef -Wredundant-decls -Werror # -Weffc++
77
endif
88

9-
BIN = test
10-
OBJECTS = OptionParser.o test.o
9+
BIN = testprog
10+
OBJECTS = OptionParser.o testprog.o
1111

1212
$(BIN): $(OBJECTS)
1313
$(CXX) -o $@ $(OBJECTS) $(WARN_FLAGS) $(LINKFLAGS)
1414

1515
%.o: %.cpp OptionParser.h
1616
$(CXX) $(WARN_FLAGS) $(CXXFLAGS) -c $< -o $@
1717

18-
.PHONY: clean
18+
.PHONY: clean test
19+
20+
test: testprog
21+
./test.sh
1922

2023
clean:
2124
rm -f *.o $(BIN)

t/test renamed to t/testprog

File renamed without changes.

test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# vim: set filetype=sh fileencoding=utf-8 expandtab sw=4 sts=4:
44

55
c () {
6-
echo "$(printf "%q " ./test "$@")"
6+
echo "$(printf "%q " ./testprog "$@")"
77
local t_stdout_cpp=$(mktemp --tmpdir cpp-stdout-optparse.XXXXXXXXXX)
88
local t_stderr_cpp=$(mktemp --tmpdir cpp-stderr-optparse.XXXXXXXXXX)
99
local t_stdout_pyt=$(mktemp --tmpdir pyt-stdout-optparse.XXXXXXXXXX)
1010
local t_stderr_pyt=$(mktemp --tmpdir pyt-stderr-optparse.XXXXXXXXXX)
11-
./test "$@" >"$t_stdout_cpp" 2>"$t_stderr_cpp"
11+
./testprog "$@" >"$t_stdout_cpp" 2>"$t_stderr_cpp"
1212
status_cpp=$?
13-
./t/test "$@" >"$t_stdout_pyt" 2>"$t_stderr_pyt"
13+
./t/testprog "$@" >"$t_stdout_pyt" 2>"$t_stderr_pyt"
1414
status_pyt=$?
1515
if ! cmp -s "$t_stderr_cpp" "$t_stderr_pyt" ; then
1616
diff -u "$t_stderr_cpp" "$t_stderr_pyt"

test.cpp renamed to testprog.cpp

File renamed without changes.

0 commit comments

Comments
 (0)