File: keywords.sh

package info (click to toggle)
cssc 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 11,368 kB
  • sloc: cpp: 39,446; ansic: 17,403; sh: 11,328; python: 3,923; makefile: 1,929; perl: 342; awk: 15; sed: 15
file content (130 lines) | stat: -rwxr-xr-x 3,296 bytes parent folder | download | duplicates (4)
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
#! /bin/sh

# keywords.sh:  Testing for correct expansion of formats for prs -d.

# Import common functions & definitions.
. ../common/test-common


sid=1.1

expands_to () {
    # $1 -- label
    # $2 -- format
    # $3 -- expansion
docommand $1 "${vg_prs} \"-d$2\" -r${sid} s.1" 0 "$3" IGNORE
}

remove s.1 p.1 1 z.1

# Create file
echo "Descriptive Text" > DESC
docommand P1 "${admin} -n -tDESC s.1" 0 "" ""
remove DESC

docommand P2 "${vg_prs} -d':M:\n' s.1" 0 "1
" ""

docommand P3 "${get} -e s.1" 0 "1.1\nnew delta 1.2\n0 lines\n" IGNORE
echo "hello from %M%" >> 1
docommand P4 "${delta} -y s.1" 0 "1.2\n1 inserted\n0 deleted\n0 unchanged\n" ""

expands_to z1 :PN:      `../../testutils/realpwd`"/s.1\n"


expands_to X1  :I:      "1.1\n"
expands_to X1r :R:      "1\n"
expands_to X1l :L:      "1\n"
expands_to X1b :B:      "\n"
expands_to X1s :S:      "\n"
expands_to X2  :BF:     "no\n"
expands_to X3  :DI:     "\n"
expands_to X4  :DL:     "00000/00000/00000\n"
expands_to X5  :DT:     "D\n"
expands_to X7  :J:      "no\n"
expands_to X8  :LK:     "none\n"
expands_to X9  :MF:     "no\n"
expands_to X10 :MP:     "none\n"
expands_to X11 :MR:     "\n"
expands_to X12 :Z:      '@(#)\n'
expands_to X13 'x\\ny'  "x\ny\n"
expands_to X14 ':Q:'    '\n'
expands_to X15 'x\ty'   'x\ty\n'
expands_to X16 'x\\ty'   'x\ty\n'
expands_to X17 'x\\ny'   'x\ny\n'
expands_to X18 ':FD:'   'Descriptive Text\n\n'

remove got.stdout expected.stdout
echo_nonl Z1...
${vg_prs}  -d'\\' s.1 > got.stdout 2>got.stderr || fail prs failed.
echo \\            > expected.stdout || miscarry redirection to expected.stdout
diff expected.stdout got.stdout >/dev/null || fail stdout format error.
test -s got.stderr && fail expected empty stderr output
remove got.stderr got.stdout expected.stdout 
echo passed


# Make sure prs accepts an empty "-r" option.
docommand Z2 "${vg_prs} -r -d':M:\n' s.1" 0 "1
" ""

remove s.1
docommand  K0 "cp sample_foo s.1" 0 IGNORE IGNORE
docommand  K1 "${admin} -fqQFLAG s.1" 0 IGNORE IGNORE

expands_to K2 ':Dy:'   '02\n'
expands_to K3 ':Dm:'   '03\n'
expands_to K4 ':Dd:'   '16\n'

expands_to K5 ':Th:'   '21\n'
expands_to K6 ':Tm:'   '39\n'
expands_to K7 ':Ts:'   '36\n'


docommand _1 "${get} -e -x1.1,1.2 -r1.4 s.1" 0 IGNORE IGNORE
echo hello >> 1 || miscarry "could not write to file '1'"
#docommand _2 "${delta} -g1.1 s.1" 0 IGNORE IGNORE
docommand _2 "${delta} -y'You only Live Twice'  s.1" 0 IGNORE IGNORE

docommand _3 "${get} -e -i1.3 -x1.2,1.1 -r1.5 s.1" 0 IGNORE IGNORE
echo foobar >> 1 || miscarry "could not write to file '1'"
#docommand _4 "${delta} -g1.1 s.1" 0 IGNORE IGNORE
docommand _4 "${delta} -y' Roundabout'  s.1" 0 IGNORE IGNORE

docommand _5 "${admin} -fi -ftMODULE_TYPE -fl1 s.1" 0 IGNORE IGNORE
docommand _6 "${admin} -asanta s.1" 0 IGNORE IGNORE


sid=1.5


# Excluded deltas
expands_to K8 ':Dx:'   '2 1\n'

# Ignored deltas
# expands_to K9 ':Dg:'   '2\n'
expands_to K9 ':Dg:'   '\n'

# Authorised user list
expands_to K10 ':UN:'   'santa\n\n'

# Module type (t) flag
expands_to K11 ':Y:'   'MODULE_TYPE\n'

# KF - keyword warning flag
expands_to K12 ':KF:'   'yes\n'

expands_to K13 ':LK:'   '1\n'
expands_to K14 ':Q:'   'QFLAG\n'


expands_to K15 ':DI:'   '/2 1\n'

sid=1.6

expands_to K16 ':DI:'   '3/2 1\n'

## 
## 
remove s.1 p.1 z.1 1 command.log
success