• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / modo / 13180866156

06 Feb 2025 02:21PM CUT coverage: 73.089% (-1.0%) from 74.08%
13180866156

push

github

web-flow
Add tests for CLI commands (#212)

36 of 54 new or added lines in 6 files covered. (66.67%)

2314 of 3166 relevant lines covered (73.09%)

40.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

63.64
/internal/document/rename.go
1
package document
2

3
func (proc *Processor) renameAll(p *Package) {
5✔
4
        proc.renamePackage(p, p.Name)
5✔
5
}
5✔
6

7
func (proc *Processor) renamePackage(p *Package, ownPath string) {
9✔
8
        for i := range p.Packages {
13✔
9
                newPath := ownPath + "." + p.Packages[i].Name
4✔
10
                proc.renamePackage(p.Packages[i], newPath)
4✔
11
                if newName, ok := proc.renameExports[newPath]; ok {
4✔
12
                        tempPkg := *p.Packages[i]
×
13
                        tempPkg.MemberName = MemberName{Name: newName}
×
14
                        p.Packages[i] = &tempPkg
×
15
                }
×
16
        }
17

18
        for i := range p.Modules {
18✔
19
                newPath := ownPath + "." + p.Modules[i].Name
9✔
20
                proc.renameModule(p.Modules[i], newPath)
9✔
21
                if newName, ok := proc.renameExports[newPath]; ok {
13✔
22
                        tempMod := *p.Modules[i]
4✔
23
                        tempMod.MemberName = MemberName{Name: newName}
4✔
24
                        p.Modules[i] = &tempMod
4✔
25
                }
4✔
26
        }
27

28
        for i := range p.Aliases {
17✔
29
                newPath := ownPath + "." + p.Aliases[i].Name
8✔
30
                if newName, ok := proc.renameExports[newPath]; ok {
16✔
31
                        tempMod := *p.Aliases[i]
8✔
32
                        tempMod.MemberName = MemberName{Name: newName}
8✔
33
                        p.Aliases[i] = &tempMod
8✔
34
                }
8✔
35
        }
36
        for i := range p.Structs {
14✔
37
                newPath := ownPath + "." + p.Structs[i].Name
5✔
38
                if newName, ok := proc.renameExports[newPath]; ok {
9✔
39
                        tempMod := *p.Structs[i]
4✔
40
                        tempMod.MemberName = MemberName{Name: newName}
4✔
41
                        p.Structs[i] = &tempMod
4✔
42
                }
4✔
43
        }
44
        for i := range p.Traits {
13✔
45
                newPath := ownPath + "." + p.Traits[i].Name
4✔
46
                if newName, ok := proc.renameExports[newPath]; ok {
4✔
47
                        tempMod := *p.Traits[i]
×
48
                        tempMod.MemberName = MemberName{Name: newName}
×
49
                        p.Traits[i] = &tempMod
×
50
                }
×
51
        }
52
        for i := range p.Functions {
13✔
53
                newPath := ownPath + "." + p.Functions[i].Name
4✔
54
                if newName, ok := proc.renameExports[newPath]; ok {
4✔
55
                        tempMod := *p.Functions[i]
×
56
                        tempMod.MemberName = MemberName{Name: newName}
×
57
                        p.Functions[i] = &tempMod
×
58
                }
×
59
        }
60
}
61

62
func (proc *Processor) renameModule(m *Module, ownPath string) {
9✔
63
        for i := range m.Aliases {
18✔
64
                newPath := ownPath + "." + m.Aliases[i].Name
9✔
65
                if newName, ok := proc.renameExports[newPath]; ok {
9✔
66
                        tempMod := *m.Aliases[i]
×
67
                        tempMod.MemberName = MemberName{Name: newName}
×
68
                        m.Aliases[i] = &tempMod
×
69
                }
×
70
        }
71
        for i := range m.Structs {
18✔
72
                newPath := ownPath + "." + m.Structs[i].Name
9✔
73
                if newName, ok := proc.renameExports[newPath]; ok {
9✔
74
                        tempMod := *m.Structs[i]
×
75
                        tempMod.MemberName = MemberName{Name: newName}
×
76
                        m.Structs[i] = &tempMod
×
77
                }
×
78
        }
79
        for i := range m.Traits {
10✔
80
                newPath := ownPath + "." + m.Traits[i].Name
1✔
81
                if newName, ok := proc.renameExports[newPath]; ok {
1✔
82
                        tempMod := *m.Traits[i]
×
83
                        tempMod.MemberName = MemberName{Name: newName}
×
84
                        m.Traits[i] = &tempMod
×
85
                }
×
86
        }
87
        for i := range m.Functions {
10✔
88
                newPath := ownPath + "." + m.Functions[i].Name
1✔
89
                if newName, ok := proc.renameExports[newPath]; ok {
1✔
90
                        tempMod := *m.Functions[i]
×
91
                        tempMod.MemberName = MemberName{Name: newName}
×
92
                        m.Functions[i] = &tempMod
×
93
                }
×
94
        }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc