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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
#!/usr/bin/env tesh
p This tests whether TESH correctly sorts command output
< p Test sorting and filtering of output
<
< $ true
<
< ! output sort
< $ true
<
< $ printf 'profiling: foo\n'
<
< $ printf 'profiling: foo'
<
< ! output sort
< $ printf 'profiling: foo\n'
<
< ! output sort
< $ printf 'profiling: foo'
<
< $ printf 'a\nb\nc\nd\n'
< > a
< > b
< > c
< > d
<
< $ printf 'a\nb\nc\nd'
< > a
< > b
< > c
< > d
<
< ! output sort
< $ printf 'c\nd\nb\na\n'
< > a
< > b
< > c
< > d
<
< ! output sort
< $ printf 'c\nd\nb\na'
< > a
< > b
< > c
< > d
<
< $ printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz\n'
< > a
< > b
< > c
< > d
<
< $ printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz'
< > a
< > b
< > c
< > d
<
< ! output sort
< $ printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz\n'
< > a
< > b
< > c
< > d
<
< ! output sort
< $ printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz'
< > a
< > b
< > c
< > d
$ ${bindir:=.}/tesh --ignore-jenkins
> Ignore all cruft seen on SimGrid's continuous integration servers
> Test suite from stdin
> [(stdin):1] Test sorting and filtering of output
> [(stdin):3] true
>
> [(stdin):6] true
>
> [(stdin):8] printf 'profiling: foo\n'
>
> [(stdin):10] printf 'profiling: foo'
>
> [(stdin):13] printf 'profiling: foo\n'
>
> [(stdin):16] printf 'profiling: foo'
>
> [(stdin):18] printf 'a\nb\nc\nd\n'
>
> [(stdin):24] printf 'a\nb\nc\nd'
>
> [(stdin):31] printf 'c\nd\nb\na\n'
>
> [(stdin):38] printf 'c\nd\nb\na'
>
> [(stdin):44] printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz\n'
>
> [(stdin):50] printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz'
>
> [(stdin):57] printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz\n'
>
> [(stdin):64] printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz'
>
> Test suite from stdin OK
p Check the Right Prefix Length (19) for "output sort"
! output sort 19
< 12345678901234567 B line
< 12345678901234567 A line
$ cat
> 12345678901234567 A line
> 12345678901234567 B line
! output sort 19
< 123456789012345678 B line
< 123456789012345678 A line
$ cat
> 123456789012345678 B line
> 123456789012345678 A line
! expect return 2
! output ignore
< ! output sort 19
< < 123456789012345678 B line
< < 123456789012345678 A line
< $ cat
< > 123456789012345678 A line
< > 123456789012345678 B line
$ ${bindir:=.}/tesh
p Check user-defined prefix length for "output sort"
! output sort 5
< 000 B line
< 000 A line
$ cat
> 000 A line
> 000 B line
! output sort 4
< 000 B line
< 000 A line
$ cat
> 000 B line
> 000 A line
! expect return 2
! output ignore
< ! output sort 4
< < 000 B line
< < 000 A line
< $ cat
< > 000 A line
< > 000 B line
$ ${bindir:=.}/tesh
|