|
|
|
@ -1,11 +1,17 @@
|
|
|
|
|
#!/usr/bin/env python2
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
from testify import *
|
|
|
|
|
import mock
|
|
|
|
|
from testify import TestCase
|
|
|
|
|
from testify import assert_equal
|
|
|
|
|
from testify import run
|
|
|
|
|
|
|
|
|
|
import autojump_utils
|
|
|
|
|
from autojump_utils import decode
|
|
|
|
|
from autojump_utils import first
|
|
|
|
|
from autojump_utils import second
|
|
|
|
|
from autojump_utils import last
|
|
|
|
|
from autojump_utils import sanitize
|
|
|
|
|
from autojump_utils import second
|
|
|
|
|
from autojump_utils import surround_quotes
|
|
|
|
|
from autojump_utils import take
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -14,6 +20,18 @@ class StringTestCase(TestCase):
|
|
|
|
|
assert_equal(decode(r'blah'), u'blah')
|
|
|
|
|
assert_equal(decode(r'日本語'), u'日本語')
|
|
|
|
|
|
|
|
|
|
@mock.patch.object(autojump_utils, 'in_bash', return_value=True)
|
|
|
|
|
def test_surround_quotes_in_bash(self, _):
|
|
|
|
|
assert_equal(surround_quotes('foo'), '"foo"')
|
|
|
|
|
|
|
|
|
|
@mock.patch.object(autojump_utils, 'in_bash', return_value=False)
|
|
|
|
|
def test_dont_surround_quotes_not_in_bash(self, _):
|
|
|
|
|
assert_equal(surround_quotes('foo'), 'foo')
|
|
|
|
|
|
|
|
|
|
def test_sanitize(self):
|
|
|
|
|
assert_equal(sanitize([]), [])
|
|
|
|
|
assert_equal(sanitize([r'/foo/bar/', r'/']), [u'/foo/bar', u'/'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IterationTestCase(TestCase):
|
|
|
|
|
def test_first(self):
|
|
|
|
|