Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/bin/ed/tests/ed_test.sh
178586 views
1
# SPDX-License-Identifier: BSD-2-Clause
2
# Copyright (c) 2025 Baptiste Daroussin <[email protected]>
3
4
# Helper: create standard 5-line data file
5
create_std_data()
6
{
7
cat > "$1" <<'EOF'
8
line 1
9
line 2
10
line 3
11
line 4
12
line5
13
EOF
14
}
15
16
# ---------------------------------------------------------------------------
17
# Append (a)
18
# ---------------------------------------------------------------------------
19
atf_test_case append
20
append_head()
21
{
22
atf_set "descr" "Test append command (a)"
23
}
24
25
append_body()
26
{
27
create_std_data input.txt
28
ed -s - <<'CMDS'
29
H
30
r input.txt
31
0a
32
hello world
33
.
34
2a
35
hello world!
36
.
37
$a
38
hello world!!
39
.
40
w output.txt
41
CMDS
42
cat > expected.txt <<'EOF'
43
hello world
44
line 1
45
hello world!
46
line 2
47
line 3
48
line 4
49
line5
50
hello world!!
51
EOF
52
atf_check cmp output.txt expected.txt
53
}
54
55
# ---------------------------------------------------------------------------
56
# Address parsing (addr)
57
# ---------------------------------------------------------------------------
58
atf_test_case address
59
address_head()
60
{
61
atf_set "descr" "Test complex address parsing"
62
}
63
address_body()
64
{
65
cat > input.txt <<'EOF'
66
line 1
67
line 2
68
line 3
69
line 4
70
line5
71
1ine6
72
line7
73
line8
74
line9
75
EOF
76
ed -s - <<'CMDS'
77
H
78
r input.txt
79
1 d
80
1 1 d
81
1,2,d
82
1;+ + ,d
83
1,2;., + 2d
84
w output.txt
85
CMDS
86
cat > expected.txt <<'EOF'
87
line 2
88
line9
89
EOF
90
atf_check cmp output.txt expected.txt
91
}
92
93
# ---------------------------------------------------------------------------
94
# Change (c)
95
# ---------------------------------------------------------------------------
96
atf_test_case change
97
change_head()
98
{
99
atf_set "descr" "Test change command (c)"
100
}
101
change_body()
102
{
103
create_std_data input.txt
104
ed -s - <<'CMDS'
105
H
106
r input.txt
107
1c
108
at the top
109
.
110
4c
111
in the middle
112
.
113
$c
114
at the bottom
115
.
116
2,3c
117
between top/middle
118
.
119
w output.txt
120
CMDS
121
cat > expected.txt <<'EOF'
122
at the top
123
between top/middle
124
in the middle
125
at the bottom
126
EOF
127
atf_check cmp output.txt expected.txt
128
}
129
130
# ---------------------------------------------------------------------------
131
# Delete (d)
132
# ---------------------------------------------------------------------------
133
atf_test_case delete
134
delete_head()
135
{
136
atf_set "descr" "Test delete command (d)"
137
}
138
delete_body()
139
{
140
create_std_data input.txt
141
ed -s - <<'CMDS'
142
H
143
r input.txt
144
1d
145
2;+1d
146
$d
147
w output.txt
148
CMDS
149
printf 'line 2\n' > expected.txt
150
atf_check cmp output.txt expected.txt
151
}
152
153
# ---------------------------------------------------------------------------
154
# Insert (i)
155
# ---------------------------------------------------------------------------
156
atf_test_case insert
157
insert_head()
158
{
159
atf_set "descr" "Test insert command (i)"
160
}
161
insert_body()
162
{
163
create_std_data input.txt
164
ed -s - <<'CMDS'
165
H
166
r input.txt
167
1i
168
hello world
169
.
170
2i
171
hello world!
172
.
173
$i
174
hello world!!
175
.
176
w output.txt
177
CMDS
178
cat > expected.txt <<'EOF'
179
hello world
180
hello world!
181
line 1
182
line 2
183
line 3
184
line 4
185
hello world!!
186
line5
187
EOF
188
atf_check cmp output.txt expected.txt
189
}
190
191
# ---------------------------------------------------------------------------
192
# Join (j)
193
# ---------------------------------------------------------------------------
194
atf_test_case join
195
join_head()
196
{
197
atf_set "descr" "Test join command (j)"
198
}
199
join_body()
200
{
201
create_std_data input.txt
202
ed -s - <<'CMDS'
203
H
204
r input.txt
205
1,1j
206
2,3j
207
w output.txt
208
CMDS
209
cat > expected.txt <<'EOF'
210
line 1
211
line 2line 3
212
line 4
213
line5
214
EOF
215
atf_check cmp output.txt expected.txt
216
}
217
218
# ---------------------------------------------------------------------------
219
# Mark (k)
220
# ---------------------------------------------------------------------------
221
atf_test_case mark
222
mark_head()
223
{
224
atf_set "descr" "Test mark and reference commands (k, ')"
225
}
226
mark_body()
227
{
228
create_std_data input.txt
229
ed -s - <<'CMDS'
230
H
231
r input.txt
232
2ka
233
1d
234
'am$
235
1ka
236
0a
237
hello world
238
.
239
'ad
240
u
241
'am0
242
w output.txt
243
CMDS
244
cat > expected.txt <<'EOF'
245
line 3
246
hello world
247
line 4
248
line5
249
line 2
250
EOF
251
atf_check cmp output.txt expected.txt
252
}
253
254
# ---------------------------------------------------------------------------
255
# Move (m)
256
# ---------------------------------------------------------------------------
257
atf_test_case move
258
move_head()
259
{
260
atf_set "descr" "Test move command (m)";
261
}
262
move_body()
263
{
264
265
create_std_data input.txt
266
ed -s - <<'CMDS'
267
H
268
r input.txt
269
1,2m$
270
1,2m$
271
1,2m$
272
$m0
273
$m0
274
2,3m1
275
2,3m3
276
w output.txt
277
CMDS
278
cat > expected.txt <<'EOF'
279
line5
280
line 1
281
line 2
282
line 3
283
line 4
284
EOF
285
atf_check cmp output.txt expected.txt
286
}
287
288
# ---------------------------------------------------------------------------
289
# Transfer / Copy (t)
290
# ---------------------------------------------------------------------------
291
atf_test_case transfer
292
transfer_head()
293
{
294
atf_set "descr" "Test transfer/copy command (t)";
295
}
296
transfer_body()
297
{
298
299
create_std_data input.txt
300
ed -s - <<'CMDS'
301
H
302
r input.txt
303
1t0
304
2,3t2
305
,t$
306
w output.txt
307
CMDS
308
cat > expected.txt <<'EOF'
309
line 1
310
line 1
311
line 1
312
line 2
313
line 2
314
line 3
315
line 4
316
line5
317
line 1
318
line 1
319
line 1
320
line 2
321
line 2
322
line 3
323
line 4
324
line5
325
EOF
326
atf_check cmp output.txt expected.txt
327
}
328
329
atf_test_case transfer_search
330
transfer_search_head()
331
{
332
atf_set "descr" "Test transfer with address search (t)";
333
}
334
transfer_search_body()
335
{
336
337
create_std_data input.txt
338
ed -s - <<'CMDS'
339
H
340
r input.txt
341
t0;/./
342
w output.txt
343
CMDS
344
cat > expected.txt <<'EOF'
345
line 1
346
line5
347
line 2
348
line 3
349
line 4
350
line5
351
EOF
352
atf_check cmp output.txt expected.txt
353
}
354
355
# ---------------------------------------------------------------------------
356
# Undo (u)
357
# ---------------------------------------------------------------------------
358
atf_test_case undo
359
undo_head()
360
{
361
atf_set "descr" "Test undo command (u)";
362
}
363
undo_body()
364
{
365
366
create_std_data input.txt
367
printf 'dummy\n' > readfile.txt
368
ed -s - <<'CMDS'
369
H
370
r input.txt
371
1;r readfile.txt
372
u
373
a
374
hello
375
world
376
.
377
g/./s//x/\
378
a\
379
hello\
380
world
381
u
382
u
383
u
384
a
385
hello world!
386
.
387
u
388
1,$d
389
u
390
2,3d
391
u
392
c
393
hello world!!
394
.
395
u
396
u
397
-1;.,+1j
398
u
399
u
400
u
401
.,+1t$
402
w output.txt
403
CMDS
404
cat > expected.txt <<'EOF'
405
line 1
406
hello
407
hello world!!
408
line 2
409
line 3
410
line 4
411
line5
412
hello
413
hello world!!
414
EOF
415
atf_check cmp output.txt expected.txt
416
}
417
418
# ---------------------------------------------------------------------------
419
# Global (g)
420
# ---------------------------------------------------------------------------
421
atf_test_case global_move
422
global_move_head()
423
{
424
atf_set "descr" "Test global command with move (g)";
425
}
426
global_move_body()
427
{
428
429
create_std_data input.txt
430
ed -s - <<'CMDS'
431
H
432
r input.txt
433
g/./m0
434
g/./s/$/\
435
hello world
436
g/hello /s/lo/p!/\
437
a\
438
order
439
w output.txt
440
CMDS
441
cat > expected.txt <<'EOF'
442
line5
443
help! world
444
order
445
line 4
446
help! world
447
order
448
line 3
449
help! world
450
order
451
line 2
452
help! world
453
order
454
line 1
455
help! world
456
order
457
EOF
458
atf_check cmp output.txt expected.txt
459
}
460
461
atf_test_case global_change
462
global_change_head()
463
{
464
atf_set "descr" "Test global command with change (g)";
465
}
466
global_change_body()
467
{
468
469
create_std_data input.txt
470
ed -s - <<'CMDS'
471
H
472
r input.txt
473
g/[2-4]/-1,+1c\
474
hello world
475
w output.txt
476
CMDS
477
printf 'hello world\n' > expected.txt
478
atf_check cmp output.txt expected.txt
479
}
480
481
atf_test_case global_substitute
482
global_substitute_head()
483
{
484
atf_set "descr" "Test global with substitute and move (g)";
485
}
486
global_substitute_body()
487
{
488
489
create_std_data input.txt
490
ed -s - <<'CMDS'
491
H
492
r input.txt
493
g/./s//x/\
494
3m0
495
g/./s/e/c/\
496
2,3m1
497
w output.txt
498
CMDS
499
cat > expected.txt <<'EOF'
500
linc 3
501
xine 1
502
xine 2
503
xinc 4
504
xinc5
505
EOF
506
atf_check cmp output.txt expected.txt
507
}
508
509
atf_test_case global_undo
510
global_undo_head()
511
{
512
atf_set "descr" "Test global with undo (g)";
513
}
514
global_undo_body()
515
{
516
517
create_std_data input.txt
518
ed -s - <<'CMDS'
519
H
520
r input.txt
521
g/./s/./x/\
522
u\
523
s/./y/\
524
u\
525
s/./z/\
526
u
527
u
528
0a
529
hello
530
.
531
$a
532
world
533
.
534
w output.txt
535
CMDS
536
cat > expected.txt <<'EOF'
537
hello
538
zine 1
539
line 2
540
line 3
541
line 4
542
line5
543
world
544
EOF
545
atf_check cmp output.txt expected.txt
546
}
547
548
atf_test_case global_copy
549
global_copy_head()
550
{
551
atf_set "descr" "Test global with copy (g)";
552
}
553
global_copy_body()
554
{
555
556
cat > input.txt <<'EOF'
557
line 1
558
line 2
559
line 3
560
EOF
561
ed -s - <<'CMDS'
562
H
563
r input.txt
564
g/./1,3t$\
565
1d
566
w output.txt
567
CMDS
568
cat > expected.txt <<'EOF'
569
line 1
570
line 2
571
line 3
572
line 2
573
line 3
574
line 1
575
line 3
576
line 1
577
line 2
578
EOF
579
atf_check cmp output.txt expected.txt
580
}
581
582
# ---------------------------------------------------------------------------
583
# Inverse global (v)
584
# ---------------------------------------------------------------------------
585
atf_test_case inverse_global
586
inverse_global_head()
587
{
588
atf_set "descr" "Test inverse global command (v)";
589
}
590
inverse_global_body()
591
{
592
593
create_std_data input.txt
594
ed -s - <<'CMDS'
595
H
596
r input.txt
597
v/[ ]/m0
598
v/[ ]/s/$/\
599
hello world
600
v/hello /s/lo/p!/\
601
a\
602
order
603
w output.txt
604
CMDS
605
cat > expected.txt <<'EOF'
606
line5
607
order
608
hello world
609
line 1
610
order
611
line 2
612
order
613
line 3
614
order
615
line 4
616
order
617
EOF
618
atf_check cmp output.txt expected.txt
619
}
620
621
# ---------------------------------------------------------------------------
622
# Substitution (s)
623
# ---------------------------------------------------------------------------
624
atf_test_case subst_backreference
625
subst_backreference_head()
626
{
627
atf_set "descr" "Test substitute with backreferences (s)";
628
}
629
subst_backreference_body()
630
{
631
632
create_std_data input.txt
633
ed -s - <<'CMDS'
634
H
635
r input.txt
636
s/\([^ ][^ ]*\)/(\1)/g
637
2s
638
/3/s
639
/\(4\)/sr
640
/\(.\)/srg
641
%s/i/&e/
642
w output.txt
643
CMDS
644
cat > expected.txt <<'EOF'
645
liene 1
646
(liene) (2)
647
(liene) (3)
648
liene (4)
649
(()liene5)
650
EOF
651
atf_check cmp output.txt expected.txt
652
}
653
654
atf_test_case subst_range
655
subst_range_head()
656
{
657
atf_set "descr" "Test substitute on range with count and repeat (s)";
658
}
659
subst_range_body()
660
{
661
662
create_std_data input.txt
663
ed -s - <<'CMDS'
664
H
665
r input.txt
666
,s/./(&)/3
667
s/$/00
668
2s//%/g
669
s/^l
670
w output.txt
671
CMDS
672
cat > expected.txt <<'EOF'
673
li(n)e 1
674
i(n)e 200
675
li(n)e 3
676
li(n)e 4
677
li(n)e500
678
EOF
679
atf_check cmp output.txt expected.txt
680
}
681
682
atf_test_case subst_charclass
683
subst_charclass_head()
684
{
685
atf_set "descr" "Test substitute with character classes (s)";
686
}
687
subst_charclass_body()
688
{
689
690
ed -s - <<'CMDS'
691
H
692
a
693
hello/[]world
694
.
695
s/[/]/ /
696
s/[[:digit:][]/ /
697
s/[]]/ /
698
w output.txt
699
CMDS
700
printf 'hello world\n' > expected.txt
701
atf_check cmp output.txt expected.txt
702
}
703
704
# ---------------------------------------------------------------------------
705
# Edit (e/E)
706
# ---------------------------------------------------------------------------
707
atf_test_case edit_file
708
edit_file_head()
709
{
710
atf_set "descr" "Test edit file command (E)";
711
}
712
edit_file_body()
713
{
714
715
printf 'hello world\n' > input.txt
716
printf 'E e1_data.txt\n' > e1_data.txt
717
ed -s - <<'CMDS'
718
H
719
r input.txt
720
E e1_data.txt
721
w output.txt
722
CMDS
723
printf 'E e1_data.txt\n' > expected.txt
724
atf_check cmp output.txt expected.txt
725
}
726
727
atf_test_case edit_command
728
edit_command_head()
729
{
730
atf_set "descr" "Test edit with shell command (E !)";
731
}
732
edit_command_body()
733
{
734
735
printf 'E !echo hello world-\n' > input.txt
736
ed -s - <<'CMDS'
737
H
738
r input.txt
739
E !echo hello world-
740
w output.txt
741
CMDS
742
printf 'hello world-\n' > expected.txt
743
atf_check cmp output.txt expected.txt
744
}
745
746
atf_test_case edit_reread
747
edit_reread_head()
748
{
749
atf_set "descr" "Test edit re-read default file (E)";
750
}
751
edit_reread_body()
752
{
753
754
printf 'E !echo hello world-\n' > input.txt
755
ed -s - <<'CMDS'
756
H
757
r input.txt
758
E
759
w output.txt
760
CMDS
761
printf 'E !echo hello world-\n' > expected.txt
762
atf_check cmp output.txt expected.txt
763
}
764
765
atf_test_case edit_lowercase
766
edit_lowercase_head()
767
{
768
atf_set "descr" "Test lowercase edit re-read (e)";
769
}
770
edit_lowercase_body()
771
{
772
773
printf 'E !echo hello world-\n' > input.txt
774
ed -s - <<'CMDS'
775
H
776
r input.txt
777
e
778
w output.txt
779
CMDS
780
printf 'E !echo hello world-\n' > expected.txt
781
atf_check cmp output.txt expected.txt
782
}
783
784
# ---------------------------------------------------------------------------
785
# Read (r)
786
# ---------------------------------------------------------------------------
787
atf_test_case read_command
788
read_command_head()
789
{
790
atf_set "descr" "Test read with shell command (r !)";
791
}
792
read_command_body()
793
{
794
795
create_std_data input.txt
796
ed -s - <<'CMDS'
797
H
798
r input.txt
799
1;r !echo hello world
800
1
801
r !echo hello world
802
w output.txt
803
CMDS
804
cat > expected.txt <<'EOF'
805
line 1
806
hello world
807
line 2
808
line 3
809
line 4
810
line5
811
hello world
812
EOF
813
atf_check cmp output.txt expected.txt
814
}
815
816
atf_test_case read_default
817
read_default_head()
818
{
819
atf_set "descr" "Test read with default filename (r)";
820
}
821
read_default_body()
822
{
823
824
create_std_data input.txt
825
ed -s - <<'CMDS'
826
H
827
r input.txt
828
r
829
w output.txt
830
CMDS
831
cat > expected.txt <<'EOF'
832
line 1
833
line 2
834
line 3
835
line 4
836
line5
837
line 1
838
line 2
839
line 3
840
line 4
841
line5
842
EOF
843
atf_check cmp output.txt expected.txt
844
}
845
846
atf_test_case read_file
847
read_file_head()
848
{
849
atf_set "descr" "Test read from file (r)";
850
}
851
read_file_body()
852
{
853
854
printf 'r r3_data.txt\n' > r3_data.txt
855
ed -s - <<'CMDS'
856
H
857
r r3_data.txt
858
r r3_data.txt
859
w output.txt
860
CMDS
861
cat > expected.txt <<'EOF'
862
r r3_data.txt
863
r r3_data.txt
864
EOF
865
atf_check cmp output.txt expected.txt
866
}
867
868
# ---------------------------------------------------------------------------
869
# Write (w)
870
# ---------------------------------------------------------------------------
871
atf_test_case write_pipe
872
write_pipe_head()
873
{
874
atf_set "descr" "Test write to shell command (w !)";
875
}
876
write_pipe_body()
877
{
878
879
create_std_data input.txt
880
ed -s - <<'CMDS'
881
H
882
r input.txt
883
w !cat >\!.z
884
r \!.z
885
w output.txt
886
CMDS
887
cat > expected.txt <<'EOF'
888
line 1
889
line 2
890
line 3
891
line 4
892
line5
893
line 1
894
line 2
895
line 3
896
line 4
897
line5
898
EOF
899
atf_check cmp output.txt expected.txt
900
}
901
902
# ---------------------------------------------------------------------------
903
# Quit (q)
904
# ---------------------------------------------------------------------------
905
atf_test_case quit
906
quit_head()
907
{
908
atf_set "descr" "Test quit command (q)";
909
}
910
quit_body()
911
{
912
913
ed -s - <<'CMDS'
914
H
915
w output.txt
916
a
917
hello
918
.
919
q
920
CMDS
921
atf_check -s exit:0 test ! -s output.txt
922
}
923
924
# ---------------------------------------------------------------------------
925
# Shell command (!)
926
# ---------------------------------------------------------------------------
927
atf_test_case shell_command
928
shell_command_head()
929
{
930
atf_set "descr" "Test shell command execution (!)";
931
}
932
shell_command_body()
933
{
934
935
ed -s - <<'CMDS'
936
H
937
!read one
938
hello, world
939
a
940
okay
941
.
942
w output.txt
943
CMDS
944
printf 'okay\n' > expected.txt
945
atf_check cmp output.txt expected.txt
946
}
947
948
# ---------------------------------------------------------------------------
949
# Newline handling (nl)
950
# ---------------------------------------------------------------------------
951
atf_test_case newline_insert
952
newline_insert_head()
953
{
954
atf_set "descr" "Test inserting blank lines";
955
}
956
newline_insert_body()
957
{
958
959
create_std_data input.txt
960
ed -s - <<'CMDS'
961
H
962
r input.txt
963
1
964
965
966
0a
967
968
969
hello world
970
.
971
w output.txt
972
CMDS
973
cat > expected.txt <<'EOF'
974
975
976
hello world
977
line 1
978
line 2
979
line 3
980
line 4
981
line5
982
EOF
983
atf_check cmp output.txt expected.txt
984
}
985
986
atf_test_case newline_search
987
newline_search_head()
988
{
989
atf_set "descr" "Test address search with semicolon";
990
}
991
newline_search_body()
992
{
993
994
create_std_data input.txt
995
ed -s - <<'CMDS'
996
H
997
r input.txt
998
a
999
hello world
1000
.
1001
0;/./
1002
w output.txt
1003
CMDS
1004
cat > expected.txt <<'EOF'
1005
line 1
1006
line 2
1007
line 3
1008
line 4
1009
line5
1010
hello world
1011
EOF
1012
atf_check cmp output.txt expected.txt
1013
}
1014
1015
# ---------------------------------------------------------------------------
1016
# Error tests
1017
# ---------------------------------------------------------------------------
1018
atf_test_case err_append_suffix
1019
err_append_suffix_head()
1020
{
1021
atf_set "descr" "Error: invalid append suffix (aa)";
1022
}
1023
err_append_suffix_body()
1024
{
1025
1026
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1027
H
1028
aa
1029
hello world
1030
.
1031
CMDS
1032
}
1033
1034
atf_test_case err_addr_out_of_range
1035
err_addr_out_of_range_head()
1036
{
1037
atf_set "descr" "Error: address out of range";
1038
}
1039
err_addr_out_of_range_body()
1040
{
1041
1042
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1043
H
1044
100
1045
CMDS
1046
}
1047
1048
atf_test_case err_addr_negative
1049
err_addr_negative_head()
1050
{
1051
atf_set "descr" "Error: negative address";
1052
}
1053
err_addr_negative_body()
1054
{
1055
1056
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1057
H
1058
-100
1059
CMDS
1060
}
1061
1062
atf_test_case err_bang_addr
1063
err_bang_addr_head()
1064
{
1065
atf_set "descr" "Error: shell command with address";
1066
}
1067
err_bang_addr_body()
1068
{
1069
1070
printf 'test\n' > input.txt
1071
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1072
H
1073
r input.txt
1074
.!date
1075
CMDS
1076
}
1077
1078
atf_test_case err_bang_double
1079
err_bang_double_head()
1080
{
1081
atf_set "descr" "Error: double bang without previous command";
1082
}
1083
err_bang_double_body()
1084
{
1085
1086
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1087
H
1088
!!
1089
CMDS
1090
}
1091
1092
atf_test_case err_change_suffix
1093
err_change_suffix_head()
1094
{
1095
atf_set "descr" "Error: invalid change suffix (cc)";
1096
}
1097
err_change_suffix_body()
1098
{
1099
1100
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1101
H
1102
cc
1103
hello world
1104
.
1105
CMDS
1106
}
1107
1108
atf_test_case err_change_zero
1109
err_change_zero_head()
1110
{
1111
atf_set "descr" "Error: change at line 0";
1112
}
1113
err_change_zero_body()
1114
{
1115
1116
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1117
H
1118
0c
1119
hello world
1120
.
1121
CMDS
1122
}
1123
1124
atf_test_case err_delete_suffix
1125
err_delete_suffix_head()
1126
{
1127
atf_set "descr" "Error: invalid delete suffix (dd)";
1128
}
1129
err_delete_suffix_body()
1130
{
1131
1132
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1133
H
1134
dd
1135
CMDS
1136
}
1137
1138
atf_test_case err_edit_suffix
1139
err_edit_suffix_head()
1140
{
1141
atf_set "descr" "Error: invalid edit suffix (ee)";
1142
}
1143
err_edit_suffix_body()
1144
{
1145
1146
printf 'test\n' > e1.err
1147
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1148
H
1149
ee e1.err
1150
CMDS
1151
}
1152
1153
atf_test_case err_edit_addr
1154
err_edit_addr_head()
1155
{
1156
atf_set "descr" "Error: edit with address";
1157
}
1158
err_edit_addr_body()
1159
{
1160
1161
printf 'test\n' > e2.err
1162
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1163
H
1164
r e2.err
1165
.e e2.err
1166
CMDS
1167
}
1168
1169
atf_test_case err_edit_nosuffix
1170
err_edit_nosuffix_head()
1171
{
1172
atf_set "descr" "Error: edit without space before filename";
1173
}
1174
err_edit_nosuffix_body()
1175
{
1176
1177
printf 'test\n' > ee.err
1178
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1179
H
1180
ee.err
1181
CMDS
1182
}
1183
1184
atf_test_case err_file_addr
1185
err_file_addr_head()
1186
{
1187
atf_set "descr" "Error: file command with address";
1188
}
1189
err_file_addr_body()
1190
{
1191
1192
printf 'test\n' > input.txt
1193
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1194
H
1195
r input.txt
1196
.f f1.err
1197
CMDS
1198
}
1199
1200
atf_test_case err_file_suffix
1201
err_file_suffix_head()
1202
{
1203
atf_set "descr" "Error: invalid file suffix";
1204
}
1205
err_file_suffix_body()
1206
{
1207
1208
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1209
H
1210
ff1.err
1211
CMDS
1212
}
1213
1214
atf_test_case err_global_delim
1215
err_global_delim_head()
1216
{
1217
atf_set "descr" "Error: invalid pattern delimiter in global";
1218
}
1219
err_global_delim_body()
1220
{
1221
1222
printf 'test\n' > input.txt
1223
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1224
H
1225
r input.txt
1226
g/./s //x/
1227
CMDS
1228
}
1229
1230
atf_test_case err_global_empty
1231
err_global_empty_head()
1232
{
1233
atf_set "descr" "Error: empty pattern in global";
1234
}
1235
err_global_empty_body()
1236
{
1237
1238
printf 'test\n' > input.txt
1239
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1240
H
1241
r input.txt
1242
g//s/./x/
1243
CMDS
1244
}
1245
1246
atf_test_case err_global_incomplete
1247
err_global_incomplete_head()
1248
{
1249
atf_set "descr" "Error: incomplete global command";
1250
}
1251
err_global_incomplete_body()
1252
{
1253
1254
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1255
H
1256
g
1257
CMDS
1258
}
1259
1260
atf_test_case err_help_addr
1261
err_help_addr_head()
1262
{
1263
atf_set "descr" "Error: help with address";
1264
}
1265
err_help_addr_body()
1266
{
1267
1268
printf 'test\n' > input.txt
1269
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1270
H
1271
r input.txt
1272
.h
1273
CMDS
1274
}
1275
1276
atf_test_case err_insert_suffix
1277
err_insert_suffix_head()
1278
{
1279
atf_set "descr" "Error: invalid insert suffix (ii)";
1280
}
1281
err_insert_suffix_body()
1282
{
1283
1284
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1285
H
1286
ii
1287
hello world
1288
.
1289
CMDS
1290
}
1291
1292
atf_test_case err_insert_zero
1293
err_insert_zero_head()
1294
{
1295
atf_set "descr" "Error: insert at line 0";
1296
}
1297
err_insert_zero_body()
1298
{
1299
1300
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1301
H
1302
0i
1303
hello world
1304
.
1305
CMDS
1306
}
1307
1308
atf_test_case err_mark_upper
1309
err_mark_upper_head()
1310
{
1311
atf_set "descr" "Error: mark with uppercase letter";
1312
}
1313
err_mark_upper_body()
1314
{
1315
1316
printf 'test\n' > input.txt
1317
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1318
H
1319
r input.txt
1320
kA
1321
CMDS
1322
}
1323
1324
atf_test_case err_mark_zero
1325
err_mark_zero_head()
1326
{
1327
atf_set "descr" "Error: mark at line 0";
1328
}
1329
err_mark_zero_body()
1330
{
1331
1332
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1333
H
1334
0ka
1335
CMDS
1336
}
1337
1338
atf_test_case err_mark_ref
1339
err_mark_ref_head()
1340
{
1341
atf_set "descr" "Error: reference to deleted mark";
1342
}
1343
err_mark_ref_body()
1344
{
1345
1346
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1347
H
1348
a
1349
hello
1350
.
1351
.ka
1352
'ad
1353
'ap
1354
CMDS
1355
}
1356
1357
atf_test_case err_move_dest
1358
err_move_dest_head()
1359
{
1360
atf_set "descr" "Error: move to own range";
1361
}
1362
err_move_dest_body()
1363
{
1364
1365
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1366
H
1367
a
1368
hello
1369
world
1370
.
1371
1,$m1
1372
CMDS
1373
}
1374
1375
atf_test_case err_quit_addr
1376
err_quit_addr_head()
1377
{
1378
atf_set "descr" "Error: quit with address";
1379
}
1380
err_quit_addr_body()
1381
{
1382
1383
printf 'test\n' > input.txt
1384
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1385
H
1386
r input.txt
1387
.q
1388
CMDS
1389
}
1390
1391
atf_test_case err_read_nofile
1392
err_read_nofile_head()
1393
{
1394
atf_set "descr" "Error: read nonexistent file";
1395
}
1396
err_read_nofile_body()
1397
{
1398
1399
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1400
H
1401
r a-good-book
1402
CMDS
1403
}
1404
1405
atf_test_case err_subst_delim
1406
err_subst_delim_head()
1407
{
1408
atf_set "descr" "Error: invalid substitute delimiter";
1409
}
1410
err_subst_delim_body()
1411
{
1412
1413
printf 'test\n' > input.txt
1414
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1415
H
1416
r input.txt
1417
s . x
1418
CMDS
1419
}
1420
1421
atf_test_case err_subst_infinite
1422
err_subst_infinite_head()
1423
{
1424
atf_set "descr" "Error: infinite substitution loop";
1425
}
1426
err_subst_infinite_body()
1427
{
1428
1429
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1430
H
1431
a
1432
a
1433
.
1434
s/x*/a/g
1435
CMDS
1436
}
1437
1438
atf_test_case err_subst_bracket
1439
err_subst_bracket_head()
1440
{
1441
atf_set "descr" "Error: unbalanced brackets in substitute";
1442
}
1443
err_subst_bracket_body()
1444
{
1445
1446
printf 'test\n' > input.txt
1447
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1448
H
1449
r input.txt
1450
s/[xyx/a/
1451
CMDS
1452
}
1453
1454
atf_test_case err_subst_escape
1455
err_subst_escape_head()
1456
{
1457
atf_set "descr" "Error: invalid escape in substitute pattern";
1458
}
1459
err_subst_escape_body()
1460
{
1461
1462
printf 'test\n' > input.txt
1463
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1464
H
1465
r input.txt
1466
s/\a\b\c/xyz/
1467
CMDS
1468
}
1469
1470
atf_test_case err_subst_empty
1471
err_subst_empty_head()
1472
{
1473
atf_set "descr" "Error: empty substitute pattern";
1474
}
1475
err_subst_empty_body()
1476
{
1477
1478
printf 'test\n' > input.txt
1479
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1480
H
1481
r input.txt
1482
s//xyz/
1483
CMDS
1484
}
1485
1486
atf_test_case err_subst_bare
1487
err_subst_bare_head()
1488
{
1489
atf_set "descr" "Error: bare substitute without previous";
1490
}
1491
err_subst_bare_body()
1492
{
1493
1494
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1495
H
1496
s
1497
CMDS
1498
}
1499
1500
atf_test_case err_subst_sr
1501
err_subst_sr_head()
1502
{
1503
atf_set "descr" "Error: invalid sr suffix";
1504
}
1505
err_subst_sr_body()
1506
{
1507
1508
atf_check -s exit:2 -o ignore -e not-empty ed -s - <<'CMDS'
1509
H
1510
a
1511
hello world
1512
.
1513
/./
1514
sr
1515
CMDS
1516
}
1517
1518
atf_test_case err_subst_equiv
1519
err_subst_equiv_head()
1520
{
1521
atf_set "descr" "Error: invalid equivalence class in substitute";
1522
}
1523
err_subst_equiv_body()
1524
{
1525
1526
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1527
H
1528
a
1529
hello
1530
.
1531
s/[h[=]/x/
1532
CMDS
1533
}
1534
1535
atf_test_case err_subst_class
1536
err_subst_class_head()
1537
{
1538
atf_set "descr" "Error: unterminated character class";
1539
}
1540
err_subst_class_body()
1541
{
1542
1543
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1544
H
1545
a
1546
hello
1547
.
1548
s/[h[:]/x/
1549
CMDS
1550
}
1551
1552
atf_test_case err_subst_collate
1553
err_subst_collate_head()
1554
{
1555
atf_set "descr" "Error: invalid collation class";
1556
}
1557
err_subst_collate_body()
1558
{
1559
1560
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1561
H
1562
a
1563
hello
1564
.
1565
s/[h[.]/x/
1566
CMDS
1567
}
1568
1569
atf_test_case err_transfer_suffix
1570
err_transfer_suffix_head()
1571
{
1572
atf_set "descr" "Error: invalid transfer suffix (tt)";
1573
}
1574
err_transfer_suffix_body()
1575
{
1576
1577
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1578
H
1579
tt
1580
CMDS
1581
}
1582
1583
atf_test_case err_transfer_addr
1584
err_transfer_addr_head()
1585
{
1586
atf_set "descr" "Error: invalid transfer address";
1587
}
1588
err_transfer_addr_body()
1589
{
1590
1591
printf 'test\n' > input.txt
1592
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1593
H
1594
r input.txt
1595
t0;-1
1596
CMDS
1597
}
1598
1599
atf_test_case err_undo_addr
1600
err_undo_addr_head()
1601
{
1602
atf_set "descr" "Error: undo with address";
1603
}
1604
err_undo_addr_body()
1605
{
1606
1607
printf 'test\n' > input.txt
1608
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1609
H
1610
r input.txt
1611
.u
1612
CMDS
1613
}
1614
1615
atf_test_case err_write_nopath
1616
err_write_nopath_head()
1617
{
1618
atf_set "descr" "Error: write to invalid path";
1619
}
1620
err_write_nopath_body()
1621
{
1622
1623
printf 'test\n' > input.txt
1624
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1625
H
1626
r input.txt
1627
w /to/some/far-away/place
1628
CMDS
1629
}
1630
1631
atf_test_case err_write_suffix
1632
err_write_suffix_head()
1633
{
1634
atf_set "descr" "Error: invalid write suffix (ww)";
1635
}
1636
err_write_suffix_body()
1637
{
1638
1639
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1640
H
1641
ww.o
1642
CMDS
1643
}
1644
1645
atf_test_case err_write_flags
1646
err_write_flags_head()
1647
{
1648
atf_set "descr" "Error: invalid write flags (wqp)";
1649
}
1650
err_write_flags_body()
1651
{
1652
1653
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1654
H
1655
wqp w.o
1656
CMDS
1657
}
1658
1659
atf_test_case err_crypt_addr
1660
err_crypt_addr_head()
1661
{
1662
atf_set "descr" "Error: crypt with address";
1663
}
1664
err_crypt_addr_body()
1665
{
1666
1667
printf 'test\n' > input.txt
1668
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1669
H
1670
r input.txt
1671
.x
1672
CMDS
1673
}
1674
1675
atf_test_case err_scroll
1676
err_scroll_head()
1677
{
1678
atf_set "descr" "Error: invalid scroll command";
1679
}
1680
err_scroll_body()
1681
{
1682
1683
atf_check -s exit:2 -e not-empty ed -s - <<'CMDS'
1684
H
1685
z
1686
z
1687
CMDS
1688
}
1689
1690
# ---------------------------------------------------------------------------
1691
# Unicode support
1692
# ---------------------------------------------------------------------------
1693
atf_test_case unicode_list_multibyte
1694
unicode_list_multibyte_head()
1695
{
1696
atf_set "descr" "l command displays multibyte UTF-8 as-is";
1697
}
1698
unicode_list_multibyte_body()
1699
{
1700
1701
export LC_CTYPE=C.UTF-8
1702
printf 'café\n' > input.txt
1703
atf_check -o inline:'café$\n' ed -s - <<'CMDS'
1704
H
1705
r input.txt
1706
l
1707
Q
1708
CMDS
1709
}
1710
1711
atf_test_case unicode_list_cjk
1712
unicode_list_cjk_head()
1713
{
1714
atf_set "descr" "l command displays CJK characters as-is";
1715
}
1716
unicode_list_cjk_body()
1717
{
1718
1719
export LC_CTYPE=C.UTF-8
1720
printf '日本語テスト\n' > input.txt
1721
atf_check -o inline:'日本語テスト$\n' ed -s - <<'CMDS'
1722
H
1723
r input.txt
1724
l
1725
Q
1726
CMDS
1727
}
1728
1729
atf_test_case unicode_list_mixed
1730
unicode_list_mixed_head()
1731
{
1732
atf_set "descr" "l command displays mixed ASCII/UTF-8 correctly";
1733
}
1734
unicode_list_mixed_body()
1735
{
1736
1737
export LC_CTYPE=C.UTF-8
1738
printf 'hello café 世界\n' > input.txt
1739
atf_check -o inline:'hello café 世界$\n' ed -s - <<'CMDS'
1740
H
1741
r input.txt
1742
l
1743
Q
1744
CMDS
1745
}
1746
1747
atf_test_case unicode_list_invalid
1748
unicode_list_invalid_head()
1749
{
1750
atf_set "descr" "l command escapes invalid UTF-8 as octal";
1751
}
1752
unicode_list_invalid_body()
1753
{
1754
1755
export LC_CTYPE=C.UTF-8
1756
printf '\200\201\376\377\n' > input.txt
1757
atf_check -o inline:'\\200\\201\\376\\377$\n' ed -s - <<'CMDS'
1758
H
1759
r input.txt
1760
l
1761
Q
1762
CMDS
1763
}
1764
1765
atf_test_case unicode_list_wrap_cjk
1766
unicode_list_wrap_cjk_head()
1767
{
1768
atf_set "descr" "l command wraps correctly around double-width CJK";
1769
}
1770
unicode_list_wrap_cjk_body()
1771
{
1772
1773
export LC_CTYPE=C.UTF-8
1774
# 69 A's + 日本 (2 CJK chars): 69 + 2 = 71 cols for 日 (fits),
1775
# 71 + 2 = 73 for 本 (exceeds 72), so 本 wraps to next line.
1776
printf 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA日本\n' > input.txt
1777
ed -s - <<'CMDS' > output.txt
1778
H
1779
r input.txt
1780
l
1781
Q
1782
CMDS
1783
printf 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA日\\\n本$\n' > expected.txt
1784
atf_check cmp output.txt expected.txt
1785
}
1786
1787
atf_test_case unicode_print
1788
unicode_print_head()
1789
{
1790
atf_set "descr" "p command passes through UTF-8 correctly";
1791
}
1792
unicode_print_body()
1793
{
1794
1795
export LC_CTYPE=C.UTF-8
1796
printf 'café 日本語\n' > input.txt
1797
atf_check -o inline:'café 日本語\n' ed -s - <<'CMDS'
1798
H
1799
r input.txt
1800
p
1801
Q
1802
CMDS
1803
}
1804
1805
atf_test_case unicode_number
1806
unicode_number_head()
1807
{
1808
atf_set "descr" "n command displays line number with UTF-8";
1809
}
1810
unicode_number_body()
1811
{
1812
1813
export LC_CTYPE=C.UTF-8
1814
printf 'café 日本語\n' > input.txt
1815
atf_check -o inline:'1\tcafé 日本語\n' ed -s - <<'CMDS'
1816
H
1817
r input.txt
1818
n
1819
Q
1820
CMDS
1821
}
1822
1823
atf_test_case unicode_regex
1824
unicode_regex_head()
1825
{
1826
atf_set "descr" "Regex search matches UTF-8 characters";
1827
}
1828
unicode_regex_body()
1829
{
1830
1831
export LC_CTYPE=C.UTF-8
1832
printf 'café\ntest\nüber\n' > input.txt
1833
atf_check -o inline:'café\n' ed -s - <<'CMDS'
1834
H
1835
r input.txt
1836
g/é/p
1837
Q
1838
CMDS
1839
}
1840
1841
atf_test_case unicode_regex_charclass
1842
unicode_regex_charclass_head()
1843
{
1844
atf_set "descr" "Regex character classes work with UTF-8";
1845
}
1846
unicode_regex_charclass_body()
1847
{
1848
1849
export LC_CTYPE=C.UTF-8
1850
printf 'café123\ntest456\n' > input.txt
1851
atf_check -o inline:'café123\n' ed -s - <<'CMDS'
1852
H
1853
r input.txt
1854
g/[[:alpha:]]*é/p
1855
Q
1856
CMDS
1857
}
1858
1859
atf_test_case unicode_substitute
1860
unicode_substitute_head()
1861
{
1862
atf_set "descr" "Substitute replaces UTF-8 characters";
1863
}
1864
unicode_substitute_body()
1865
{
1866
1867
export LC_CTYPE=C.UTF-8
1868
printf 'café\n' > input.txt
1869
ed -s - <<'CMDS'
1870
H
1871
r input.txt
1872
s/é/e/
1873
w output.txt
1874
Q
1875
CMDS
1876
printf 'cafe\n' > expected.txt
1877
atf_check cmp output.txt expected.txt
1878
}
1879
1880
atf_test_case unicode_substitute_cjk
1881
unicode_substitute_cjk_head()
1882
{
1883
atf_set "descr" "Substitute replaces CJK characters";
1884
}
1885
unicode_substitute_cjk_body()
1886
{
1887
1888
export LC_CTYPE=C.UTF-8
1889
printf 'hello 世界\n' > input.txt
1890
ed -s - <<'CMDS'
1891
H
1892
r input.txt
1893
s/世界/world/
1894
w output.txt
1895
Q
1896
CMDS
1897
printf 'hello world\n' > expected.txt
1898
atf_check cmp output.txt expected.txt
1899
}
1900
1901
atf_test_case unicode_global_substitute
1902
unicode_global_substitute_head()
1903
{
1904
atf_set "descr" "Global substitute works with UTF-8";
1905
}
1906
unicode_global_substitute_body()
1907
{
1908
1909
export LC_CTYPE=C.UTF-8
1910
printf 'à la carte\nà bientôt\nhello\n' > input.txt
1911
ed -s - <<'CMDS'
1912
H
1913
r input.txt
1914
g/à/s/à/a/
1915
w output.txt
1916
Q
1917
CMDS
1918
cat > expected.txt <<'EOF'
1919
a la carte
1920
a bientôt
1921
hello
1922
EOF
1923
atf_check cmp output.txt expected.txt
1924
}
1925
1926
atf_test_case unicode_join
1927
unicode_join_head()
1928
{
1929
atf_set "descr" "Join preserves UTF-8 content";
1930
}
1931
unicode_join_body()
1932
{
1933
1934
export LC_CTYPE=C.UTF-8
1935
printf 'café\n世界\n' > input.txt
1936
ed -s - <<'CMDS'
1937
H
1938
r input.txt
1939
1,2j
1940
w output.txt
1941
Q
1942
CMDS
1943
printf 'café世界\n' > expected.txt
1944
atf_check cmp output.txt expected.txt
1945
}
1946
1947
atf_test_case unicode_append
1948
unicode_append_head()
1949
{
1950
atf_set "descr" "Append preserves UTF-8 text";
1951
}
1952
unicode_append_body()
1953
{
1954
1955
export LC_CTYPE=C.UTF-8
1956
ed -s - <<'CMDS'
1957
H
1958
a
1959
première
1960
deuxième
1961
.
1962
w output.txt
1963
Q
1964
CMDS
1965
cat > expected.txt <<'EOF'
1966
première
1967
deuxième
1968
EOF
1969
atf_check cmp output.txt expected.txt
1970
}
1971
1972
atf_test_case unicode_cyrillic
1973
unicode_cyrillic_head()
1974
{
1975
atf_set "descr" "Cyrillic: append, substitute, print, regex search";
1976
}
1977
unicode_cyrillic_body()
1978
{
1979
1980
export LC_CTYPE=C.UTF-8
1981
ed -s - <<'CMDS' > output.txt
1982
H
1983
a
1984
Привет
1985
.
1986
s/ривет/ока/
1987
1p
1988
a
1989
Строка
1990
.
1991
1
1992
/а/p
1993
1,$p
1994
Q
1995
CMDS
1996
cat > expected.txt <<'EOF'
1997
Пока
1998
Пока
1999
Строка
2000
Пока
2001
Строка
2002
EOF
2003
atf_check cmp output.txt expected.txt
2004
}
2005
2006
# ---------------------------------------------------------------------------
2007
# Registration
2008
# ---------------------------------------------------------------------------
2009
atf_init_test_cases()
2010
{
2011
2012
# Basic commands
2013
atf_add_test_case append
2014
atf_add_test_case address
2015
atf_add_test_case change
2016
atf_add_test_case delete
2017
atf_add_test_case insert
2018
atf_add_test_case join
2019
atf_add_test_case mark
2020
atf_add_test_case move
2021
atf_add_test_case transfer
2022
atf_add_test_case transfer_search
2023
atf_add_test_case undo
2024
2025
# Global commands
2026
atf_add_test_case global_move
2027
atf_add_test_case global_change
2028
atf_add_test_case global_substitute
2029
atf_add_test_case global_undo
2030
atf_add_test_case global_copy
2031
atf_add_test_case inverse_global
2032
2033
# Substitution
2034
atf_add_test_case subst_backreference
2035
atf_add_test_case subst_range
2036
atf_add_test_case subst_charclass
2037
2038
# File operations
2039
atf_add_test_case edit_file
2040
atf_add_test_case edit_command
2041
atf_add_test_case edit_reread
2042
atf_add_test_case edit_lowercase
2043
atf_add_test_case read_command
2044
atf_add_test_case read_default
2045
atf_add_test_case read_file
2046
atf_add_test_case write_pipe
2047
atf_add_test_case quit
2048
atf_add_test_case shell_command
2049
2050
# Newline handling
2051
atf_add_test_case newline_insert
2052
atf_add_test_case newline_search
2053
2054
# Unicode support
2055
atf_add_test_case unicode_list_multibyte
2056
atf_add_test_case unicode_list_cjk
2057
atf_add_test_case unicode_list_mixed
2058
atf_add_test_case unicode_list_invalid
2059
atf_add_test_case unicode_list_wrap_cjk
2060
atf_add_test_case unicode_print
2061
atf_add_test_case unicode_number
2062
atf_add_test_case unicode_regex
2063
atf_add_test_case unicode_regex_charclass
2064
atf_add_test_case unicode_substitute
2065
atf_add_test_case unicode_substitute_cjk
2066
atf_add_test_case unicode_global_substitute
2067
atf_add_test_case unicode_join
2068
atf_add_test_case unicode_append
2069
atf_add_test_case unicode_cyrillic
2070
2071
# Error tests
2072
atf_add_test_case err_append_suffix
2073
atf_add_test_case err_addr_out_of_range
2074
atf_add_test_case err_addr_negative
2075
atf_add_test_case err_bang_addr
2076
atf_add_test_case err_bang_double
2077
atf_add_test_case err_change_suffix
2078
atf_add_test_case err_change_zero
2079
atf_add_test_case err_delete_suffix
2080
atf_add_test_case err_edit_suffix
2081
atf_add_test_case err_edit_addr
2082
atf_add_test_case err_edit_nosuffix
2083
atf_add_test_case err_file_addr
2084
atf_add_test_case err_file_suffix
2085
atf_add_test_case err_global_delim
2086
atf_add_test_case err_global_empty
2087
atf_add_test_case err_global_incomplete
2088
atf_add_test_case err_help_addr
2089
atf_add_test_case err_insert_suffix
2090
atf_add_test_case err_insert_zero
2091
atf_add_test_case err_mark_upper
2092
atf_add_test_case err_mark_zero
2093
atf_add_test_case err_mark_ref
2094
atf_add_test_case err_move_dest
2095
atf_add_test_case err_quit_addr
2096
atf_add_test_case err_read_nofile
2097
atf_add_test_case err_subst_delim
2098
atf_add_test_case err_subst_infinite
2099
atf_add_test_case err_subst_bracket
2100
atf_add_test_case err_subst_escape
2101
atf_add_test_case err_subst_empty
2102
atf_add_test_case err_subst_bare
2103
atf_add_test_case err_subst_sr
2104
atf_add_test_case err_subst_equiv
2105
atf_add_test_case err_subst_class
2106
atf_add_test_case err_subst_collate
2107
atf_add_test_case err_transfer_suffix
2108
atf_add_test_case err_transfer_addr
2109
atf_add_test_case err_undo_addr
2110
atf_add_test_case err_write_nopath
2111
atf_add_test_case err_write_suffix
2112
atf_add_test_case err_write_flags
2113
atf_add_test_case err_crypt_addr
2114
atf_add_test_case err_scroll
2115
}
2116
2117