File: annotate.sh

package info (click to toggle)
cssc 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, 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 (59 lines) | stat: -rwxr-xr-x 1,492 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
#! /bin/sh

# Tests for the -n and -m options of get.

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


f=1test
s=s.$f
p=p.$f
remove $f $s $p

echo "line1" >  $f
echo "line2" >> $f

docommand A1 "$admin -n -i$f $s" 0 "" IGNORE
test -r $s         || fail admin could not create $s

remove $f 

# Test the -n (annotate module name) option
docommand N1 "${vg_get} -p -n $s" 0 "$f\tline1\n$f\tline2\n" IGNORE

# Test the -m (annotate SID) option
docommand N2 "${vg_get} -p -m $s" 0 "1.1\tline1\n1.1\tline2\n" IGNORE

# Test both options together.
docommand N3 "${vg_get} -p -n -m $s" 0 "$f\t1.1\tline1\n$f\t1.1\tline2\n" IGNORE

# Make a new delta to further test the -m option.
docommand G1 "${vg_get} -e $s" 0 "1.1\nnew delta 1.2\n2 lines\n" ""

echo "line3" >> $f
docommand D1 "$delta '-yAdded line three' $s" 0 \
    "1.2\n1 inserted\n0 deleted\n2 unchanged\n" \
    IGNORE

# Test the -m (annotate SID) option with several deltas...
docommand N4 "${vg_get} -p -m $s" 0 \
    "1.1\tline1\n1.1\tline2\n1.2\tline3\n" \
    IGNORE

# Now make a branch.
docommand G2 "${vg_get} -e -r1.1 $s" 0 "1.1\nnew delta 1.1.1.1\n2 lines\n" ""

echo "line4 %Z%" >> $f
docommand D2 "$delta '-yAdded line: a branch' $s" 0 \
    "1.1.1.1\n1 inserted\n0 deleted\n2 unchanged\n" \
    IGNORE

# Test both options together.
docommand N5 "${vg_get} -p -m -n -r1.1.1.1 $s" 0 \
    "$f\t1.1\tline1\n$f\t1.1\tline2\n$f\t1.1.1.1\tline4 @(#)\n" \
    IGNORE

remove command.log
remove $f $s $p
success