Skip to content

Commit c91ca0d

Browse files
committed
add example_test
1 parent ccafb26 commit c91ca0d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: example_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package strparse_test
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/go-toolsmith/astequal"
7+
"github.com/go-toolsmith/strparse"
8+
)
9+
10+
func Example() {
11+
// Comparing AST strings for equallity (note different spacing):
12+
x := strparse.Expr(`1 + f(v[0].X)`)
13+
y := strparse.Expr(` 1+f( v[0].X ) `)
14+
fmt.Println(astequal.Expr(x, y)) // => true
15+
16+
// Output:
17+
// true
18+
}

0 commit comments

Comments
 (0)