@@ -298,46 +298,46 @@ fn template_string_complex() {
298298
299299#[ test]
300300fn binary_expression ( ) {
301- assert_expression ! ( "true == 1" , Expression :: Binary {
302- left : Box :: new ( Expression :: Literal ( Value :: True ) ) ,
303- operator : Equality ,
304- right : boxnum !( "1" )
305- } ) ;
301+ assert_expression ! ( "true == 1" , Expression :: binary (
302+ Expression :: Literal ( Value :: True ) ,
303+ Equality ,
304+ num !( "1" )
305+ ) ) ;
306306}
307307
308308#[ test]
309309fn binary_expression_less_than ( ) {
310- assert_expression ! ( "i < 10" , Expression :: Binary {
311- left : Box :: new ( ident!( "i" ) ) ,
312- operator : Lesser ,
313- right : boxnum !( "10" )
314- } ) ;
310+ assert_expression ! ( "i < 10" , Expression :: binary (
311+ ident!( "i" ) ,
312+ Lesser ,
313+ num !( "10" )
314+ ) ) ;
315315}
316316
317317#[ test]
318318fn op_precedence_left ( ) {
319- assert_expression ! ( "1 + 2 * 3" , Expression :: Binary {
320- left : boxnum !( "1" ) ,
321- operator : Addition ,
322- right : Box :: new ( Expression :: Binary {
323- left : boxnum !( "2" ) ,
324- operator : Multiplication ,
325- right : boxnum !( "3" ) ,
326- } ) ,
327- } ) ;
319+ assert_expression ! ( "1 + 2 * 3" , Expression :: binary (
320+ num !( "1" ) ,
321+ Addition ,
322+ Expression :: binary (
323+ num !( "2" ) ,
324+ Multiplication ,
325+ num !( "3" )
326+ ) ,
327+ ) ) ;
328328}
329329
330330#[ test]
331331fn op_precedence_right ( ) {
332- assert_expression ! ( "1 * 2 + 3" , Expression :: Binary {
333- left : Box :: new ( Expression :: Binary {
334- left : boxnum !( "1" ) ,
335- operator : Multiplication ,
336- right : boxnum !( "2" ) ,
337- } ) ,
338- operator : Addition ,
339- right : boxnum !( "3" ) ,
340- } ) ;
332+ assert_expression ! ( "1 * 2 + 3" , Expression :: binary (
333+ Expression :: binary (
334+ num !( "1" ) ,
335+ Multiplication ,
336+ num !( "2" ) ,
337+ ) ,
338+ Addition ,
339+ num !( "3" ) ,
340+ ) ) ;
341341}
342342
343343#[ test]
@@ -489,19 +489,19 @@ fn if_else_no_block_statement() {
489489fn for_statement ( ) {
490490 assert_statement ! ( "for (i = 0; i < 10; i++) {}" , Statement :: For {
491491 init: Some ( Box :: new( Statement :: Expression {
492- value: Expression :: Binary {
493- left : Box :: new ( ident!( "i" ) ) ,
494- operator : OperatorType :: Assign ,
495- right : Box :: new ( num!( "0" ) ) ,
496- }
492+ value: Expression :: binary (
493+ ident!( "i" ) ,
494+ Assign ,
495+ num!( "0" ) ,
496+ )
497497 } ) ) ,
498- test: Some ( Expression :: Binary {
499- left : Box :: new ( ident!( "i" ) ) ,
500- operator : OperatorType :: Lesser ,
501- right : Box :: new ( num!( "10" ) ) ,
502- } ) ,
498+ test: Some ( Expression :: binary (
499+ ident!( "i" ) ,
500+ Lesser ,
501+ num!( "10" ) ,
502+ ) ) ,
503503 update: Some ( Expression :: Postfix {
504- operator: OperatorType :: Increment ,
504+ operator: Increment ,
505505 operand: Box :: new( ident!( "i" ) ) ,
506506 } ) ,
507507 body: Box :: new( Statement :: Block {
@@ -522,13 +522,13 @@ fn for_declare_statement() {
522522 }
523523 ] ,
524524 } ) ) ,
525- test: Some ( Expression :: Binary {
526- left : Box :: new ( ident!( "i" ) ) ,
527- operator : OperatorType :: Lesser ,
528- right : Box :: new ( num!( "10" ) ) ,
529- } ) ,
525+ test: Some ( Expression :: binary (
526+ ident!( "i" ) ,
527+ Lesser ,
528+ num!( "10" ) ,
529+ ) ) ,
530530 update: Some ( Expression :: Postfix {
531- operator: OperatorType :: Increment ,
531+ operator: Increment ,
532532 operand: Box :: new( ident!( "i" ) ) ,
533533 } ) ,
534534 body: Box :: new( Statement :: Block {
@@ -666,11 +666,11 @@ fn arrow_function_shorthand() {
666666 param!( "n" )
667667 ] ,
668668 body: Box :: new( Statement :: Expression {
669- value: Expression :: Binary {
670- left : Box :: new ( ident!( "n" ) ) ,
671- operator : Multiplication ,
672- right : Box :: new ( ident!( "n" ) ) ,
673- }
669+ value: Expression :: binary (
670+ ident!( "n" ) ,
671+ Multiplication ,
672+ ident!( "n" )
673+ )
674674 } ) ,
675675 } ) ;
676676}
0 commit comments