-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dapeng
committed
May 16, 2024
1 parent
752e451
commit a177cf9
Showing
2 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package gone | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func Test_Test(t *testing.T) { | ||
type Line struct { | ||
Flag | ||
A XPoint `gone:"point-a"` | ||
b XPoint `gone:"point-b"` | ||
} | ||
|
||
var a = &Point{x: 1} | ||
var b = &Point{x: 2} | ||
|
||
var executed = false | ||
Test(func(l *Line) { | ||
assert.Equal(t, a, l.A) | ||
assert.Equal(t, b, l.b) | ||
|
||
executed = true | ||
}, func(cemetery Cemetery) error { | ||
cemetery.Bury(a, "point-a") | ||
cemetery.Bury(b, "point-b") | ||
cemetery.Bury(&Line{}) | ||
return nil | ||
}) | ||
assert.True(t, executed) | ||
} |