mod common; assert_ok! { simple_function( "@b Something", "
Something
", ); positional_argument( "@href(`foo.html`) Foo", r#""#, ); named_argument( "@image(alt=`Foo`) `foo.png`", r#""#, ); optional_argument( "@image `foo.png`", r#""#, ); group_function( "@b {Something else}", "Something else
", ); ellipsis_contents( "@b ... Hello, world!", "Hello, world!
", ); ellipsis_in_group( "{@b ... Hello, world!} Oh.", "Hello, world! Oh.
", ); ellipsis_in_tag( "@b ... Hello, world! Oh.", "Hello, world! Oh.
", ); pos_spread( "@fn foo(*$_v) $_ -> $_v\n@foo(1, 2, 3).", "2
", ); join_as_method( "@let(foo=[1, 2, 3]) @foo::join(`, `).", "1, 2, 3
" ); call_attr_function( "@let(foo=@dict::new(bar=@fn $_ -> 23).) @foo::bar.", "23
", ); empty_content_param( "@fn foo . -> Foo\n@foo.", "Foo
", ); } assert_matches! { call_if_not_unit( "@let(foo=.) @foo?::bar.", ".", ); function_name( "@let(bar=@fn foo $x -> $x) @bar::name.", "`foo`", ); bind_none( "@let(foo=@function::bind(@fn $_ -> 4).) @foo.", "4", ); bind_pos( "@let(foo=@function::bind(@fn($_x, $_y) $_ -> [$_x, $_y], 1).) @foo(2).", "=[1, 2]", ); bind_named( "@let(foo=@function::bind(@fn($x, $y) $_ -> [$x, $y], x=1).) @foo(y=2).", "=[1, 2]", ); bind_pos_spread( "@let(foo=@function::bind(@fn(*$_v) $_ -> $_v, 1, 2).) @foo(3, 4).", "=[1, 2, 3, 4]", ); bind_named_spread( "@let(foo=@function::bind(@fn(**$kw) $_ -> $kw, x=1, y=2).) @foo(z=3).", "(x=1, y=2, z=3)", ); bind_content( "@let(foo=@function::bind(@fn $v: int -> $v) 23) @foo.", "23", ); bind_as_method( "@let(foo=@fn($x, $y) $_ -> [$x, $y], foo_bound=@foo::bind(x=1).) @foo_bound(y=2).", "=[1, 2]", ); indirect_call( "@let(foo=@fn($_x, $y) $z -> [$_x, $y, $z]) @function::call($foo, 1, y=2) 3", "=[1, 2, 3]", ); }