File: test-inventory.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 (77 lines) | stat: -rw-r--r-- 2,139 bytes parent folder | download | duplicates (8)
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
#!/bin/sh
# -*- mode: sh; coding: utf-8 -*-
# Test inventory/tagging method regexps
# 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

test_class "inventory"

inventory_has () {
  class=$1
  type=$2
  fname=$3
  file_matches '^'${class}'[[:space:]]+'${type}'[[:space:]]*'${fname} ../,inventory
}

begin_test_savectx "simple source inventory"
tla get jane@example.com--2003/hello-world--mainline--1.0 hello-world
cd hello-world
tla inventory > ../,inventory
inventory_has 'S' '' 'README'
inventory_has 'S' '' 'hello-world\.c'
end_test_savectx 

begin_test_savectx "simple junk inventory"
touch ',,test-junk'
touch ',other-junk'
tla inventory --junk > ../,inventory
file_matches ',,test-junk' ../,inventory
file_matches ',other-junk' ../,inventory
end_test_savectx

begin_test_savectx "simple junk and source inventory"
tla inventory --kind --source --junk > ../,inventory
inventory_has 'S' 'r' 'README'
inventory_has 'S' 'r' 'hello-world\.c'
inventory_has 'J' 'r' ',,test-junk'
inventory_has 'J' 'r' ',other-junk'
end_test_savectx

begin_test_savectx "default untagged source is precious"
touch blargh
test "$(tla inventory -p)" = "blargh"
end_test_savectx

begin_test_savectx "change junk regexp to match \"README\""
tla id-tagging-defaults | egrep -v '^junk' > '{arch}/=tagging-method'
echo 'junk ^(,.*)|(README)$' >> '{arch}/=tagging-method'
tla inventory --kind --source --junk > ../,inventory
inventory_has 'J' 'r' ',,test-junk'
inventory_has 'J' 'r' 'README'
inventory_has 'S' 'r' 'hello-world\.c'
end_test_savectx

begin_test_savectx "two junk regexps"
tla id-tagging-defaults > '{arch}/=tagging-method'
echo 'junk ^README$' >> '{arch}/=tagging-method'
tla inventory --kind --source --junk > ../,inventory
inventory_has 'J' 'r' ',,test-junk'
inventory_has 'J' 'r' 'README'
inventory_has 'S' 'r' 'hello-world\.c'
end_test_savectx

clean_workdir

# tag: Colin Walters Sun, 12 Oct 2003 12:43:30 -0400 (test-inventory.sh)
#