Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/testsuite/awk.tests
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/testsuite/awk.tests
r3232 r3621 25 25 26 26 # 4294967295 = 0xffffffff 27 testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n" 27 testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4294967295\n" "" "\n" 28 29 # we were testing for a non-empty body when deciding if a function was 30 # defined or not. The testcase below caused: 31 # awk: cmd. line:8: Call to undefined function 32 prg=' 33 function empty_fun(count) { 34 # empty 35 } 36 END { 37 i=1 38 print "L" i "\n" 39 empty_fun(i + i + ++i) 40 print "L" i "\n" 41 }' 42 testing "awk handles empty function f(arg){}" \ 43 "awk '$prg'" \ 44 "L1\n\nL2\n\n" \ 45 "" "" 46 47 prg=' 48 function outer_fun() { 49 return 1 50 } 51 END { 52 i=1 53 print "L" i "\n" 54 i += outer_fun() 55 print "L" i "\n" 56 }' 57 testing "awk properly handles function from other scope" \ 58 "awk '$prg'" \ 59 "L1\n\nL2\n\n" \ 60 "" "" 61 62 prg=' 63 END { 64 i=1 65 print "L" i "\n" 66 i + trigger_error_fun() 67 print "L" i "\n" 68 }' 69 testing "awk properly handles undefined function" \ 70 "awk '$prg' 2>&1" \ 71 "L1\n\nawk: cmd. line:5: Call to undefined function\n" \ 72 "" "" 73 74 28 75 optional DESKTOP 29 testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4 .29497e+09\n" "" "\n"30 testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2 .14748e+09\n" "" "\n"76 testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4294967295\n" "" "\n" 77 testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2147483649\n" "" "\n" 31 78 testing "awk oct const" "awk '{ print or(01234,1) }'" "669\n" "" "\n" 32 79 SKIP= … … 223 270 "a:b c:d\ne:f g:h" 224 271 272 optional FEATURE_AWK_LIBM 273 testing "awk large integer" \ 274 "awk 'BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}'" \ 275 "2147483647 2147483647 0 2147483648 2147483648 0\n" \ 276 "" "" 277 SKIP= 278 279 testing "awk length(array)" \ 280 "awk 'BEGIN{ A[1]=2; A[\"qwe\"]=\"asd\"; print length(A)}'" \ 281 "2\n" \ 282 "" "" 283 284 testing "awk length()" \ 285 "awk '{print length; print length(); print length(\"qwe\"); print length(99+9)}'" \ 286 "3\n3\n3\n3\n" \ 287 "" "qwe" 288 289 testing "awk -f and ARGC" \ 290 "awk -f - input" \ 291 "re\n2\n" \ 292 "do re mi\n" \ 293 '{print $2; print ARGC;}' \ 294 295 optional FEATURE_AWK_GNU_EXTENSIONS 296 testing "awk -e and ARGC" \ 297 "awk -e '{print \$2; print ARGC;}' input" \ 298 "re\n2\n" \ 299 "do re mi\n" \ 300 "" 301 SKIP= 302 303 # The examples are in fact not valid awk programs (break/continue 304 # can only be used inside loops). 305 # But we do accept them outside of loops. 306 # We had a bug with misparsing "break ; else" sequence. 307 # Test that *that* bug is fixed, using simplest possible scripts: 308 testing "awk break" \ 309 "awk -f - 2>&1; echo \$?" \ 310 "0\n" \ 311 "" \ 312 'BEGIN { if (1) break; else a = 1 }' 313 testing "awk continue" \ 314 "awk -f - 2>&1; echo \$?" \ 315 "0\n" \ 316 "" \ 317 'BEGIN { if (1) continue; else a = 1 }' 318 225 319 # testing "description" "command" "result" "infile" "stdin" 226 320
Note:
See TracChangeset
for help on using the changeset viewer.