@@ -25,10 +25,9 @@ type runtimeCase struct {
2525 Input * conformanceInput `json:"input"`
2626 ExpectedValue * conformanceInput `json:"expected_value"`
2727 ExpectedError * struct {
28- GoMessage string `json:"go_message"`
29- Code string `json:"code"`
30- Reason string `json:"reason"`
31- Field string `json:"field"`
28+ Code string `json:"code"`
29+ Reason string `json:"reason"`
30+ Field string `json:"field"`
3231 } `json:"expected_error"`
3332}
3433
@@ -44,24 +43,6 @@ func runtimeRows(t *testing.T, input []map[string]conformanceInput) []record.Sou
4443 return rows
4544}
4645
47- func runtimeRefusal (t * testing.T , err error , c runtimeCase ) {
48- t .Helper ()
49- var diagnostic * encrypt.Diagnostic
50- if c .ExpectedError .GoMessage != "" {
51- if ! errors .Is (err , encrypt .ErrEncoding ) || errors .As (err , & diagnostic ) || err .Error () != c .ExpectedError .GoMessage {
52- t .Fatalf ("unexpected host refusal: %v" , err )
53- }
54- return
55- }
56- if ! errors .Is (err , encrypt .ErrEncoding ) || ! errors .As (err , & diagnostic ) {
57- t .Fatalf ("expected encoding diagnostic, got %v" , err )
58- }
59- want := c .ExpectedError
60- if diagnostic .Code != want .Code || diagnostic .Reason () != want .Reason || diagnostic .Field () != want .Field {
61- t .Fatalf ("unexpected diagnostic: %s reason=%s field=%s" , diagnostic .Code , diagnostic .Reason (), diagnostic .Field ())
62- }
63- }
64-
6546func TestRuntimeConformance (t * testing.T ) {
6647 var corpus struct {
6748 Version int `json:"version"`
@@ -93,6 +74,12 @@ func TestRuntimeConformance(t *testing.T) {
9374 }
9475 seen [c .ID ] = true
9576 t .Run (c .ID , func (t * testing.T ) {
77+ if c .Null != "" && c .Null != "sql" && c .Null != "sealed" {
78+ t .Fatalf ("unknown null policy %q" , c .Null )
79+ }
80+ if c .Kind != "int32" && c .Kind != "int64" && c .Kind != "uint64" && c .Kind != "float64" && c .Kind != "bool" && c .Kind != "string" {
81+ t .Fatalf ("unsupported runtime kind %q" , c .Kind )
82+ }
9683 plan := & record.Plan {Context : []string {"conformance" }, Fields : []record.Field {{Name : "value" , Kind : record .Kind (c .Kind ), Null : record .Null (c .Null ), Outputs : []record.Output {record .Ciphertext , record .Equality }}}}
9784 switch c .Operation {
9885 case "seal" :
@@ -104,7 +91,7 @@ func TestRuntimeConformance(t *testing.T) {
10491 if c .ExpectedRows != nil || c .ExpectedStored != nil || c .EqualLengths {
10592 t .Fatal ("ambiguous seal outcome" )
10693 }
107- runtimeRefusal (t , err , c )
94+ assertConformanceDiagnostic (t , err , c . ExpectedError . Code , c . ExpectedError . Reason , c . ExpectedError . Field )
10895 return
10996 }
11097 if err != nil {
@@ -165,7 +152,7 @@ func TestRuntimeConformance(t *testing.T) {
165152 if c .ExpectedValue != nil {
166153 t .Fatal ("ambiguous query outcome" )
167154 }
168- runtimeRefusal (t , err , c )
155+ assertConformanceDiagnostic (t , err , c . ExpectedError . Code , c . ExpectedError . Reason , c . ExpectedError . Field )
169156 return
170157 }
171158 if err != nil {
0 commit comments