File: 014_basic_tests

package info (click to toggle)
fsvs 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid, stretch
  • size: 2,964 kB
  • ctags: 1,464
  • sloc: ansic: 16,650; sh: 5,885; perl: 783; makefile: 338; python: 90
file content (98 lines) | stat: -rwxr-xr-x 1,860 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

set -e 
$PREPARE_CLEAN > /dev/null
$INCLUDE_FUNCS
cd $WC

tmp=$LOGDIR/014.fsvs-test.tmp
sleep 1

for filename in new-file1 ' ' new-file2 $STG_UTF8 $STG_LOC
do
	if [[ `$BINdflt st | wc -l` -ne 0 ]]
	then
		$BINdflt st
		$ERROR "status gave unexpected lines"
	fi

	touch "$filename"
	if [[ `$BINdflt st | wc -l` -ne 2 ]]
	then
		$ERROR_NB "Expect: . changed, '$filename' as new"
		$BINdflt st
		$ERROR "got something else."
	fi

	echo "     ci"
	$BINdflt ci -m "$filename-$RANDOM" -o delay=yes . > $tmp
	if [[ `grep -F "N...         0  ./$filename" < $tmp > /dev/null` ]]
	then
		cat $tmp
		$ERROR "expected '$filename' as new"
	else
		$SUCCESS "'$filename' is new"
	fi

	if [[ `tail -1 $tmp` == "committed revision"* ]]
	then
		$SUCCESS "found revision line"
	else
		cat $tmp
		$ERROR "expected 'committed revision'"
	fi

	$WC2_UP_ST_COMPARE
done


echo "delete a file"
rm $filename
if [[ `$BINdflt st $filename | wc -l` -ne 1 ]]
then
	$ERROR "$filename should be shown as removed!"
fi

if [[ `$BINdflt st | wc -l` -ne 2 ]]
then
	echo "Expect: . changed, $filename as deleted"
	$BINdflt st
	$ERROR "Doesn't match."
fi


if $BINdflt st does-not-exist-$$.$RANDOM.$RANDOM > $tmp 2>&1
then
	$ERROR "status doesn't stop on undefined entries"
fi


echo "     ci"
$BINdflt ci -m delete . > $tmp
if [[ `grep -F "D...         0  ./$filename" < $tmp > /dev/null` ]]
then
	cat $tmp
	$ERROR "expected $filename as deleted"
else
	$SUCCESS "$filename is deleted"
fi

if [[ `tail -1 $tmp` == "committed revision"* ]]
then
	$SUCCESS "found revision line"
else
	cat $tmp
	$ERROR "expected 'committed revision'"
fi

$WC2_UP_ST_COMPARE


# Test an entry with special (ASCII) characters.
$INFO "Testing with a strange filename."
#fn=`echo -e " :,;#*+?!'\t$\g%\\g()\n=\r[]\f{}"`
fn=" :,;#*+?!'\t$\g%\\g()\n=\r[]\f{}"
echo "$fn" > "$fn"
$BINq ci -m1
$WC2_UP_ST_COMPARE