summaryrefslogtreecommitdiff
path: root/check-isutf8
blob: 036f909cda3ab515f67dce661e0f154006fe8d1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
#
# Run checks for ./isutf8.
#
# Lars Wirzenius <liw@iki.fi>

check() {
	printf "$2" | ./isutf8 -q
	ret=$?
	if [ $ret != $1 ]; then
		echo "Failure:"
		echo "  input: $2"
		echo "  expected: $1"
		echo "  got: $ret"
	fi
}

check 0 ''
check 0 'a'
check 0 'ab'
check 0 '\xc2\xa9'

check 1 '\xc2'
check 1 '\xc2\x20'
check 1 '\x20\xc2'