-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automated tests for
sheet
command (#210)
* Add automated tests for `sheet` command * Fix last column not loaded/displayed --------- Co-authored-by: liquidaty <[email protected]>
- Loading branch information
Showing
9 changed files
with
89 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,11 +45,18 @@ BUILD_DIR=${THIS_LIB_BASE}/build/${BUILD_SUBDIR}/${CCBN} | |
TMP_DIR=${THIS_LIB_BASE}/tmp | ||
TEST_DATA_DIR=${THIS_LIB_BASE}/data | ||
|
||
SOURCES= echo count count-pull select select-pull sql 2json serialize flatten pretty desc stack 2db 2tsv jq compare | ||
SOURCES=echo count count-pull select select-pull sql 2json serialize flatten pretty desc stack 2db 2tsv jq compare | ||
TARGETS=$(addprefix ${BUILD_DIR}/bin/zsv_,$(addsuffix ${EXE},${SOURCES})) | ||
|
||
TESTS=test-blank-leading-rows $(addprefix test-,${SOURCES}) test-rm test-mv test-2json-help | ||
|
||
ifeq ($(ZSV_BUILD_SHEET),1) | ||
SOURCES+=sheet | ||
CFLAGS+=-DZSV_BUILD_SHEET | ||
CFLAGS+=${CFLAGS_NCURSES} | ||
LDFLAGS+=${LDFLAGS_NCURSES} | ||
endif | ||
|
||
COLOR_NONE=\033[0m | ||
COLOR_GREEN=\033[1;32m | ||
COLOR_RED=\033[1;31m | ||
|
@@ -549,3 +556,36 @@ test-compare: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} | |
@(${PREFIX} $< ../../data/compare/t1.csv ../../data/compare/t2.csv --add AccentCity --sort -k country -k city ${REDIRECT1} ${TMP_DIR}/[email protected] && \ | ||
${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${TEST_PASS} || ${TEST_FAIL}) | ||
|
||
test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv | ||
@${TEST_INIT} | ||
@(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ | ||
tmux set-window-option -t test-sheet prefix none && \ | ||
sleep 0.5 && \ | ||
tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ | ||
tmux send-keys -t $@ "q" && \ | ||
${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) | ||
|
||
@(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ | ||
tmux set-window-option -t test-sheet prefix none && \ | ||
sleep 0.5 && \ | ||
tmux send-keys -t $@ "C-F" && \ | ||
tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/[email protected] && \ | ||
tmux send-keys -t $@ "q" && \ | ||
${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${TEST_PASS} || ${TEST_FAIL}) | ||
|
||
@(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ | ||
tmux set-window-option -t test-sheet prefix none && \ | ||
sleep 0.5 && \ | ||
tmux send-keys -t $@ "C-F" "C-F" "C-B" && \ | ||
tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/[email protected] && \ | ||
tmux send-keys -t $@ "q" && \ | ||
${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${TEST_PASS} || ${TEST_FAIL}) | ||
|
||
@(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ | ||
tmux set-window-option -t test-sheet prefix none && \ | ||
sleep 0.5 && \ | ||
tmux send-keys -t $@ "f" "sarmaj" Enter && \ | ||
sleep 0.5 && \ | ||
tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/[email protected] && \ | ||
tmux send-keys -t $@ "q" && \ | ||
${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${TEST_PASS} || ${TEST_FAIL}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Row # Country City AccentCit Region Populatio Latitude Longitude | ||
1 ir sarmaj-e Sarmaj-e 13 34.3578 47.5207 | ||
2 ad aixirival Aixirival 06 42.466666 1.5 | ||
3 mm mokho-atw Mokho-atw 09 18.033333 96.75 | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Row # Country City AccentCit Region Populatio Latitude Longitude | ||
4 id selingon Selingon 17 -8.8374 116.4914 | ||
5 ir berimvand Berimvand 13 34.2953 47.1096 | ||
6 pl chomiaza Chomiaza 73 52.7508 17.841793 | ||
4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Row # Country City AccentCit Region Populatio Latitude Longitude | ||
1 ir sarmaj-e Sarmaj-e 13 34.3578 47.5207 | ||
|
||
|
||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters