> # equal
> f1 <- (function(x = 1, y = 2) { })
> f2 <- (function(x = 1, y = 2) { })
> compare(f1, f2)
v No differences

> f2 <- source(test_path("f2.R"), local = TRUE, keep.source = TRUE)$value
> compare(f1, f2)
v No differences

> # pritimives
> compare(`[`, sum)
`x` is `.Primitive("[")`
`y` is `.Primitive("sum")`

> compare(sum, prod)
`x` is `.Primitive("sum")`
`y` is `.Primitive("prod")`

> # diff formals
> f3 <- (function(x = 1, y = 1, z = 1) { })
> compare(f1, f3)
`formals(x)` is length 2
`formals(y)` is length 3

`names(formals(x))`: "x" "y"    
`names(formals(y))`: "x" "y" "z"

`formals(x)$y`: 2
`formals(y)$y`: 1

`formals(x)$z` is absent
`formals(y)$z` is a double vector (1)

> # diff body
> f4 <- (function(x = 1, y = 2) {
+   x + y
+ })
> compare(f1, f4)
`body(x)`: "{"             "}"
`body(y)`: "{" "    x + y" "}"

> compare(f1, f4, ignore_srcref = FALSE)
`attr(x, 'srcref')`: 2  8 2  33 8 33 2  2 
`attr(y, 'srcref')`: 14 8 16 1  8 1  14 16

`attr(body(x), 'srcref')` is length 1
`attr(body(y), 'srcref')` is length 2

`attr(body(x), 'srcref')[[2]]` is absent
`attr(body(y), 'srcref')[[2]]` is an S3 object of class <srcref>

`attr(body(x), 'wholeSrcref')`: 1 0 2  33 0 33 1 2   
`attr(body(y), 'wholeSrcref')`: 1 0 16 1  0    1 1 16

`body(x)`: "{"             "}"
`body(y)`: "{" "    x + y" "}"

> # diff environment
> environment(f1) <- base_env()
> environment(f2) <- global_env()
> compare(f1, f2)
`environment(x)` is <env:package:base>
`environment(y)` is <env:global>`

