Skip to content

Commit e19b89a

Browse files
committed
Add more examples
1 parent 78d0e36 commit e19b89a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

normadresse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func NormalizeLength(str string, maxLen int) string {
2626
re := regexp.MustCompile(rule.long)
2727
str = re.ReplaceAllString(str, rule.short)
2828
if len(str) <= maxLen {
29-
return str
29+
break
3030
}
3131
}
3232
str = strings.Replace(str, " @", "", -1)

normadresse_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ func ExampleNormalize() {
1313
// Output: BD MAL J M DE LATTRE DE TASSIGNY
1414
}
1515

16+
func ExampleNormalizeLength_100() {
17+
fmt.Println(strings.ToUpper(NormalizeLength("BOULEVARD DU MARECHAL JEAN MARIE DE LATTRE DE TASSIGNY", 100)))
18+
// Output: BOULEVARD DU MARECHAL JEAN MARIE DE LATTRE DE TASSIGNY
19+
}
20+
21+
func ExampleNormalizeLength_32() {
22+
fmt.Println(strings.ToUpper(NormalizeLength("BOULEVARD DU MARECHAL JEAN MARIE DE LATTRE DE TASSIGNY", 32)))
23+
// Output: BD MAL J M DE LATTRE DE TASSIGNY
24+
}
25+
26+
func ExampleNormalizeLength_10() {
27+
fmt.Println(strings.ToUpper(NormalizeLength("BOULEVARD DU MARECHAL JEAN MARIE DE LATTRE DE TASSIGNY", 10)))
28+
// Output: BD MAL J M LATTRE TASSIGNY
29+
}
30+
1631
func Test(t *testing.T) {
1732
Convey("Test package", t, FailureContinues, func() {
1833
tests := [][]string{

0 commit comments

Comments
 (0)