-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_test.go
80 lines (74 loc) · 1.79 KB
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package petrovich_test
import (
"fmt"
"github.com/yalosev/petrovich"
)
func ExampleTransform() {
people := []petrovich.Person{
{
Gender: petrovich.Male,
FirstName: "Сергей",
MiddleName: "Иванович",
LastName: "Прокопенко",
},
{
FirstName: "Андрей",
MiddleName: "Павлович",
LastName: "Николаев",
},
{
Gender: petrovich.Female,
FirstName: "Екатерина",
MiddleName: "Алексеевна",
LastName: "Морозова",
},
{
FirstName: "Антонина",
MiddleName: "Сергеевна",
LastName: "Павлова",
},
}
for _, p := range people {
fmt.Println(petrovich.Transform(p, petrovich.Dative))
}
// Output:
// Прокопенко Сергею Ивановичу
// Николаеву Андрею Павловичу
// Морозовой Екатерине Алексеевне
// Павловой Антонине Сергеевне
}
func ExampleTransformShort() {
people := []petrovich.Person{
{
Gender: petrovich.Male,
FirstName: "Сергей",
MiddleName: "Иванович",
LastName: "Прокопенко",
},
{
FirstName: "Андрей",
MiddleName: "Павлович",
LastName: "Николаев",
},
{
Gender: petrovich.Female,
FirstName: "Екатерина",
MiddleName: "Алексеевна",
LastName: "Морозова",
},
{
FirstName: "Антонина",
MiddleName: "Сергеевна",
LastName: "Павлова",
},
}
for _, p := range people {
newp := petrovich.Transform(p, petrovich.Instrumental)
fmt.Println(newp.Short())
}
// Output:
// Прокопенко С.И.
// Николаевым А.П.
// Морозовой Е.А.
// Павловой А.С.
}