Documentation
¶
Overview ¶
Package testutils provides shared utilities for JSON Patch testing.
Index ¶
- func ApplyInternalOp(t *testing.T, doc interface{}, op internal.Operation) interface{}
- func ApplyInternalOpWithError(t *testing.T, doc interface{}, op internal.Operation)
- func ApplyInternalOps(t *testing.T, doc interface{}, ops []internal.Operation) interface{}
- func ApplyInternalOpsWithError(t *testing.T, doc interface{}, ops []internal.Operation)
- func ApplyOperation(t *testing.T, doc interface{}, operation jsonpatch.Operation) interface{}
- func ApplyOperationWithError(t *testing.T, doc interface{}, operation jsonpatch.Operation) error
- func ApplyOperations(t *testing.T, doc interface{}, operations []jsonpatch.Operation) interface{}
- func ApplyOperationsWithError(t *testing.T, doc interface{}, operations []jsonpatch.Operation) error
- func RunMultiOperationTestCase(t *testing.T, tc MultiOperationTestCase)
- func RunMultiOperationTestCases(t *testing.T, testCases []MultiOperationTestCase)
- func RunTestCase(t *testing.T, tc TestCase)
- func RunTestCases(t *testing.T, testCases []TestCase)
- type MultiOperationTestCase
- type TestCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyInternalOp ¶ added in v0.5.9
ApplyInternalOp applies a single internal.Operation to a document
func ApplyInternalOpWithError ¶ added in v0.5.9
ApplyInternalOpWithError applies an internal.Operation expecting it to fail
func ApplyInternalOps ¶ added in v0.5.9
ApplyInternalOps applies multiple internal.Operations to a document
func ApplyInternalOpsWithError ¶ added in v0.5.9
ApplyInternalOpsWithError applies multiple internal.Operations expecting them to fail
func ApplyOperation ¶
ApplyOperation applies a single operation to a document
func ApplyOperationWithError ¶
ApplyOperationWithError applies an operation expecting it to fail
func ApplyOperations ¶
ApplyOperations applies multiple operations to a document
func ApplyOperationsWithError ¶
func ApplyOperationsWithError(t *testing.T, doc interface{}, operations []jsonpatch.Operation) error
ApplyOperationsWithError applies multiple operations expecting them to fail
func RunMultiOperationTestCase ¶
func RunMultiOperationTestCase(t *testing.T, tc MultiOperationTestCase)
RunMultiOperationTestCase executes a multi-operation test case
func RunMultiOperationTestCases ¶
func RunMultiOperationTestCases(t *testing.T, testCases []MultiOperationTestCase)
RunMultiOperationTestCases executes multiple multi-operation test cases
func RunTestCase ¶
RunTestCase executes a single test case
func RunTestCases ¶
RunTestCases executes multiple test cases
Types ¶
type MultiOperationTestCase ¶
type MultiOperationTestCase struct {
Name string // Test case name
Doc interface{} // Input document
Operations []jsonpatch.Operation // Operations to apply
Expected interface{} // Expected result
ShouldFail bool // Whether operations should fail
Comment string // Comment or source information
}
MultiOperationTestCase represents a multi-operation test case
type TestCase ¶
type TestCase struct {
Name string // Test case name
Doc interface{} // Input document
Operation jsonpatch.Operation // Operation to apply
Expected interface{} // Expected result
ShouldFail bool // Whether operation should fail
Comment string // Comment or source information
}
TestCase represents a single operation test case