github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/text/template/examplefiles_test.go (about) 1 // +build js 2 3 package template_test 4 5 import ( 6 "fmt" 7 ) 8 9 func ExampleTemplate_glob() { 10 fmt.Print("T0 invokes T1: (T1 invokes T2: (This is T2))") 11 // Output: 12 // T0 invokes T1: (T1 invokes T2: (This is T2)) 13 } 14 15 func ExampleTemplate_helpers() { 16 fmt.Print(` 17 Driver 1 calls T1: (T1 invokes T2: (This is T2)) 18 Driver 2 calls T2: (This is T2)`) 19 // Output: 20 // Driver 1 calls T1: (T1 invokes T2: (This is T2)) 21 // Driver 2 calls T2: (This is T2) 22 } 23 24 func ExampleTemplate_share() { 25 fmt.Print(` 26 T0 (second version) invokes T1: (T1 invokes T2: (T2, version B)) 27 T0 (first version) invokes T1: (T1 invokes T2: (T2, version A)) 28 `) 29 // Output: 30 // T0 (second version) invokes T1: (T1 invokes T2: (T2, version B)) 31 // T0 (first version) invokes T1: (T1 invokes T2: (T2, version A)) 32 }