History

Test that Custom() can generate interface{}

Gregory Petrosyan committed 6 years ago

Commit 0d4e2bb1 parent d17ccdb1 file · +9 −0Browse files

Unified · Split

combinators_external_test.go+9−0
@@ -23,6 +23,14 @@ func genBool(t *T) bool { · 22 unmodified lines
2323 return Boolean().Draw(t, "").(bool)
2424 }
2525
26+func genInterface(t *T) interface{} {
27+ if Boolean().Draw(t, "coinflip").(bool) {
28+ return Int8().Draw(t, "")
29+ } else {
30+ return Float64().Draw(t, "")
31+ }
32+}
33+
2634 func genSlice(t *T) []uint64 {
2735 return []uint64{
2836 Uint64().Draw(t, "").(uint64),
@@ -42,6 +50,7 @@ func TestCustom(t *testing.T) { · 13 unmodified lines
4250
4351 gens := []*Generator{
4452 Custom(genBool),
53+ Custom(genInterface),
4554 Custom(genSlice),
4655 Custom(genStruct),
4756 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t