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