-
Notifications
You must be signed in to change notification settings - Fork 1
/
t
executable file
·93 lines (71 loc) · 1.06 KB
/
t
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
#!/bin/sh
set -eux;
TRC=${TRC:-}
ED=edlin
make ${ED};
### File Creation Tests ###
${TRC} ./${ED} creat.txt <<EOF
e
EOF
rm -v creat.txt
${TRC} ./${ED} creat.txt <<EOF
wdifferent.txt
EOF
rm -v different.txt
### Basic Text Editing Test ###
F1=$(cat <<EOF
#include <stdio.h>
int main(void) {
puts("Hello, World!");
return 0;
}
EOF
);
${TRC} ./${ED} <<EOF
a
${F1}
.
e1.txt
EOF
### Transfer, No Line Number ###
echo "${F1}" > 0.txt
diff -w 0.txt 1.txt
rm -v 1.txt
echo "${F1}" > 2.txt
echo "${F1}" >> 2.txt
${TRC} ./${ED} 0.txt <<EOF
t
e3.txt
EOF
diff -w 2.txt 3.txt
rm -v 0.txt 2.txt 3.txt
### Multiple commands per line ###
echo "${F1}" > 4.txt
${TRC} ./${ED} <<EOF
i;e5.txt
${F1}
.
EOF
diff -w 4.txt 5.txt
rm -v 4.txt 5.txt
### Copy Lines ###
COPY=$(cat <<EOF
#include <stdio.h>
int main(void) {
puts("Hello, World!");
puts("Hello, World!");
puts("Hello, World!");
return 0;
}
EOF
);
rm -fv 8.txt
echo "${F1}" > 6.txt
echo "${COPY}" > 7.txt
${TRC} ./${ED} 6.txt <<EOF
4,4,1,2c;e8.txt
EOF
diff -w 7.txt 8.txt
rm -v 6.txt 7.txt 8.txt
### END ###
echo PASSED