Skip to content

Commit d92135d

Browse files
committed
Refactored test corpus structure and added tests
1 parent 77d302a commit d92135d

12 files changed

+1671
-1318
lines changed

test/corpus/update.txt

Lines changed: 0 additions & 1318 deletions
This file was deleted.

test/corpus/update/edge-cases.txt

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
==================
2+
UPDATE Edge Cases and Combinations
3+
==================
4+
5+
UPDATE FILE "/very/long/path/to/file/with/many/directories/example.txt"
6+
REPLACE SEGMENT
7+
STARTING BEFORE LINE "Section 1" OFFSET 5
8+
ENDING AFTER LINE "End of Section 1" OFFSET 10
9+
WITH CONTENT '''
10+
@0:This is a very long
11+
@1:multiline content
12+
@-1:with "quotes" and other 'special' chars
13+
@2:like backslashes and multiple spaces
14+
''';
15+
16+
UPDATE FUNCTION "*Controller" FROM FILE "/src/complex_file.js"
17+
MOVE SEGMENT
18+
STARTING AT LINE "constructor(" OFFSET 0
19+
ENDING BEFORE LINE "}"
20+
INSERT AFTER LINE "methods: {" OFFSET 1;
21+
22+
UPDATE FILE "/config.json"
23+
REPLACE SEGMENT
24+
STARTING AT LINE "\"environment\": {"
25+
ENDING AFTER LINE "}"
26+
WITH FILE "/default_config.json"
27+
SEGMENT
28+
STARTING AT LINE "\"environment\": {"
29+
ENDING AFTER LINE"}";
30+
31+
---
32+
33+
(source_file
34+
(update_command
35+
(singlefile_clause
36+
(string
37+
(single_quoted_string)))
38+
(replace_region_clause
39+
(region_field
40+
(marker_or_segment
41+
(segment
42+
(relpos_segment_start
43+
(relpos_beforeafter
44+
(marker
45+
(line_matcher
46+
(line_base
47+
(string
48+
(single_quoted_string)))
49+
(offset_clause
50+
(number))))))
51+
(relpos_segment_end
52+
(relpos_beforeafter
53+
(marker
54+
(line_matcher
55+
(line_base
56+
(string
57+
(single_quoted_string)))
58+
(offset_clause
59+
(number))))))))))
60+
(content_literal
61+
(string
62+
(multi_line_string))))
63+
(command_separator)
64+
(update_command
65+
(identifier_from_file
66+
(identifier_matcher
67+
(string
68+
(single_quoted_string)))
69+
(singlefile_clause
70+
(string
71+
(single_quoted_string))))
72+
(update_move_region_clause
73+
(region_field
74+
(marker_or_segment
75+
(segment
76+
(relpos_segment_start
77+
(relpos_at
78+
(marker
79+
(line_matcher
80+
(line_base
81+
(string
82+
(single_quoted_string)))
83+
(offset_clause
84+
(number))))))
85+
(relpos_segment_end
86+
(relpos_beforeafter
87+
(marker
88+
(line_matcher
89+
(line_base
90+
(string
91+
(single_quoted_string))))))))))
92+
(update_move_clause_destination
93+
(insert_clause
94+
(relpos_bai
95+
(relpos_beforeafter
96+
(marker
97+
(line_matcher
98+
(line_base
99+
(string
100+
(single_quoted_string)))
101+
(offset_clause
102+
(number))))))))))
103+
(command_separator)
104+
(update_command
105+
(singlefile_clause
106+
(string
107+
(single_quoted_string)))
108+
(replace_region_clause
109+
(region_field
110+
(marker_or_segment
111+
(segment
112+
(relpos_segment_start
113+
(relpos_at
114+
(marker
115+
(line_matcher
116+
(line_base
117+
(string
118+
(single_quoted_string
119+
(escape_sequence)
120+
(escape_sequence))))))))
121+
(relpos_segment_end
122+
(relpos_beforeafter
123+
(marker
124+
(line_matcher
125+
(line_base
126+
(string
127+
(single_quoted_string)))))))))))
128+
(content_from_segment
129+
(singlefile_clause
130+
(string
131+
(single_quoted_string)))
132+
(marker_or_segment
133+
(segment
134+
(relpos_segment_start
135+
(relpos_at
136+
(marker
137+
(line_matcher
138+
(line_base
139+
(string
140+
(single_quoted_string
141+
(escape_sequence)
142+
(escape_sequence))))))))
143+
(relpos_segment_end
144+
(relpos_beforeafter
145+
(marker
146+
(line_matcher
147+
(line_base
148+
(string
149+
(single_quoted_string)))))))))))
150+
(command_separator))

0 commit comments

Comments
 (0)