> # 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)
`old` is `.Primitive("[")`
`new` is `.Primitive("sum")`

> compare(sum, prod)
`old` is `.Primitive("sum")`
`new` is `.Primitive("prod")`

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

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

`formals(old)$y`: 2
`formals(new)$y`: 1

`formals(old)$z` is absent
`formals(new)$z` is a double vector (1)

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

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

`attr(body(old), 'srcref')` is length 1
`attr(body(new), 'srcref')` is length 2

`attr(body(old), 'srcref')[[1]]`:  2 31  2 31 31 31  2  2
`attr(body(new), 'srcref')[[1]]`: 14 31 14 31 31 31 14 14

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

`attr(body(old), 'wholeSrcref')`: 1 0  2 33 0 33 1 2   
`attr(body(new), 'wholeSrcref')`: 1 0 16  1 0    1 1 16

`body(old)`: `{`             `}`
`body(new)`: `{` `    x + y` `}`

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

