Remove retired runtime wrappers and persistent cache machinery
This commit is contained in:
33
internal/framework/contracts/validation_result_test.go
Normal file
33
internal/framework/contracts/validation_result_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestValidationResultRejectsInvalidFindings(t *testing.T) {
|
||||
for _, result := range []ValidationResult{
|
||||
{CorrectionGuidance: "Correct the response."},
|
||||
{ReasonCode: "invalid"},
|
||||
{ReasonCode: strings.Repeat("a", MaxValidationReasonCodeBytes+1), CorrectionGuidance: "Correct the response."},
|
||||
{ReasonCode: " \t", CorrectionGuidance: "Correct the response."},
|
||||
{ReasonCode: "invalid", CorrectionGuidance: string([]byte{0xff})},
|
||||
{ReasonCode: "invalid", CorrectionGuidance: strings.Repeat("a", MaxValidationCorrectionGuidanceBytes+1)},
|
||||
{Approved: true, Diagnostics: []ProducerDiagnostic{{}}},
|
||||
} {
|
||||
if err := ValidateValidationResult(result); err == nil {
|
||||
t.Fatalf("invalid validation result accepted: %#v", result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidationResultAllowsAbsentOptionalCorrectionFields(t *testing.T) {
|
||||
for _, result := range []ValidationResult{
|
||||
{Approved: true},
|
||||
{ReasonCode: "invalid-evidence", CorrectionGuidance: "Provide source-backed evidence."},
|
||||
} {
|
||||
if err := ValidateValidationResult(result); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user