File: jane-and-foo-do-hello-world-1-baz.sh

package info (click to toggle)
tla 1.3.5%2Bdfsg1-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 22,292 kB
  • ctags: 11,952
  • sloc: ansic: 149,771; sh: 16,009; xml: 2,689; lisp: 1,927; makefile: 1,064; cpp: 363; tcl: 230; awk: 48; sed: 25
file content (147 lines) | stat: -rw-r--r-- 3,993 bytes parent folder | download | duplicates (6)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/sh
# -*- mode: sh; coding: utf-8 -*-
# Jane and foo hack on hello-world together
# Copyright © 2003 Colin Walters <walters@verbum.org>
#
# See the file "COPYING" for further information about
# the copyright and warranty status of this work.

set -e

arg0="$0"
srcdir=`dirname "$arg0"`

. ${srcdir}/test-framework

setup_with_trivial_archives

setup () {
  :
}  

cleanup () {
  cd ${WORKDIR}
}

test_class "Jane and foo hack on hello-world"

begin_test_savectx "Jane checks out her tree"
setup
mkdir jane
cd jane
tla get jane@example.com--2003/hello-world--mainline--1.0 hello-world
cleanup
end_test_savectx

begin_test_savectx "Jane adds HACKING, fixes some grammatical issues"
setup
cd jane/hello-world
echo 'We follow the GNU coding standards' > HACKING
tla add-id HACKING
sed -e 's/Hello world/Hello, World/' < hello-world.c > hello-world.c.new
mv hello-world.c.new hello-world.c
tla commit -L 'add HACKING, fix some grammatical issues'
cleanup
end_test_savectx

begin_test_savectx "foo decides to create a branch from Jane"
setup
mkdir foo
cd foo
tla tag -S jane@example.com--2003/hello-world--mainline--1.0 foo@example.org--2003/hello-world--devo--1.3
tla get foo@example.org--2003/hello-world--devo--1.3 hello-world
cleanup
end_test_savectx 

begin_test_savectx "foo thinks hello-world.c is better named as hello_world.c"
setup
cd foo/hello-world
mv hello-world.c hello_world.c
tla move-id hello-world.c hello_world.c
tla commit -L 'rename hello-world.c to hello_world.c'
cleanup
end_test_savectx

begin_test_savectx "Jane adds a copyright header"
setup
cd jane/hello-world
(echo '/* Copyright (C) 2003 Jane Doe */'; echo '/* This file is hereby placed into the public domain. */';
 cat hello-world.c) > hello-world.c.new
mv hello-world.c.new hello-world.c
tla commit -L 'add copyright header'
cleanup
end_test_savectx

begin_test_savectx "foo adds AUTHORS"
setup
cd foo/hello-world
echo 'foo <foo@example.org>' > AUTHORS
echo 'Jane Doe <jane@example.com>' >> AUTHORS
tla add-id AUTHORS
tla commit -L 'add AUTHORS'
cleanup
end_test_savectx

begin_test_savectx "Checkpoint 1"
setup
tla get jane@example.com--2003/hello-world--mainline--1.0 jane-hello-world.tmp
cd jane-hello-world.tmp
file_matches 'Copyright.*Jane Doe' hello-world.c
file_matches 'Hello, World' hello-world.c
file_matches 'We follow.*GNU.*standards' HACKING
file_matches 'This is hello-world' README
cd ..
tla get foo@example.org--2003/hello-world--devo--1.3 foo-hello-world.tmp
cd foo-hello-world.tmp
file_matches 'Hello, World' hello_world.c
file_matches 'We follow.*GNU.*standards' HACKING
file_matches 'This is hello-world' README
file_matches 'foo' AUTHORS
file_matches 'Jane Doe' AUTHORS
cd ..
rm -rf jane-hello-world.tmp
rm -rf foo-hello-world.tmp
cleanup
end_test_savectx

begin_test_savectx "Jane thinks foo's changes are good, decides to merge"
setup
cd jane/hello-world
tla star-merge foo@example.org--2003/hello-world--devo--1.3
tla commit -L 'merge with foo'
file_matches 'Copyright.*Jane Doe' hello_world.c
file_matches 'Hello, World' hello_world.c
file_matches 'foo' AUTHORS
file_matches 'Jane Doe' AUTHORS
cleanup
end_test_savectx

begin_test_savectx "Jane puts her name first in AUTHORS"
setup
cd jane/hello-world
(grep 'Jane Doe' AUTHORS && cat AUTHORS | grep -v 'Jane Doe') > AUTHORS.new
mv AUTHORS.new AUTHORS
tla commit -L 'put my name first in AUTHORS'
cleanup
end_test_savectx

begin_test_savectx "foo decides to merge with Jane, despite her antics"
setup
cd foo/hello-world
tla star-merge jane@example.com--2003/hello-world--mainline--1.0
tla commit -L 'merge with jane'
cleanup
end_test_savectx

begin_test_savectx "Jane and foo's trees should be equivalent"
setup
tla get jane@example.com--2003/hello-world--mainline--1.0 jane-hello-world.tmp
tla get foo@example.org--2003/hello-world--devo--1.3 foo-hello-world.tmp
assert_working_tree_equivalence jane-hello-world.tmp foo-hello-world.tmp
rm -rf jane-hello-world.tmp
rm -rf foo-hello-world.tmp
cleanup
end_test_savectx


clean_workdir