File: annotate.sh

package info (click to toggle)
cssc 1.2.0-2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 3,564 kB
  • ctags: 1,387
  • sloc: cpp: 13,240; sh: 4,771; ansic: 2,992; perl: 342; makefile: 338; awk: 11
file content (59 lines) | stat: -rwxr-xr-x 1,457 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 "$get -p -n $s" 0 "$f\tline1\n$f\tline2\n" IGNORE

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

# Test both options together.
docommand N3 "$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 "$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 "$get -p -m $s" 0 \
    "1.1\tline1\n1.1\tline2\n1.2\tline3\n" \
    IGNORE

# Now make a branch.
docommand G2 "$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 "$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