@@ -199,49 +199,49 @@ defmodule MacroTest do
199
199
end )
200
200
end
201
201
202
- ## to_binary
202
+ ## to_string
203
203
204
- test :var_to_binary do
204
+ test :var_to_string do
205
205
assert Macro . to_string ( quote do: foo ) == "foo"
206
206
end
207
207
208
- test :local_call_to_binary do
208
+ test :local_call_to_string do
209
209
assert Macro . to_string ( quote do: foo ( 1 , 2 , 3 ) ) == "foo(1, 2, 3)"
210
210
assert Macro . to_string ( quote do: foo ( [ 1 , 2 , 3 ] ) ) == "foo([1, 2, 3])"
211
211
end
212
212
213
- test :remote_call_to_binary do
213
+ test :remote_call_to_string do
214
214
assert Macro . to_string ( quote do: foo . bar ( 1 , 2 , 3 ) ) == "foo.bar(1, 2, 3)"
215
215
assert Macro . to_string ( quote do: foo . bar ( [ 1 , 2 , 3 ] ) ) == "foo.bar([1, 2, 3])"
216
216
end
217
217
218
- test :low_atom_remote_call_to_binary do
218
+ test :low_atom_remote_call_to_string do
219
219
assert Macro . to_string ( quote do: :foo . bar ( 1 , 2 , 3 ) ) == ":foo.bar(1, 2, 3)"
220
220
end
221
221
222
- test :big_atom_remote_call_to_binary do
222
+ test :big_atom_remote_call_to_string do
223
223
assert Macro . to_string ( quote do: Foo.Bar . bar ( 1 , 2 , 3 ) ) == "Foo.Bar.bar(1, 2, 3)"
224
224
end
225
225
226
- test :remote_and_fun_call_to_binary do
226
+ test :remote_and_fun_call_to_string do
227
227
assert Macro . to_string ( quote do: foo . bar . ( 1 , 2 , 3 ) ) == "foo.bar().(1, 2, 3)"
228
228
assert Macro . to_string ( quote do: foo . bar . ( [ 1 , 2 , 3 ] ) ) == "foo.bar().([1, 2, 3])"
229
229
end
230
230
231
- test :atom_call_to_binary do
231
+ test :atom_call_to_string do
232
232
assert Macro . to_string ( quote do: :foo . ( 1 , 2 , 3 ) ) == ":foo.(1, 2, 3)"
233
233
end
234
234
235
- test :aliases_call_to_binary do
235
+ test :aliases_call_to_string do
236
236
assert Macro . to_string ( quote do: Foo.Bar . baz ( 1 , 2 , 3 ) ) == "Foo.Bar.baz(1, 2, 3)"
237
237
assert Macro . to_string ( quote do: Foo.Bar . baz ( [ 1 , 2 , 3 ] ) ) == "Foo.Bar.baz([1, 2, 3])"
238
238
end
239
239
240
- test :arrow_to_binary do
240
+ test :arrow_to_string do
241
241
assert Macro . to_string ( quote do: foo ( 1 , ( 2 -> 3 ) ) ) == "foo(1, (2 -> 3))"
242
242
end
243
243
244
- test :blocks_to_binary do
244
+ test :blocks_to_string do
245
245
assert Macro . to_string ( quote do: ( 1 ; 2 ; ( :foo ; :bar ) ; 3 ) ) <> "\n " == """
246
246
(
247
247
1
@@ -255,7 +255,7 @@ defmodule MacroTest do
255
255
"""
256
256
end
257
257
258
- test :if_else_to_binary do
258
+ test :if_else_to_string do
259
259
assert Macro . to_string ( quote do: ( if foo , do: bar , else: baz ) ) <> "\n " == """
260
260
if(foo) do
261
261
bar
@@ -265,7 +265,7 @@ defmodule MacroTest do
265
265
"""
266
266
end
267
267
268
- test :case_to_binary do
268
+ test :case_to_string do
269
269
assert Macro . to_string ( quote do: ( case foo do true -> 0 ; false -> ( 1 ; 2 ) end ) ) <> "\n " == """
270
270
case(foo) do
271
271
true ->
@@ -277,7 +277,7 @@ defmodule MacroTest do
277
277
"""
278
278
end
279
279
280
- test :fn_to_binary do
280
+ test :fn_to_string do
281
281
assert Macro . to_string ( quote do: ( fn -> 1 + 2 end ) ) == "fn -> 1 + 2 end"
282
282
assert Macro . to_string ( quote do: ( fn ( x ) -> x + 1 end ) ) == "fn x -> x + 1 end"
283
283
@@ -306,11 +306,7 @@ defmodule MacroTest do
306
306
assert Macro . to_string ( quote do: ( ( x , y ) when z -> w ) ) == "((x, y) when z -> w)"
307
307
end
308
308
309
- test :partial_to_binary do
310
- assert Macro . to_string ( quote do: identity ( & 1 ) ) == "identity(&1)"
311
- end
312
-
313
- test :nested_to_binary do
309
+ test :nested_to_string do
314
310
assert Macro . to_string ( quote do: ( defmodule Foo do def foo do 1 + 1 end end ) ) <> "\n " == """
315
311
defmodule(Foo) do
316
312
def(foo) do
@@ -320,28 +316,30 @@ defmodule MacroTest do
320
316
"""
321
317
end
322
318
323
- test :op_precedence_to_binary do
319
+ test :op_precedence_to_string do
324
320
assert Macro . to_string ( quote do: ( 1 + 2 ) * ( 3 - 4 ) ) == "(1 + 2) * (3 - 4)"
325
321
assert Macro . to_string ( quote do: ( ( 1 + 2 ) * 3 ) - 4 ) == "((1 + 2) * 3) - 4"
326
322
end
327
323
328
- test :containers_to_binary do
324
+ test :containers_to_string do
329
325
assert Macro . to_string ( quote do: { 1 , 2 , 3 } ) == "{1, 2, 3}"
330
326
assert Macro . to_string ( quote do: [ 1 , 2 , 3 ] ) == "[1, 2, 3]"
331
327
assert Macro . to_string ( quote do: << 1 , 2 , 3 >> ) == "<<1, 2, 3>>"
332
328
end
333
329
334
- test :binary_ops_to_binary do
330
+ test :binary_ops_to_string do
335
331
assert Macro . to_string ( quote do: 1 + 2 ) == "1 + 2"
336
332
assert Macro . to_string ( quote do: [ 1 , 2 | 3 ] ) == "[1, 2 | 3]"
337
333
assert Macro . to_string ( quote do: [ h | t ] = [ 1 , 2 , 3 ] ) == "[h | t] = [1, 2, 3]"
338
334
end
339
335
340
- test :unary_ops_to_binary do
336
+ test :unary_ops_to_string do
341
337
assert Macro . to_string ( quote do: not 1 ) == "not 1"
342
338
assert Macro . to_string ( quote do: not foo ) == "not foo"
343
339
assert Macro . to_string ( quote do: - 1 ) == "-1"
344
340
assert Macro . to_string ( quote do: @ foo ( bar ) ) == "@foo(bar)"
341
+ assert Macro . to_string ( quote do: identity ( & 1 ) ) == "identity(&1)"
342
+ assert Macro . to_string ( quote do: identity ( & foo ) ) == "identity(&foo)"
345
343
end
346
344
347
345
## safe_term
0 commit comments