go-arbitrary/t_regularfile.go

20 lines
279 B
Go
Raw Normal View History

2022-12-14 13:30:29 +00:00
package arbitrary
import (
"io/fs"
)
2022-12-14 14:16:55 +00:00
// RegularFile returns an arbitrary fs.File regular-file.
2022-12-14 13:30:29 +00:00
func (arb T) RegularFile() fs.File {
var fns [](func()fs.File) = [](func()fs.File){
arb.TextFile,
arb.HTMLFile,
}
fn := fns[arb.randomness.Intn(len(fns))]
return fn()
}