forked from rjkroege/edwood
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecmd_test.go
64 lines (58 loc) · 1.28 KB
/
ecmd_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
package main
import (
"github.com/rjkroege/edwood/file"
"testing"
)
// Test for https://github.com/rjkroege/edwood/issues/291
// {gh issue view 291}
func DISABLED_TestXCmdPipeMultipleWindows(t *testing.T) {
cedit = make(chan int)
ccommand = make(chan *Command)
cwait = make(chan ProcessState)
newWindow := func(name string) *Window {
w := NewWindow()
w.body.file = file.MakeObservableEditableBuffer(name, nil)
w.body.w = w
w.body.fr = &MockFrame{}
w.body.file.AddObserver(&w.body)
w.tag.file = file.MakeObservableEditableBuffer("", nil)
w.tag.w = w
w.tag.fr = &MockFrame{}
w.tag.file.AddObserver(&w.tag)
w.editoutlk = make(chan bool, 1)
return w
}
row = Row{
col: []*Column{
{
w: []*Window{
newWindow("one.txt"),
newWindow("two.txt"),
},
},
},
}
defer func() {
cedit = nil
ccommand = nil
cwait = nil
row = Row{}
warningsMu.Lock()
defer warningsMu.Unlock()
// remove fsysmount failure warning
warnings = []*Warning{}
}()
// All middle button commands including Edit run inside a lock discipline
// set up by MovedMouse.
row.lk.Lock()
defer row.lk.Unlock()
cp := &cmdParser{
buf: []rune("X |cat\n"),
pos: 0,
}
cmd, err := cp.parse(0)
if err != nil {
t.Fatalf("failed to parse command: %v", err)
}
X_cmd(nil, cmd)
}