github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/strings/case_test.go (about) 1 package strings_test 2 3 import ( 4 "context" 5 "testing" 6 7 . "github.com/smartystreets/goconvey/convey" 8 9 "github.com/MontFerret/ferret/pkg/runtime/values" 10 "github.com/MontFerret/ferret/pkg/stdlib/strings" 11 ) 12 13 func TestLower(t *testing.T) { 14 Convey("When args are not passed", t, func() { 15 Convey("It should return an error", func() { 16 var err error 17 _, err = strings.Lower(context.Background()) 18 19 So(err, ShouldBeError) 20 21 }) 22 }) 23 24 Convey("Lower('FOOBAR') should return 'foobar'", t, func() { 25 out, _ := strings.Lower( 26 context.Background(), 27 values.NewString("FOOBAR"), 28 ) 29 30 So(out, ShouldEqual, "foobar") 31 }) 32 } 33 34 func TestUpper(t *testing.T) { 35 Convey("When args are not passed", t, func() { 36 Convey("It should return an error", func() { 37 var err error 38 _, err = strings.Upper(context.Background()) 39 40 So(err, ShouldBeError) 41 42 }) 43 }) 44 45 Convey("Lower('foobar') should return 'FOOBAR'", t, func() { 46 out, _ := strings.Upper( 47 context.Background(), 48 values.NewString("foobar"), 49 ) 50 51 So(out, ShouldEqual, "FOOBAR") 52 }) 53 }