rup client
[unix-history] / usr.bin / sed / compile.test
CommitLineData
c2199a45
AM
1#!/bin/sh
2SED=./sed
3PRINTF=printf
4
5# tests that a delimiter okay in ccl, i.e., s/[/]// deletes a /
6abc=`$PRINTF 'hello/world\n' | $SED 's/[/]/x/;s/\n//'`
7[ ! X"$abc" = Xhelloxworld ] && { echo "(1) failed: $abc"; }
8
9# tests that a \ is not a general escape character in ccl, i.e., s/[\]//
10# deletes a \
11abc=`$PRINTF 'hello\\world\n' | $SED 's/[\]/x/'`
12[ ! X"$abc" = Xhelloxworld ] && { echo "(2) failed: $abc"; }
13
14# tests that a \n is mapped to a newline in ccl, i.e., s/[\n]//
15# deletes a newline
16abc=`$PRINTF 'hello\nworld\n' | $SED 'N; s/[\n]/x/'`
17[ ! X"$abc" = Xhelloxworld ] && { echo "(3) failed: $abc"; }
18
19# tests that a \\ does not map to a \ in ccl, i.e., s/[\\n]//
20# deletes a newline - not a \ or an n
21abc=`$PRINTF 'hello\n\\world\n' | $SED 'N; s/[\\n]/x/;s/[\]/y/'`
22[ ! X"$abc" = Xhelloxyworld ] && { echo "(4) failed: $abc"; }
23
24abc=`$PRINTF 'helloworld\n' | $SED 's/[[:alpha:]]/x/'`
25[ ! X"$abc" = Xxelloworld ] && { echo "(5) failed: $abc"; }