diff --git a/generators_examples_test.go b/generators_examples_test.go new file mode 100644 index 0000000..67d5995 --- /dev/null +++ b/generators_examples_test.go @@ -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 +} diff --git a/make_examples_test.go b/make_examples_test.go new file mode 100644 index 0000000..07c85ba --- /dev/null +++ b/make_examples_test.go @@ -0,0 +1,9 @@ +package nomino + +import "fmt" + +func ExampleMake_basic() { + // Use default config + out, _ := Make(NewConfig()) + fmt.Println(out) +}