internal/mcp: move jsonschema out of mcp/internal
The jsonschema package is part of of the API of the mcp package, so it should not be internal. Change-Id: I9520797837329fc2cda09c2f46ec4d48d031b9d3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/669996 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
3d33fafc5d
commit
15e0c9ef02
1 changed files with 6 additions and 6 deletions
37
jsonschema/resolve_test.go
Normal file
37
jsonschema/resolve_test.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright 2025 The Go MCP SDK Authors. All rights reserved.
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package jsonschema
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCheckLocal(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
s *Schema
|
||||
want string // error must be non-nil and match this regexp
|
||||
}{
|
||||
{nil, "nil"},
|
||||
{
|
||||
&Schema{Pattern: "]["},
|
||||
"regexp",
|
||||
},
|
||||
{
|
||||
&Schema{PatternProperties: map[string]*Schema{"*": nil}},
|
||||
"regexp",
|
||||
},
|
||||
} {
|
||||
_, err := tt.s.Resolve()
|
||||
if err == nil {
|
||||
t.Errorf("%s: unexpectedly passed", tt.s.json())
|
||||
continue
|
||||
}
|
||||
if !regexp.MustCompile(tt.want).MatchString(err.Error()) {
|
||||
t.Errorf("%s: did not match\nerror: %s\nregexp: %s",
|
||||
tt.s.json(), err, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue