Add tests for alias
This commit is contained in:
parent
0777a99d30
commit
2e939dbc1b
@ -1,7 +1,7 @@
|
|||||||
import shlex
|
import shlex
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import dotdot
|
import dotdot
|
||||||
|
import argparse
|
||||||
|
|
||||||
import pubs
|
import pubs
|
||||||
from pubs import config
|
from pubs import config
|
||||||
@ -61,6 +61,19 @@ class AliasTestCase(unittest.TestCase):
|
|||||||
shlex.split(self.subprocess.called.splitlines()[-1])[1:],
|
shlex.split(self.subprocess.called.splitlines()[-1])[1:],
|
||||||
args)
|
args)
|
||||||
|
|
||||||
|
def testShellAliasNamedArguments(self):
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--test2')
|
||||||
|
subparsers = parser.add_subparsers(title='commands', dest='command')
|
||||||
|
|
||||||
|
alias = Alias.create_alias('test', '!echo "$@"')
|
||||||
|
alias.parser(subparsers)
|
||||||
|
args = ['test', '2', '--option', '3']
|
||||||
|
args = parser.parse_args(args)
|
||||||
|
|
||||||
|
self.assertEqual(args.command, 'test')
|
||||||
|
self.assertListEqual(args.arguments, ['2', '--option', '3'])
|
||||||
|
|
||||||
|
|
||||||
class AliasPluginTestCase(unittest.TestCase):
|
class AliasPluginTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user