File: run

package info (click to toggle)
sedsed 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,008 kB
  • sloc: sed: 37,239; ansic: 2,395; python: 815; sh: 624; makefile: 95
file content (50 lines) | stat: -rwxr-xr-x 1,846 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

# Always run the tests from this script's folder
cd "$(dirname "$0")" || exit 1

# Read default configuration
# shellcheck source=test/_include.sh
source ../_include.sh

input () {
    case $file in
          anagrams.gnu.sed) printf 'over\nlove\nvero\n' ;;
                  bf2c.sed) echo '+[>>+++++[<++++++>-]<[>++++[>++++++++<-]' ;;
                   cal.sed) echo '2 07'; echo '-m 2004' ;;
                config.sed) echo "aa='abc" ;;
                    dc.sed) echo '4 4 + p' ;;
                expand.sed) printf 'one\ttwo\tthree\t4\tfive\n' ;;
                   fmt.sed) head "$file" ;;
           html_uc.gnu.sed) printf '<b>bold\n</b>\n' ;;
              incr_num.sed) echo '9999' ;;
              revlines.sed) printf 'one\ntwo\nthree\nfour\n' ;;
              sedcheck.sed) cat expand.sed ;;
               sokoban.sed) printf '.\n1\nkhhhkkkhkhhjhhjjjllllllllllllll:q\n' ;;
              sort.gnu.sed) printf 'one\ntwo\nthree\nfour\n' ;;
           tex2xml.gnu.sed) echo 'a{b{c{bla}}}' ;;
               tolower.sed) echo '/a/b/c/FOO' ;;
                ttest1.sed) printf 'a\nb\n' ;;
                ttest2.sed) echo 'DDD' ;;
                         *) echo "*** Unregistered file $file - Aborting." >&2 ;;
    esac
}

# Test files user supplied files ($@) otherwise test everything
# shellcheck disable=SC2068
for file in ${@:-*.sed}
do

    # Only test *.gnu.sed files when using GNU sed
    test "${file%.gnu.sed}" != "$file" && test "$sed" != 'gsed' && continue

    test_message "Testing $file"

    # Run the same sed script in sed and sedsed -d, results must be equal
    input "$file" | $sed -f "$file" > "$sed_output" || failed=1
    input "$file" | $sedsed -d --_stdout-only -f "$file" > "$sedsed_output" || failed=1
    diff -U1 "$sed_output" "$sedsed_output" || failed=1
done

tests_clean_up
tests_exit