1#!/bin/bash
2
3[ -f testing.sh ] && . testing.sh
4
5#testing "name" "command" "result" "infile" "stdin"
6
7testing "mkfifo" "mkfifo one && [ -p one ] && echo yes" "yes\n" "" ""
8rm one
9
10touch existing
11testing "mkfifo existing" \
12	"mkfifo existing 2> /dev/null || [ -f existing ] && echo yes" "yes\n" "" ""
13rm existing
14
15testing "mkfifo one two" \
16	"mkfifo one two && [ -p one ] && [ -p two ] && echo yes" "yes\n" "" ""
17rm one two
18
19umask 123
20testing "mkfifo (default permissions)" \
21	"mkfifo one && stat -c %a one" "644\n" "" ""
22rm one
23
24umask 000
25
26testing "mkfifo -m 124" \
27	"mkfifo -m 124 one && stat -c %a one" "124\n" "" ""
28rm -f one
29