@@ -49,135 +49,135 @@ pub(crate) fn set_context(expr: Expr, ctx: ExprContext) -> Expr {
49
49
50
50
#[ cfg( test) ]
51
51
mod tests {
52
- use crate :: parser :: parse_program ;
52
+ use crate :: { ast , Parse } ;
53
53
54
54
#[ test]
55
55
fn test_assign_name ( ) {
56
56
let source = "x = (1, 2, 3)" ;
57
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
57
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
58
58
insta:: assert_debug_snapshot!( parse_ast) ;
59
59
}
60
60
61
61
#[ test]
62
62
fn test_assign_tuple ( ) {
63
63
let source = "(x, y) = (1, 2, 3)" ;
64
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
64
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
65
65
insta:: assert_debug_snapshot!( parse_ast) ;
66
66
}
67
67
68
68
#[ test]
69
69
#[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
70
70
fn test_assign_list ( ) {
71
71
let source = "[x, y] = (1, 2, 3)" ;
72
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
72
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
73
73
insta:: assert_debug_snapshot!( parse_ast) ;
74
74
}
75
75
76
76
#[ test]
77
77
fn test_assign_attribute ( ) {
78
78
let source = "x.y = (1, 2, 3)" ;
79
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
79
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
80
80
insta:: assert_debug_snapshot!( parse_ast) ;
81
81
}
82
82
83
83
#[ test]
84
84
fn test_assign_subscript ( ) {
85
85
let source = "x[y] = (1, 2, 3)" ;
86
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
86
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
87
87
insta:: assert_debug_snapshot!( parse_ast) ;
88
88
}
89
89
90
90
#[ test]
91
91
fn test_assign_starred ( ) {
92
92
let source = "(x, *y) = (1, 2, 3)" ;
93
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
93
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
94
94
insta:: assert_debug_snapshot!( parse_ast) ;
95
95
}
96
96
97
97
#[ test]
98
98
fn test_assign_for ( ) {
99
99
let source = "for x in (1, 2, 3): pass" ;
100
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
100
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
101
101
insta:: assert_debug_snapshot!( parse_ast) ;
102
102
}
103
103
104
104
#[ test]
105
105
#[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
106
106
fn test_assign_list_comp ( ) {
107
107
let source = "x = [y for y in (1, 2, 3)]" ;
108
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
108
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
109
109
insta:: assert_debug_snapshot!( parse_ast) ;
110
110
}
111
111
112
112
#[ test]
113
113
#[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
114
114
fn test_assign_set_comp ( ) {
115
115
let source = "x = {y for y in (1, 2, 3)}" ;
116
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
116
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
117
117
insta:: assert_debug_snapshot!( parse_ast) ;
118
118
}
119
119
120
120
#[ test]
121
121
#[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
122
122
fn test_assign_with ( ) {
123
123
let source = "with 1 as x: pass" ;
124
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
124
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
125
125
insta:: assert_debug_snapshot!( parse_ast) ;
126
126
}
127
127
128
128
#[ test]
129
129
fn test_assign_named_expr ( ) {
130
130
let source = "if x:= 1: pass" ;
131
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
131
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
132
132
insta:: assert_debug_snapshot!( parse_ast) ;
133
133
}
134
134
135
135
#[ test]
136
136
fn test_ann_assign_name ( ) {
137
137
let source = "x: int = 1" ;
138
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
138
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
139
139
insta:: assert_debug_snapshot!( parse_ast) ;
140
140
}
141
141
142
142
#[ test]
143
143
fn test_aug_assign_name ( ) {
144
144
let source = "x += 1" ;
145
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
145
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
146
146
insta:: assert_debug_snapshot!( parse_ast) ;
147
147
}
148
148
149
149
#[ test]
150
150
fn test_aug_assign_attribute ( ) {
151
151
let source = "x.y += (1, 2, 3)" ;
152
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
152
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
153
153
insta:: assert_debug_snapshot!( parse_ast) ;
154
154
}
155
155
156
156
#[ test]
157
157
fn test_aug_assign_subscript ( ) {
158
158
let source = "x[y] += (1, 2, 3)" ;
159
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
159
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
160
160
insta:: assert_debug_snapshot!( parse_ast) ;
161
161
}
162
162
163
163
#[ test]
164
164
fn test_del_name ( ) {
165
165
let source = "del x" ;
166
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
166
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
167
167
insta:: assert_debug_snapshot!( parse_ast) ;
168
168
}
169
169
170
170
#[ test]
171
171
fn test_del_attribute ( ) {
172
172
let source = "del x.y" ;
173
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
173
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
174
174
insta:: assert_debug_snapshot!( parse_ast) ;
175
175
}
176
176
177
177
#[ test]
178
178
fn test_del_subscript ( ) {
179
179
let source = "del x[y]" ;
180
- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
180
+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
181
181
insta:: assert_debug_snapshot!( parse_ast) ;
182
182
}
183
183
}
0 commit comments