diff options
Diffstat (limited to 'test/tc_history.py')
-rw-r--r-- | test/tc_history.py | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/test/tc_history.py b/test/tc_history.py index d027231a..02a8bb9f 100644 --- a/test/tc_history.py +++ b/test/tc_history.py @@ -13,7 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if __name__ == '__main__': from __init__ import init; init() +import os.path +import sys +rangerpath = os.path.join(os.path.dirname(__file__), '..') +if sys.path[1] != rangerpath: + sys.path[1:1] = [rangerpath] from ranger.container import History from unittest import TestCase, main @@ -29,13 +33,13 @@ class Test(TestCase): hist.back() self.assertEqual(4, hist.current()) - self.assertEqual([3,4], list(hist)) + self.assertEqual([3,4], list(hist._left())) self.assertEqual(5, hist.top()) hist.back() self.assertEqual(3, hist.current()) - self.assertEqual([3], list(hist)) + self.assertEqual([3], list(hist._left())) # no change if current == bottom self.assertEqual(hist.current(), hist.bottom()) @@ -48,12 +52,31 @@ class Test(TestCase): hist.forward() hist.forward() self.assertEqual(5, hist.current()) - self.assertEqual([3,4,5], list(hist)) + self.assertEqual([3,4,5], list(hist._left())) self.assertEqual(3, hist.bottom()) hist.add(6) self.assertEqual(4, hist.bottom()) - self.assertEqual([4,5,6], list(hist)) + self.assertEqual([4,5,6], list(hist._left())) + + hist.back() + hist.fast_forward() + self.assertEqual([4,5,6], list(hist._left())) + hist.back() + hist.back() + hist.fast_forward() + self.assertEqual([4,5,6], list(hist._left())) + hist.back() + hist.back() + hist.back() + hist.fast_forward() + self.assertEqual([4,5,6], list(hist._left())) + hist.back() + hist.back() + hist.back() + hist.back() + hist.fast_forward() + self.assertEqual([4,5,6], list(hist._left())) if __name__ == '__main__': main() |