diff options
Diffstat (limited to 'tests/fake_wget_test')
-rwxr-xr-x | tests/fake_wget_test | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/fake_wget_test b/tests/fake_wget_test new file mode 100755 index 0000000..dac7681 --- /dev/null +++ b/tests/fake_wget_test @@ -0,0 +1,58 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/test_env.sh +init_tests \ + fake_wget_usage \ + fake_wget_spider \ + fake_wget_quiet \ + fake_wget \ + fake_wget_outfile \ + fake_wget_stdout + +fake_wget_usage_body() { + test_usage wget +} + +fake_wget_spider_body() { + init_env + atf_check -s exit:0 \ + -o empty \ + -e empty \ + wget --spider https://example.com +} + +fake_wget_quiet_body() { + init_env + atf_check -s exit:0 \ + -o empty \ + -e empty \ + wget -q https://example.com +} + +fake_wget_body() { + init_env + atf_check -s exit:0 \ + -o empty \ + -e match:"saving to 'index.html'" \ + wget https://example.com + test -f index.html || atf_fail "index.html not created" +} + +fake_wget_outfile_body() { + init_env + atf_check -s exit:0 \ + -o empty \ + -e match:"saving to 'foo'" \ + wget -O foo https://example.com + test -f foo || atf_fail "foo not created" +} + +fake_wget_stdout_body() { + init_env + export WGETCONTENT="hello world" + atf_check -s exit:0 \ + -o match:"hello world" \ + -e match:"writing to stdout" \ + wget -O - https://example.com + ! test -f - || atf_fail "- was created" +} |