repo.or.cz
/
moreutils.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
releasing version 0.18
[moreutils.git]
/
check-isutf8
blob
a4efa7bfb95e5e6a28bfcee4c17745d5bc38931f
1
#!/bin/bash
2
# Bash needed for the character encodings below.
3
#
4
# Run checks for ./isutf8.
5
#
6
# Lars Wirzenius <liw@iki.fi>
7
8
failed
=
0
9
10
check
() {
11
printf
"
$2
"
| .
/
isutf8
-q
12
ret
=
$?
13
if
[
$ret
!=
$1
];
then
14
echo
"Failure:"
15
echo
" input:
$2
"
16
echo
" expected:
$1
"
17
echo
" got:
$ret
"
18
failed
=
1
19
fi
20
}
21
22
check
0
''
23
check
0
'a'
24
check
0
'ab'
25
check
0
'
\xc2\xa9
'
26
27
check
1
'
\xc2
'
28
check
1
'
\xc2\x20
'
29
check
1
'
\x20\xc2
'
30
31
exit
$failed