@@ -567,6 +567,29 @@ function_form(short::Bool) = string(short ? "short" : "long", "-form")
567567 @test strip_lineno! (c_expr) == strip_lineno! (expr)
568568 end
569569
570+ @testset " (x; y = 0, _...)" begin
571+ f, expr = if short
572+ @audit (x; y = 0 , _... ) -> (x, y)
573+ else
574+ @audit function (x; y = 0 , _... ); (x, y) end
575+ end
576+ @test length (methods (f)) == 1
577+ @test f (0 ) == (0 , 0 )
578+ @test f (0 , y= 1 ) == (0 , 1 )
579+ @test f (0 , y= 1 , z= 2 ) == (0 , 1 )
580+
581+ # Note: the semi-colon is missing from the expression
582+ d = splitdef (expr)
583+ @test keys (d) == Set ([:head , :args , :kwargs , :body ])
584+ @test d[:args ] == [:x ]
585+ @test d[:kwargs ] == [Expr (:kw , :y , 0 ), :(_... )]
586+
587+ c_expr = combinedef (d)
588+ expr = Expr (:-> , Expr (:tuple , Expr (:parameters , Expr (:kw , :y , 0 ), :(_... )), :x ), Expr (:block , :((x, y))))
589+ expr. head = short ? :-> : :function
590+ @test strip_lineno! (c_expr) == strip_lineno! (expr)
591+ end
592+
570593 @testset " Expr(:block, :x, :y)" begin
571594 expr = Expr (:-> , Expr (:block , :x , :y ), Expr (:block , :((x, y))))
572595 expr. head = short ? :-> : :function
0 commit comments