aboutsummaryrefslogtreecommitdiff
path: root/tests/id.test
blob: 32f26191532f2e6a9e2c8a3f14af92292db0da41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

testing "id 0" "id 0 | sed 's/ context=.*//g'" \
  "uid=0(root) gid=0(root) groups=0(root)\n" "" ""
testing "id root" "id root | sed 's/ context=.*//g'" \
  "uid=0(root) gid=0(root) groups=0(root)\n" "" ""
testing "id -G root" "id -G root" "0\n" "" ""
testing "id -nG root" "id -nG root" "root\n" "" ""
testing "id -g root" "id -g root" "0\n" "" ""
testing "id -ng root" "id -ng root" "root\n" "" ""
testing "id -u root" "id -u root" "0\n" "" ""
testing "id -nu root" "id -nu root" "root\n" "" ""
testing "id no-such-user" "id no-such-user 2>/dev/null ; echo \$?" "1\n" "" ""
testing "id 2147483647" "id 2147483647 2>/dev/null ; echo \$?" "1\n" "" ""