alike(quote(fun(x + y, 9)), quote(fun(1 + 1)))

`quote(fun(1 + 1))[[2]][[2]]` should be "symbol" (is "double")

"%plusq%" <- function(x, y) call("+", substitute(x), substitute(y))

# Need to add parens in error messages, which we will illustrate with an
# operator

`(1 %plusq% b)[[3]]` should be "double" (is "symbol")

[1] "`(1 %plusq% b)[[3]]` should be \"double\" (is \"symbol\")"

alike(quote(fun(b = fun2(x, y), 1, 3)), quote(fun(NULL, fun2(a, 
    b), 1)))

# TRUE, since constants including NULL match any constants

alike(quote(fun(b = fun2(x, y), 1, 3)), quote(fun(NULL, fun2(a, 
    b), 1)), settings = vetr_settings(lang.mode = 1))

`quote(fun(NULL, fun2(a, b), 1))` should have argument `b` as first argument (has unnamed argument)

[1] "`quote(fun(NULL, fun2(a, b), 1))` should have argument `b` as first argument (has unnamed argument)"

alike(quote(fun(b = fun2(x, y), 1, 3)), quote(fun(fun2(a, b), 
    NULL, 1)))

`quote(fun(fun2(a, b), NULL, 1))[[2]]` should be "double" (is "language")

[1] "`quote(fun(fun2(a, b), NULL, 1))[[2]]` should be \"double\" (is \"language\")"

alike(quote(fun(a = 1)), quote(fun(b = 1)))

`quote(fun(b = 1))` should have argument `a` as first argument (has `b`)

[1] "`quote(fun(b = 1))` should have argument `a` as first argument (has `b`)"

`quote(fun(1))` should have 2 arguments (has 1)

[1] "`quote(fun(1))` should have 2 arguments (has 1)"

`quote(fun(1, 2))` should have 1 arguments (has 2)

[1] "`quote(fun(1, 2))` should have 1 arguments (has 2)"

`quote(fun2(1, 2))[[1]]` should be a call to `fun` (is a call to `fun2`)

[1] "`quote(fun2(1, 2))[[1]]` should be a call to `fun` (is a call to `fun2`)"

`quote(fun(1, fun(3)))[[3]][[1]]` should be a call to `fun2` (is a call to `fun`)

[1] "`quote(fun(1, fun(3)))[[3]][[1]]` should be a call to `fun2` (is a call to `fun`)"

`quote(fun2(a, b, c))[[1]]` should be a call to `fun` (is a call to `fun2`)

[1] "`quote(fun2(a, b, c))[[1]]` should be a call to `fun` (is a call to `fun2`)"

alike(quote(fun(a, fun2())), quote(fun(b, fun2(a, b, c))))

# Attributes on sub-components should not affect anything
# actually, these tests need to be with alike since lang_alike doesn't check
# attributes