// expander-context_test.go package text import ( "fmt" "testing" ) func testCases() []string { return []string{ "#{<(.20)-Param}: #{>(06)-123}", "ciao #{c(r)i<(12)-GIAN Carlo}. #{ub-Come} #{c(G)b-Stai}?", "ciao #{c(r)i>(12)-GIAN Carlo}. #{ub-Come} #{c(G)b-Stai}?", "ciao #{c(red);i}Mario#. #{u;b}Come# #{GREEN;b}Stai#{.}?", "ciao #{c(red)i-Mario}. #{ub-Come} #{GREEN;b-Stai}?", "ciao #{c(r)i-Mario}. #{ub-Come} #{Gr;b-Stai}?", "ciao #{c(r)i-Mario}. #{ub-Come} #{c(G)b-Stai}?", "ciao #{c(r)i'-gian carlo}. #{ub-Come} #{c(G)b-Stai}?", "ciao #{c(r)i\"-gian carlo}. #{ub-Come} #{c(G)b-Stai}?", "ciao #{c(r)i,-GIAN Carlo}. #{ub-Come} #{c(G)b-Stai}?", "ciao #{c(r)i^-GIAN Carlo}. #{ub-Come} #{c(G)b-Stai}?", } } func TestSprintf(t *testing.T) { list := testCases() fmt.Println("--- Sprintf() ---") for i, s := range list { x := Sprintf(s) fmt.Printf("--- Test nr %d: %q\n", i+1, s) fmt.Println(x) } } func TestPrintf(t *testing.T) { list := testCases() fmt.Println("\n--- Printf() ---") for i, s := range list { fmt.Printf("--- Test nr %d: %q\n", i+1, s) Printf(s) fmt.Println() } }