Skip to content

Commit

Permalink
Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
teivah committed Dec 10, 2018
1 parent ed4b46f commit d5adafe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
17 changes: 8 additions & 9 deletions assert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 0 additions & 2 deletions observable.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"github.com/reactivex/rxgo/options"
)

type observableType uint32

// Observable is a basic observable interface
type Observable interface {
Iterable
Expand Down
20 changes: 8 additions & 12 deletions single.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit d5adafe

Please sign in to comment.