mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-19 12:12:42 +02:00
Add test for cmd obj cloning
This commit is contained in:
parent
5cb82a49f8
commit
78bbdca757
@ -1,7 +1,10 @@
|
|||||||
package oscommands
|
package oscommands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os/exec"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/jesseduffield/gocui"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCmdObjToString(t *testing.T) {
|
func TestCmdObjToString(t *testing.T) {
|
||||||
@ -31,3 +34,20 @@ func TestCmdObjToString(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestClone(t *testing.T) {
|
||||||
|
task := gocui.NewFakeTask()
|
||||||
|
cmdObj := &CmdObj{task: task, cmd: &exec.Cmd{}}
|
||||||
|
clone := cmdObj.Clone()
|
||||||
|
if clone == cmdObj {
|
||||||
|
t.Errorf("Clone should not return the same object")
|
||||||
|
}
|
||||||
|
|
||||||
|
if clone.GetTask() == nil {
|
||||||
|
t.Errorf("Clone task should not be nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
if clone.GetTask() != task {
|
||||||
|
t.Errorf("Clone should have the same task")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user