Home | History | Annotate | Download | only in tests
      1 #!/bin/bash
      2 
      3 # Copyright 2013 Divya Kothari <divya.s.kothari (at] gmail.com>
      4 # Copyright 2013 Robin Mittal <robinmittal.it (at] gmail.com>
      5 
      6 [ -f testing.sh ] && . testing.sh
      7 
      8 # Redirecting all output to /dev/null for grep and delgroup
      9 arg="&>/dev/null"
     10 
     11 #testing "name" "command" "result" "infile" "stdin"
     12 
     13 testing "groupadd group_name (text)" "groupadd toyTestGroup &&
     14    grep '^toyTestGroup:' /etc/group $arg && groupdel toyTestGroup $arg &&
     15    echo 'yes'" "yes\n" "" ""
     16 testing "groupadd group_name (alphanumeric)" "groupadd toy1Test2Group3 &&
     17    grep '^toy1Test2Group3:' /etc/group $arg && groupdel toy1Test2Group3 $arg &&
     18    echo 'yes'" "yes\n" "" ""
     19 testing "groupadd group_name (numeric)" "groupadd 987654321 &&
     20    grep '^987654321:' /etc/group $arg && groupdel 987654321 $arg &&
     21    echo 'yes'" "yes\n" "" ""
     22 testing "groupadd group_name (with ./-)" "groupadd toy.1Test-2Group.3 &&
     23    grep '^toy.1Test-2Group.3:' /etc/group $arg &&
     24    groupdel toy.1Test-2Group.3 $arg && echo 'yes'" "yes\n" "" ""
     25 testing "groupadd group_name with group_id" "groupadd -g 49999 toyTestGroup &&
     26    grep '^toyTestGroup:' /etc/group $arg && groupdel toyTestGroup $arg &&
     27    echo 'yes'" "yes\n" "" ""
     28