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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
Set up cram alias and example tests:
$ . "$TESTDIR"/setup.sh
Test with Windows newlines:
$ printf " $ echo hi\r\n hi\r\n" > windows-newlines.t
$ cram windows-newlines.t
.
# Ran 1 tests, 0 skipped, 0 failed.
Test with Latin-1 encoding:
$ cat > good-latin-1.t <<EOF
> $ printf "hola se\361or\n"
> hola se\xf1or (esc)
> EOF
$ cat > bad-latin-1.t <<EOF
> $ printf "hola se\361or\n"
> hey
> EOF
$ cram good-latin-1.t bad-latin-1.t
.!
--- bad-latin-1.t
+++ bad-latin-1.t.err
@@ -1,2 +1,2 @@
$ printf "hola se\361or\n"
- hey
+ hola se\xf1or (esc)
# Ran 2 tests, 0 skipped, 1 failed.
[1]
Test with UTF-8 encoding:
$ cat > good-utf-8.t <<EOF
> $ printf "hola se\303\261or\n"
> hola se\xc3\xb1or (esc)
> EOF
$ cat > bad-utf-8.t <<EOF
> $ printf "hola se\303\261or\n"
> hey
> EOF
$ cram good-utf-8.t bad-utf-8.t
.!
--- bad-utf-8.t
+++ bad-utf-8.t.err
@@ -1,2 +1,2 @@
$ printf "hola se\303\261or\n"
- hey
+ hola se\xc3\xb1or (esc)
# Ran 2 tests, 0 skipped, 1 failed.
[1]
Test file missing trailing newline:
$ printf ' $ true' > passing-with-no-newline.t
$ cram passing-with-no-newline.t
.
# Ran 1 tests, 0 skipped, 0 failed.
$ printf ' $ false' > failing-with-no-newline.t
$ cram failing-with-no-newline.t
!
--- failing-with-no-newline.t
+++ failing-with-no-newline.t.err
@@ -1,1 +1,2 @@
$ false
+ [1]
# Ran 1 tests, 0 skipped, 1 failed.
[1]
|