File: t1800-del.sh

package info (click to toggle)
todotxt-cli 2.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 1,312 kB
  • sloc: sh: 5,393; makefile: 67
file content (153 lines) | stat: -rwxr-xr-x 2,902 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
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
148
149
150
151
152
153
#!/bin/bash

test_description='basic del functionality
'
. ./test-lib.sh

test_todo_session 'del usage' <<EOF
>>> todo.sh del B
usage: todo.sh del ITEM# [TERM]
=== 1
EOF

test_todo_session 'del nonexistant item' <<EOF
>>> todo.sh -f del 42
TODO: No task 42.
=== 1

>>> todo.sh -f del 42 Roses
TODO: No task 42.
=== 1
EOF

cat > todo.txt <<EOF
(B) smell the uppercase Roses +flowers @outside
(A) notice the sunflowers
stop
EOF
test_todo_session 'basic del' <<EOF
>>> todo.sh -p list
2 (A) notice the sunflowers
1 (B) smell the uppercase Roses +flowers @outside
3 stop
--
TODO: 3 of 3 tasks shown

>>> todo.sh -f del 1
1 (B) smell the uppercase Roses +flowers @outside
TODO: 1 deleted.

>>> todo.sh -p list
2 (A) notice the sunflowers
3 stop
--
TODO: 2 of 2 tasks shown
EOF

cat > todo.txt <<EOF
(B) smell the uppercase Roses +flowers @outside
(A) notice the sunflowers
stop
EOF
test_todo_session 'del preserving line numbers' <<EOF
>>> todo.sh -f del 1
1 (B) smell the uppercase Roses +flowers @outside
TODO: 1 deleted.

>>> todo.sh -f del 1
TODO: No task 1.
=== 1

>>> todo.sh add A new task
4 A new task
TODO: 4 added.

>>> todo.sh -p list
2 (A) notice the sunflowers
4 A new task
3 stop
--
TODO: 3 of 3 tasks shown

>>> todo.sh -f -n del 2
2 (A) notice the sunflowers
TODO: 2 deleted.

>>> todo.sh add Another new task
3 Another new task
TODO: 3 added.

>>> todo.sh -p list
2 A new task
3 Another new task
1 stop
--
TODO: 3 of 3 tasks shown
EOF

cat > todo.txt <<EOF
(B) smell the uppercase Roses +flowers @outside
(A) notice the sunflowers
(C) stop
EOF
test_todo_session 'basic del TERM' <<EOF
>>> todo.sh -p list
2 (A) notice the sunflowers
1 (B) smell the uppercase Roses +flowers @outside
3 (C) stop
--
TODO: 3 of 3 tasks shown

>>> todo.sh del 1 uppercase
1 (B) smell the uppercase Roses +flowers @outside
TODO: Removed 'uppercase' from task.
1 (B) smell the Roses +flowers @outside

>>> todo.sh -p list
2 (A) notice the sunflowers
1 (B) smell the Roses +flowers @outside
3 (C) stop
--
TODO: 3 of 3 tasks shown

>>> todo.sh del 1 "the Roses"
1 (B) smell the Roses +flowers @outside
TODO: Removed 'the Roses' from task.
1 (B) smell +flowers @outside

>>> todo.sh del 1 m
1 (B) smell +flowers @outside
TODO: Removed 'm' from task.
1 (B) sell +flowers @outside

>>> todo.sh del 1 @outside
1 (B) sell +flowers @outside
TODO: Removed '@outside' from task.
1 (B) sell +flowers

>>> todo.sh del 1 sell
1 (B) sell +flowers
TODO: Removed 'sell' from task.
1 (B) +flowers
EOF

cat > todo.txt <<EOF
(B) smell the uppercase Roses +flowers @outside
(A) notice the sunflowers
(C) stop
EOF
test_todo_session 'del nonexistant TERM' <<EOF
>>> todo.sh del 1 dung
1 (B) smell the uppercase Roses +flowers @outside
TODO: 'dung' not found; no removal done.
=== 1

>>> todo.sh -p list
2 (A) notice the sunflowers
1 (B) smell the uppercase Roses +flowers @outside
3 (C) stop
--
TODO: 3 of 3 tasks shown
EOF

test_done