github.com/sleungcy/cli@v7.1.0+incompatible/integration/v6/isolated/table_alignment_test.go (about) 1 package isolated 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 . "github.com/onsi/gomega/gbytes" 8 . "github.com/onsi/gomega/gexec" 9 ) 10 11 var _ = Describe("table alignment", func() { 12 BeforeEach(func() { 13 helpers.LoginCF() 14 }) 15 16 When("output is in English", func() { 17 BeforeEach(func() { 18 helpers.LoginCF() 19 helpers.TargetOrgAndSpace(ReadOnlyOrg, ReadOnlySpace) 20 }) 21 22 // Developer note: The spacing in this test is significant and explicit. Do 23 // not replace with a regex. 24 It("aligns the table correctly", func() { 25 username, _ := helpers.GetCredentials() 26 session := helpers.CF("target") 27 Eventually(session).Should(Say("api endpoint: %s", apiURL)) 28 Eventually(session).Should(Say(`api version: [\d.]+`)) 29 Eventually(session).Should(Say("user: %s", username)) 30 Eventually(session).Should(Say("org: %s", ReadOnlyOrg)) 31 Eventually(session).Should(Say("space: %s", ReadOnlySpace)) 32 Eventually(session).Should(Exit(0)) 33 }) 34 }) 35 36 When("output is in language with multibyte characters", func() { 37 BeforeEach(func() { 38 helpers.LoginCF() 39 helpers.TargetOrgAndSpace(ReadOnlyOrg, ReadOnlySpace) 40 }) 41 42 // Developer note: The spacing in this test is significant and explicit. Do 43 // not replace with a regex. 44 It("aligns the table correctly", func() { 45 username, _ := helpers.GetCredentials() 46 session := helpers.CFWithEnv(map[string]string{"LANG": "ja-JP.utf8"}, "target") 47 Eventually(session).Should(Say("API エンドポイント %s", apiURL)) 48 Eventually(session).Should(Say(`API バージョン: [\d.]+`)) 49 Eventually(session).Should(Say("ユーザー: %s", username)) 50 Eventually(session).Should(Say("組織: %s", ReadOnlyOrg)) 51 Eventually(session).Should(Say("スペース: %s", ReadOnlySpace)) 52 Eventually(session).Should(Exit(0)) 53 }) 54 }) 55 })