103 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			103 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package nomino_test
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 
 | |
| 	"codeberg.org/danjones000/nomino"
 | |
| )
 | |
| 
 | |
| func ExampleWithExtension() {
 | |
| 	st, _ := nomino.Make(nomino.NewConfig(
 | |
| 		nomino.WithExtension("xml"),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	))
 | |
| 
 | |
| 	fmt.Println(st)
 | |
| 	// Output: 0.xml
 | |
| }
 | |
| 
 | |
| func ExampleWithoutExtension() {
 | |
| 	st, _ := nomino.Make(nomino.NewConfig(
 | |
| 		nomino.WithoutExtension(),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	))
 | |
| 
 | |
| 	fmt.Println(st)
 | |
| 	// Output: 0
 | |
| }
 | |
| 
 | |
| func ExampleWithPrefix() {
 | |
| 	conf := nomino.NewConfig(
 | |
| 		nomino.WithPrefix("pref"),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	)
 | |
| 	st, _ := nomino.Make(conf)
 | |
| 	fmt.Println(st)
 | |
| 
 | |
| 	st, _ = nomino.Make(conf)
 | |
| 	fmt.Println(st)
 | |
| 	// Output:
 | |
| 	// pref_0.txt
 | |
| 	// pref_1.txt
 | |
| }
 | |
| 
 | |
| func ExampleWithSeparator() {
 | |
| 	conf := nomino.NewConfig(
 | |
| 		nomino.WithPrefix("pref"),
 | |
| 		nomino.WithSeparator("---"),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	)
 | |
| 	st, _ := nomino.Make(conf)
 | |
| 	fmt.Println(st)
 | |
| 
 | |
| 	st, _ = nomino.Make(conf)
 | |
| 	fmt.Println(st)
 | |
| 	// Output:
 | |
| 	// pref---0.txt
 | |
| 	// pref---1.txt
 | |
| }
 | |
| 
 | |
| func ExampleWithSuffix() {
 | |
| 	conf := nomino.NewConfig(
 | |
| 		nomino.WithSuffix("suff"),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	)
 | |
| 	st, _ := nomino.Make(conf)
 | |
| 	fmt.Println(st)
 | |
| 
 | |
| 	st, _ = nomino.Make(conf)
 | |
| 	fmt.Println(st)
 | |
| 	// Output:
 | |
| 	// 0_suff.txt
 | |
| 	// 1_suff.txt
 | |
| }
 | |
| 
 | |
| func ExampleWithOriginal() {
 | |
| 	st, _ := nomino.Make(nomino.NewConfig(
 | |
| 		nomino.WithOriginal("Hello, World"),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	))
 | |
| 
 | |
| 	fmt.Println(st)
 | |
| 	// Output: 0_Hello, World.txt
 | |
| }
 | |
| 
 | |
| func ExampleWithOriginalSlug() {
 | |
| 	st, _ := nomino.Make(nomino.NewConfig(
 | |
| 		nomino.WithOriginalSlug("Hello, World"),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	))
 | |
| 
 | |
| 	fmt.Println(st)
 | |
| 	// Output: 0_hello-world.txt
 | |
| }
 | |
| 
 | |
| func ExampleWithOriginalSlugLang() {
 | |
| 	st, _ := nomino.Make(nomino.NewConfig(
 | |
| 		nomino.WithOriginalSlugLang("Diese & Dass", "de"),
 | |
| 		nomino.WithGenerator(nomino.Incremental()),
 | |
| 	))
 | |
| 
 | |
| 	fmt.Println(st)
 | |
| 	// Output: 0_diese-und-dass.txt
 | |
| }
 |