Add a couple testable examples

This commit is contained in:
Dan Jones 2025-03-11 16:54:03 -05:00
commit 1f9fb28645
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,20 @@
package nomino
import "fmt"
func ExampleWithGenerator_custom_generator() {
gen := func() (string, error) {
return "hello", nil
}
option := WithGenerator(gen)
str, _ := Make(NewConfig(option))
fmt.Println(str)
str, _ = Make(NewConfig(option, WithoutExtension()))
fmt.Println(str)
// Output:
// hello.txt
// hello
}

9
make_examples_test.go Normal file
View file

@ -0,0 +1,9 @@
package nomino
import "fmt"
func ExampleMake_basic() {
// Use default config
out, _ := Make(NewConfig())
fmt.Println(out)
}