Given I have a function like:
func getTotalMemory() string {
out,_ := exec.Command("grep", "MemTotal", "/proc/meminfo").Output()
t := strings.Split(string(out), ":")
x := strings.TrimSpace(t[1])
return x
}
How can I write a test for that function to make sure I'm parsing it properly? In ruby I would just do something like
os.expects(:Command).and_returns("string")
I'm currently using GoConvey if that has any impact on answers.
Thanks!