Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7074786

Browse files
committed
Moving files to keep only testd files in packages
1 parent 62af9c4 commit 7074786

7 files changed

Lines changed: 12 additions & 8 deletions

File tree

core/processor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func StartProcessing(
1919
for {
2020
command, more := <-commands
2121
if !more {
22+
close(states)
2223
break
2324
}
2425
newState, err := command.Execute(state)

core/processor_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ func TestStartProcessing(t *testing.T) {
4747
if state.Selected != 1 {
4848
t.Error("StartProcessing didn't process command")
4949
}
50+
state, ok := <-states
51+
if ok {
52+
t.Error("forgot to close states channel")
53+
}
5054
}
5155

5256
func TestDoesntProcessInvalidCommand(t *testing.T) {

godu.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/gdamore/tcell"
1111
"github.com/viktomas/godu/core"
12-
"github.com/viktomas/godu/interactive"
1312
)
1413

1514
func main() {
@@ -26,8 +25,8 @@ func main() {
2625
var wg sync.WaitGroup
2726
wg.Add(3)
2827
go core.StartProcessing(&tree, *limit*core.MEGABYTE, commands, states, &wg)
29-
go interactive.InteractiveTree(s, states, &wg)
30-
go interactive.ParseCommand(s, commands, &wg)
28+
go InteractiveTree(s, states, &wg)
29+
go ParseCommand(s, commands, &wg)
3130
wg.Wait()
3231
s.Fini()
3332
}

interactive/interactive_test.go

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package interactive
1+
package main
22

33
import (
44
"sync"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
package interactive
1+
package main
22

33
import (
44
"github.com/gdamore/tcell"
55
"github.com/viktomas/godu/core"
6+
"github.com/viktomas/godu/interactive"
67
)
78

89
type VisualState struct {
@@ -12,7 +13,7 @@ type VisualState struct {
1213
}
1314

1415
func NewVisualState(state core.State) VisualState {
15-
lines := ReportTree(state.Folder)
16+
lines := interactive.ReportTree(state.Folder)
1617
folders := make([][]rune, len(lines))
1718
xbound := 0
1819
ybound := len(folders)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package interactive
1+
package main
22

33
import (
44
"sync"

0 commit comments

Comments
 (0)