From ebb8ed5651e5ff4edafac274af42ea7221472007 Mon Sep 17 00:00:00 2001 From: Mattia Gheda Date: Sat, 25 Jan 2014 11:54:18 -0500 Subject: [PATCH] test substrings --- test/on_off_test.go | 4 ++-- test/timer_test.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/on_off_test.go b/test/on_off_test.go index df0bfd9..c73eff8 100644 --- a/test/on_off_test.go +++ b/test/on_off_test.go @@ -27,7 +27,7 @@ func TestOnOffWidget(t *testing.T) { w.SetChannels(c, i) w.Start() Convey("When an entry is sent", func() { - w.Input <- i3status.Entry{} + w.Input <- i3status.Entry{Name: "OnOff"} Convey("widget status goes on", func() { So(w.On, ShouldEqual, true) }) @@ -44,7 +44,7 @@ func TestOnOffWidgetMessage(t *testing.T) { Convey("When and entry is sent", func() { msg := <-c So(msg.FullText, ShouldEqual, "Pants Off") - w.Input <- i3status.Entry{} + w.Input <- i3status.Entry{Name: "OnOff"} Convey("widget message is On", func() { msg = <-c So(msg.FullText, ShouldEqual, "Pants On") diff --git a/test/timer_test.go b/test/timer_test.go index 4ebbb37..b084b17 100644 --- a/test/timer_test.go +++ b/test/timer_test.go @@ -32,10 +32,10 @@ func TestTimerWidgetStartEvent(t *testing.T) { msg := <-c i <- i3status.Entry{"Timer", "0", 1, 0, 0} time.Sleep(1) - Convey("timer status is running", func() { - So(w.Status, ShouldEqual, "running") + Convey("timer status is started", func() { + So(w.Status, ShouldContainSubstring, "started") msg = <-c - So(msg.FullText, ShouldEqual, "Timer running") + So(msg.FullText, ShouldContainSubstring, "started") }) }) }) @@ -55,8 +55,8 @@ func TestTimerWidgetPauseEvent(t *testing.T) { time.Sleep(1) Convey("timer status is paused", func() { msg = <-c - So(w.Status, ShouldEqual, "paused") - So(msg.FullText, ShouldEqual, "Timer paused") + So(w.Status, ShouldContainSubstring, "paused") + So(msg.FullText, ShouldContainSubstring, "paused") }) }) }) @@ -76,8 +76,8 @@ func TestTimerWidgetStopEvent(t *testing.T) { time.Sleep(1) Convey("timer status is stopped", func() { msg = <-c - So(w.Status, ShouldEqual, "stopped") - So(msg.FullText, ShouldEqual, "Timer stopped") + So(w.Status, ShouldContainSubstring, "stopped") + So(msg.FullText, ShouldContainSubstring, "stopped") }) }) })