todotxt / todo.txt-cli

☑️ A simple and extensible shell script for managing your todo.txt file.
http://todotxt.org
GNU General Public License v3.0
5.58k stars 714 forks source link

Spaces in directory cause problems with tests #275

Closed NightFlyer closed 3 years ago

NightFlyer commented 5 years ago

Currently, spaces in the directory path of the test directory cause tests to fail because test-lib.sh doesn't correctly quote the directory path.

What is the current behavior? Tests fail because test-lib.sh doesn't handle spaces in a directory path correctly.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior? That the test framework work.

Which versions todo.sh are you using? It's just the test framework.

Which Operating System are you using? Mac 10.13.6

Which version of bash are you using? GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)

esijg commented 3 years ago

Can confirm that this is still a problem. See output of make test.

This is on a Fedora 33 and the directory in question is "Sóttar Skrár" which is the official icelandic translation of the "Downloads" directory.


[esi@melkorka todo.txt-cli]$ make test
rm -rf tests/test-results "tests/trash directory"*
cd tests && ./t0000-config.sh 
sed: can't read /home/esi/Sóttar: No such file or directory
sed: can't read skrár/todo.txt-cli/tests/../todo.cfg: No such file or directory
*   ok 1: no config file
*   ok 2: config file (default location 1)
*   ok 3: config file (default location 2)
*   ok 4: config file (default location 3)
*   ok 5: config file (global config file)
*   ok 6: config file (command line)
*   ok 7: config file (env variable)
*   ok 8: config file (minimal)
./test-lib.sh: line 416: $test_results_path: ambiguous redirect
./test-lib.sh: line 417: $test_results_path: ambiguous redirect
./test-lib.sh: line 418: $test_results_path: ambiguous redirect
./test-lib.sh: line 419: $test_results_path: ambiguous redirect
./test-lib.sh: line 420: $test_results_path: ambiguous redirect
./test-lib.sh: line 421: $test_results_path: ambiguous redirect
* passed all 8 test(s)
cd tests && ./t0001-null.sh 
sed: can't read /home/esi/Sóttar: No such file or directory
sed: can't read skrár/todo.txt-cli/tests/../todo.cfg: No such file or directory
* FAIL 1: null ls

    todo.sh ls > output && test_cmp expect output

* FAIL 2: null list

    todo.sh list > output && test_cmp expect output

* FAIL 3: null list filter

    todo.sh list filter > output && test_cmp expect output

* FAIL 4: null lsp

    todo.sh lsp > output && test_cmp expect output

* FAIL 5: null listpri

    todo.sh listpri > output && test_cmp expect output

* FAIL 6: null listpri a

    todo.sh listpri a > output && test_cmp expect output

* FAIL 7: null lsa

    todo.sh lsa > output && test_cmp expect output

* FAIL 8: null list

    todo.sh listall > output && test_cmp expect output

* FAIL 9: null list filter

    todo.sh listall filter > output && test_cmp expect output

* FAIL 10: null lsc

    todo.sh lsc > output && ! test -s output

* FAIL 11: null listcon

    todo.sh listcon > output && ! test -s output

* FAIL 12: null lsprj

    todo.sh lsprj > output && ! test -s output

* FAIL 13: null listproj

    todo.sh listproj > output && ! test -s output

* FAIL 14: null lf

    todo.sh lf > output || test_cmp expect output

* FAIL 15: null listfile

    todo.sh listfile > output || test_cmp expect output

* FAIL 16: null listfile foo.txt

    todo.sh listfile foo.txt > output || test_cmp expect output

./test-lib.sh: line 416: $test_results_path: ambiguous redirect
./test-lib.sh: line 417: $test_results_path: ambiguous redirect
./test-lib.sh: line 418: $test_results_path: ambiguous redirect
./test-lib.sh: line 419: $test_results_path: ambiguous redirect
./test-lib.sh: line 420: $test_results_path: ambiguous redirect
./test-lib.sh: line 421: $test_results_path: ambiguous redirect
* failed 16 among 16 test(s)
make: *** [Makefile:96: tests/t0001-null.sh] Error 1
[esi@melkorka todo.txt-cli]$ pwd
/home/esi/Sóttar skrár/todo.txt-cli
[esi@melkorka todo.txt-cli]$