diff --git a/assert_test.go b/assert_test.go index 375c4f7e..24d04643 100644 --- a/assert_test.go +++ b/assert_test.go @@ -23,15 +23,14 @@ func TestAssertThatObservableIsNotEmpty(t *testing.T) { AssertThatObservable(t, Just(1), IsNotEmpty()) } -// TODO Tests -//func TestAssertThatSingleHasValue(t *testing.T) { -// AssertThatSingle(t, newSingleFrom(1), HasValue(1)) -//} -// -//func TestAssertThatSingleError(t *testing.T) { -// AssertThatSingle(t, newSingleFrom(errors.New("foo")), -// HasRaisedAnError(), HasRaisedError(errors.New("foo"))) -//} +func TestAssertThatSingleHasValue(t *testing.T) { + AssertThatSingle(t, newSingleFrom(1), HasValue(1)) +} + +func TestAssertThatSingleError(t *testing.T) { + AssertThatSingle(t, newSingleFrom(errors.New("foo")), + HasRaisedAnError(), HasRaisedError(errors.New("foo"))) +} func TestAssertThatOptionalSingleIsEmpty(t *testing.T) { AssertThatOptionalSingle(t, newOptionalSingleFrom(optional.Empty()), IsEmpty()) diff --git a/observable.go b/observable.go index 7c43166a..7b6084b7 100644 --- a/observable.go +++ b/observable.go @@ -12,8 +12,6 @@ import ( "github.com/reactivex/rxgo/options" ) -type observableType uint32 - // Observable is a basic observable interface type Observable interface { Iterable diff --git a/single.go b/single.go index 6095692e..abca5cd3 100644 --- a/single.go +++ b/single.go @@ -26,18 +26,14 @@ type optionalSingle struct { ch chan optional.Optional } -//func newSingleFrom(item interface{}) Single { -// s := single{ -// ch: make(chan interface{}), -// } -// -// go func() { -// s.ch <- item -// close(s.ch) -// }() -// -// return &s -//} +func newSingleFrom(item interface{}) Single { + f := func(out chan interface{}) { + out <- item + close(out) + } + s := newColdSingle(f) + return s +} func newOptionalSingleFrom(opt optional.Optional) OptionalSingle { s := optionalSingle{