From 78b5f7eb19b8bf14df5d524a7d7ce9cad8c4b583 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 20 Dec 2017 21:58:46 +0100 Subject: [PATCH] Functional\tail test --- test/Functional/TailTest.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/Functional/TailTest.php diff --git a/test/Functional/TailTest.php b/test/Functional/TailTest.php new file mode 100644 index 0000000..da9b368 --- /dev/null +++ b/test/Functional/TailTest.php @@ -0,0 +1,43 @@ +assertTrue(tail($listt)->equals($expected)); + } + + public function provideData() + { + return [ + 'Should return tail from finite array' => [ + '$listt' => fromIterable([1, 2, 3]), + '$expected' => fromIterable([2, 3]), + ], + 'Should return tail from finite iterator' => [ + '$listt' => fromIterable(new \ArrayIterator([1, 2, 3])), + '$expected' => fromIterable([2, 3]), + ], + ]; + } + + /** + * @expectedException \Widmogrod\Primitive\EmptyListError + * @expectedExceptionMessage Cannot call tail() on empty list + */ + public function test_it_should_throw_exception_when_list_is_empty() + { + tail(Listt::mempty()); + } +} -- 2.11.0