Passed
Pull Request — main (#37)
by Rushan
02:17
created

e_validationInterruptedAtFirstViolation   A

Complexity

Conditions 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
dl 0
loc 14
rs 9.9
c 0
b 0
f 0
nop 0
1
package validation_test
2
3
import (
4
	"fmt"
5
6
	"github.com/muonsoft/validation"
7
	"github.com/muonsoft/validation/it"
8
	"github.com/muonsoft/validation/validator"
9
)
10
11
func ExampleValidator_Validate_validationInterruptedAtFirstViolation() {
12
	title := "aaa"
13
14
	err := validator.ValidateString(
15
		&title,
16
		validation.Sequentially(
17
			it.IsBlank(),
18
			it.HasMinLength(5),
19
		),
20
	)
21
22
	violations := err.(validation.ViolationList)
23
	for _, violation := range violations {
24
		fmt.Println(violation.Error())
25
	}
26
	// Output:
27
	// violation: This value should be blank.
28
}
29