github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/vfs/errorfs/errorfs_test.go (about) 1 // Copyright 2023 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 // of this source code is governed by a BSD-style license that can be found in 3 // the LICENSE file. 4 5 package errorfs 6 7 import ( 8 "fmt" 9 "strings" 10 "testing" 11 12 "github.com/cockroachdb/datadriven" 13 ) 14 15 func TestErrorFS(t *testing.T) { 16 var sb strings.Builder 17 datadriven.RunTest(t, "testdata/errorfs", func(t *testing.T, td *datadriven.TestData) string { 18 sb.Reset() 19 switch td.Cmd { 20 case "parse-dsl": 21 for _, l := range strings.Split(strings.TrimSpace(td.Input), "\n") { 22 inj, err := ParseDSL(l) 23 if err != nil { 24 fmt.Fprintf(&sb, "parsing err: %s\n", err) 25 } else { 26 fmt.Fprintf(&sb, "%s\n", inj.String()) 27 } 28 } 29 return sb.String() 30 default: 31 return fmt.Sprintf("unrecognized command %q", td.Cmd) 32 } 33 }) 34 }