Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/testsuite/awk.tests

    r3232 r3621  
    2525
    2626# 4294967295 = 0xffffffff
    27 testing "awk bitwise op"  "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n"
     27testing "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
     32prg='
     33function empty_fun(count) {
     34  # empty
     35}
     36END {
     37  i=1
     38  print "L" i "\n"
     39  empty_fun(i + i + ++i)
     40  print "L" i "\n"
     41}'
     42testing "awk handles empty function f(arg){}" \
     43    "awk '$prg'" \
     44    "L1\n\nL2\n\n" \
     45    "" ""
     46
     47prg='
     48function outer_fun() {
     49  return 1
     50}
     51END {
     52  i=1
     53  print "L" i "\n"
     54  i += outer_fun()
     55  print "L" i "\n"
     56}'
     57testing "awk properly handles function from other scope" \
     58    "awk '$prg'" \
     59    "L1\n\nL2\n\n" \
     60    "" ""
     61
     62prg='
     63END {
     64  i=1
     65  print "L" i "\n"
     66  i + trigger_error_fun()
     67  print "L" i "\n"
     68}'
     69testing "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
    2875optional 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"
     76testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4294967295\n" "" "\n"
     77testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2147483649\n" "" "\n"
    3178testing "awk oct const"   "awk '{ print or(01234,1) }'"      "669\n"         "" "\n"
    3279SKIP=
     
    223270    "a:b c:d\ne:f g:h"
    224271
     272optional FEATURE_AWK_LIBM
     273testing "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    "" ""
     277SKIP=
     278
     279testing "awk length(array)" \
     280    "awk 'BEGIN{ A[1]=2; A[\"qwe\"]=\"asd\"; print length(A)}'" \
     281    "2\n" \
     282    "" ""
     283
     284testing "awk length()" \
     285    "awk '{print length; print length(); print length(\"qwe\"); print length(99+9)}'" \
     286    "3\n3\n3\n3\n" \
     287    "" "qwe"
     288
     289testing "awk -f and ARGC" \
     290    "awk -f - input" \
     291    "re\n2\n" \
     292    "do re mi\n" \
     293    '{print $2; print ARGC;}' \
     294
     295optional FEATURE_AWK_GNU_EXTENSIONS
     296testing "awk -e and ARGC" \
     297    "awk -e '{print \$2; print ARGC;}' input" \
     298    "re\n2\n" \
     299    "do re mi\n" \
     300    ""
     301SKIP=
     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:
     308testing "awk break" \
     309    "awk -f - 2>&1; echo \$?" \
     310    "0\n" \
     311    "" \
     312    'BEGIN { if (1) break; else a = 1 }'
     313testing "awk continue" \
     314    "awk -f - 2>&1; echo \$?" \
     315    "0\n" \
     316    "" \
     317    'BEGIN { if (1) continue; else a = 1 }'
     318
    225319# testing "description" "command" "result" "infile" "stdin"
    226320
Note: See TracChangeset for help on using the changeset viewer.