@@ -40,15 +40,13 @@ oneTimeSetUp() {
4040 fi
4141}
4242
43- debug ()
44- {
43+ debug () {
4544 if [ -n " ${DEBUG} " ]; then
4645 printf " D: %s\n" " $* "
4746 fi
4847}
4948
50- testUsage ()
51- {
49+ testUsage () {
5250 ret=$( ${WCURL_CMD} --help)
5351 assertTrue " Verify whether '--help' option exits successfully" " $? "
5452
@@ -57,23 +55,20 @@ testUsage()
5755 assertTrue " Verify whether the usage command works" " $? "
5856}
5957
60- testNoOptionError ()
61- {
58+ testNoOptionError () {
6259 ret=$( ${WCURL_CMD} 2>&1 )
6360 assertFalse " Verify whether 'wcurl' without options exits with an error" " $? "
6461 assertEquals " Verify whether 'wcurl' without options displays an error message" " ${ret} " " You must provide at least one URL to download."
6562}
6663
67- testInvalidOptionError ()
68- {
64+ testInvalidOptionError () {
6965 invalidoption=" --frobnicator"
7066 ret=$( ${WCURL_CMD} ${invalidoption} 2>&1 )
7167 assertFalse " Verify whether 'wcurl' with an invalid option exits with an error" " $? "
7268 assertEquals " Verify whether 'wcurl' with an invalid option displays an error message" " ${ret} " " Unknown option: '${invalidoption} '."
7369}
7470
75- testParallelIfMoreThanOneUrl ()
76- {
71+ testParallelIfMoreThanOneUrl () {
7772 # TODO: This test is wrong for curl 7.65 or older, since --parallel was only introduced in 7.66.
7873 # We should check curl's version and skip this test instead.
7974 url_1=' example.com/1'
@@ -82,32 +77,28 @@ testParallelIfMoreThanOneUrl()
8277 assertContains " Verify whether 'wcurl' uses '--parallel' if more than one url is provided" " ${ret} " ' --parallel'
8378}
8479
85- testEncodingWhitespace ()
86- {
80+ testEncodingWhitespace () {
8781 url=' example.com/white space'
8882 ret=$( ${WCURL_CMD} " ${url} " )
8983 assertContains " Verify 'wcurl' encodes spaces in URLs as '%20'" " ${ret} " ' example.com/white%20space'
9084}
9185
92- testDoubleDash ()
93- {
86+ testDoubleDash () {
9487 params=' example.com --curl-options=abc'
9588 ret=$( ${WCURL_CMD} -- " ${params} " )
9689 assertTrue " Verify whether 'wcurl' accepts '--' without erroring" " $? "
9790 assertContains " Verify whether 'wcurl' considers everywhing after '--' a url" " ${ret} " ' --curl-options=abc'
9891}
9992
100- testCurlOptions ()
101- {
93+ testCurlOptions () {
10294 params=' example.com --curl-options=--foo --curl-options --bar'
10395 ret=$( ${WCURL_CMD} " ${params} " )
10496 assertTrue " Verify 'wcurl' accepts '--curl-options' with and without trailing '='" " $? "
10597 assertContains " Verify 'wcurl' correctly passes through --curl-options=<option>" " ${ret} " ' --foo'
10698 assertContains " Verify 'wcurl' correctly passes through --curl-options <option>" " ${ret} " ' --bar'
10799}
108100
109- testNextAmount ()
110- {
101+ testNextAmount () {
111102 url_1=' example.com/1'
112103 url_2=' example.com/2'
113104 url_3=' example.com3'
@@ -116,84 +107,73 @@ testNextAmount()
116107 assertEquals " Verify whether 'wcurl' includes '--next' for every url besides the first" " ${next_count} " " 2"
117108}
118109
119- testUrlStartingWithDash ()
120- {
110+ testUrlStartingWithDash () {
121111 url=' -example.com'
122112 ret=$( ${WCURL_CMD} ${url} 2>&1 )
123113 assertFalse " Verify whether 'wcurl' considers an URL starting with '-' as an option" " $? "
124114 assertEquals " ${ret} " " Unknown option: '-example.com'."
125115}
126116
127- testOutputFileName ()
128- {
117+ testOutputFileName () {
129118 url=' example.com'
130119 ret=$( ${WCURL_CMD} -o " test filename" ${url} 2>&1 )
131120 assertContains " Verify whether 'wcurl' correctly sets a custom output filename" " ${ret} " ' --output'
132121 assertContains " Verify whether 'wcurl' correctly sets a custom output filename" " ${ret} " ' test filename'
133122}
134123
135- testOutputFileNameWithoutSpaces ()
136- {
124+ testOutputFileNameWithoutSpaces () {
137125 url=' example.com'
138126 ret=$( ${WCURL_CMD} -o" test filename" ${url} 2>&1 )
139127 assertContains " Verify whether 'wcurl' correctly sets --output" " ${ret} " ' --output'
140128 assertContains " Verify whether 'wcurl' correctly sets --output with the correct filename" " ${ret} " ' test filename'
141129}
142130
143- testOutputFileNameRepeatedOption ()
144- {
131+ testOutputFileNameRepeatedOption () {
145132 url=' example.com'
146133 ret=$( ${WCURL_CMD} -o " test filename" -o " test filename2" ${url} 2>&1 )
147134 assertContains " Verify whether 'wcurl' correctly sets a custom output filename" " ${ret} " ' --output'
148135 assertContains " Verify whether 'wcurl' correctly sets a custom output filename" " ${ret} " ' test filename2'
149136}
150137
151- testUrlDefaultName ()
152- {
138+ testUrlDefaultName () {
153139 url=' example%20with%20spaces.com'
154140 ret=$( ${WCURL_CMD} ${url} 2>&1 )
155141 assertContains " Verify whether 'wcurl' chooses the correct default filename when there's no path in the URL" " ${ret} " ' index.html'
156142}
157143
158- testUrlDefaultNameTrailingSlash ()
159- {
144+ testUrlDefaultNameTrailingSlash () {
160145 url=' example%20with%20spaces.com/'
161146 ret=$( ${WCURL_CMD} ${url} 2>&1 )
162147 assertContains " Verify whether 'wcurl' chooses the correct default filename when there's no path in the URL and the URl ends with a slash" " ${ret} " ' index.html'
163148}
164149
165- testUrlDecodingWhitespaces ()
166- {
150+ testUrlDecodingWhitespaces () {
167151 url=' example.com/filename%20with%20spaces'
168152 ret=$( ${WCURL_CMD} ${url} 2>&1 )
169153 assertContains " Verify whether 'wcurl' successfully decodes percent-encoded whitespaces in URLs" " ${ret} " ' filename with spaces'
170154}
171155
172- testUrlDecodingWhitespacesTwoFiles ()
173- {
156+ testUrlDecodingWhitespacesTwoFiles () {
174157 url=' example.com/filename%20with%20spaces'
175158 url_2=' example.com/filename2%20with%20spaces'
176159 ret=$( ${WCURL_CMD} ${url} ${url_2} 2>&1 )
177160 assertContains " Verify whether 'wcurl' successfully decodes percent-encoded whitespaces in URLs" " ${ret} " ' filename with spaces'
178161 assertContains " Verify whether 'wcurl' successfully decodes percent-encoded whitespaces in URLs" " ${ret} " ' filename2 with spaces'
179162}
180163
181- testUrlDecodingDisabled ()
182- {
164+ testUrlDecodingDisabled () {
183165 url=' example.com/filename%20with%20spaces'
184166 ret=$( ${WCURL_CMD} --no-decode-filename ${url} 2>&1 )
185167 assertContains " Verify whether 'wcurl' successfully decodes percent-encoded whitespaces in URLs" " ${ret} " ' filename%20with%20spaces'
186168}
187169
188- testUrlDecodingWhitespacesQueryString ()
189- {
170+ testUrlDecodingWhitespacesQueryString () {
190171 url=' example.com/filename%20with%20spaces?query=string'
191172 ret=$( ${WCURL_CMD} " ${url} " 2>&1 )
192173 assertContains " Verify whether 'wcurl' successfully decodes percent-encoded whitespaces in URLs with query strings" " ${ret} " ' filename with spaces'
193174}
194175
195- testUrlDecodingWhitespacesTrailingSlash ()
196- {
176+ testUrlDecodingWhitespacesTrailingSlash () {
197177 url=' example.com/filename%20with%20spaces/'
198178 ret=$( ${WCURL_CMD} ${url} 2>&1 )
199179 assertContains " Verify whether 'wcurl' successfully uses the default filename when the URL ends with a slash" " ${ret} " ' index.html'
@@ -202,8 +182,7 @@ testUrlDecodingWhitespacesTrailingSlash()
202182# Test decoding a bunch of different languages (that don't use the latin
203183# alphabet), we could split each language on its own test, but for now it
204184# doesn't make a difference.
205- testUrlDecodingNonLatinLanguages ()
206- {
185+ testUrlDecodingNonLatinLanguages () {
207186 # Arabic
208187 url=' example.com/%D8%AA%D8%B1%D9%85%D9%8A%D8%B2_%D8%A7%D9%84%D9%86%D8%B3%D8%A8%D8%A9_%D8%A7%D9%84%D9%85%D8%A6%D9%88%D9%8A%D8%A9'
209188 ret=$( ${WCURL_CMD} ${url} 2>&1 )
0 commit comments