MCPcopy Create free account
hub / github.com/cel-expr/cel-go / ParseTextproto

Method ParseTextproto

tools/celtest/test_runner.go:258–272  ·  view source on GitHub ↗

ParseTextproto parses a test suite file in Textproto format.

(path string)

Source from the content-addressed store, hash-verified

256
257// ParseTextproto parses a test suite file in Textproto format.
258func (p *tsParser) ParseTextproto(path string) (*conformancepb.TestSuite, error) {
259 if path == "" {
260 return nil, nil
261 }
262 if fileFormat := compiler.InferFileFormat(path); fileFormat != compiler.TextProto {
263 return nil, fmt.Errorf("invalid file extension wanted: .textproto: found %v", fileFormat)
264 }
265 testSuite := &conformancepb.TestSuite{}
266 data, err := os.ReadFile(path)
267 if err != nil {
268 return nil, fmt.Errorf("os.ReadFile(%q) failed: %v", path, err)
269 }
270 err = prototext.Unmarshal(data, testSuite)
271 return testSuite, err
272}
273
274// ParseYAML parses a test suite file in YAML format.
275func (p *tsParser) ParseYAML(path string) (*test.Suite, error) {

Callers

nothing calls this directly

Calls 1

InferFileFormatFunction · 0.92

Tested by

no test coverage detected