示例#1
0
def test_cli_drop_restore(full_stash):
    check_command('sw stash drop 1')
    check_command(
        'sw stash', '''\
#  Name  Category  Message
──────────────────────────
2  step  A
3  step
''')
    check_command(
        'sw stash -a', '''\
#  Name  Category  Message
──────────────────────────
1  step            M
2  step  A
3  step
''')

    check_command('sw stash restore 1')
    check_command(
        'sw stash -D', '''\
#  Dep  Name  Category  Message
───────────────────────────────
1       step            M
2       step  A
3    1  step
''')
示例#2
0
def test_cli_ls_full(full_stash):
    check_command(
        'sw stash ls -D', '''\
#  Dep  Name  Category  Message
───────────────────────────────
1       step            M
2       step  A
3    1  step
''')
示例#3
0
def test_cli_peek(full_stash):
    check_command('sw stash peek 1', '''\
{DATE}

\\$ sw step X

1\\. X
''')
    check_command(
        'sw stash -D', '''\
#  Dep  Name  Category  Message
───────────────────────────────
1       step            M
2       step  A
3    1  step
''')
示例#4
0
def test_cli_ls_completed(empty_stash):
    check_command('sw step 1 | sw stash')
    check_command('sw step 2 | sw stash')
    check_command('sw stash drop 2')

    check_command('sw stash ls', '''\
#  Name  Message
────────────────
1  step
''')

    check_command('sw stash ls -a', '''\
#  Name  Message
────────────────
1  step
2  step
''')
示例#5
0
def test_cli_clear(full_stash):
    check_command('sw stash clear')
    check_command('sw stash', '^No stashed protocols.$')
    check_command(
        'sw stash -a', '''\
#  Name  Category  Message
──────────────────────────
1  step            M
2  step  A
3  step
''')
示例#6
0
def test_cli_pop(full_stash):
    check_command('sw stash pop 1', '''\
{DATE}

\\$ sw step X

1\\. X
''')
    check_command(
        'sw stash', '''\
#  Name  Category  Message
──────────────────────────
2  step  A
3  step
''')

    # Can still view a popped protocol, even though it's not listed anymore.
    check_command('sw stash pop 1', '''\
{DATE}

\\$ sw step X

1\\. X
''')
def test_cli_protocol(cmd, stdout, stderr):
    check_command(cmd, stdout=stdout)
示例#8
0
def test_cli(cmd, stdout, stderr):
    check_command(cmd, stdout=stdout)
示例#9
0
def test_main(cmd, env, stdout, stderr, return_code):
    check_command(cmd, stdout, stderr, return_code, env)
示例#10
0
def test_cli_reset(empty_stash):
    check_command('sw step 1 | sw stash')
    check_command('sw step 2 | sw stash -c A -d 1')
    check_command(
        'sw stash -D', '''\
#  Dep  Name  Category  Message
───────────────────────────────
1       step
2    1  step  A
''')

    # - ID numbers update
    # - Categories and dependencies not confused by changing id numbers.
    check_command('sw stash drop 1')
    check_command('sw stash reset')
    check_command(
        'sw stash -D', '''\
#  Name  Category  Message
──────────────────────────
1  step  A
''')

    check_command('sw stash drop 1')
    check_command('sw stash reset')
    check_command('sw stash -a', '''\
No stashed protocols.
''')

    # - Categories and dependencies don't persist across resets.
    check_command('sw step 1 | sw stash')
    check_command('sw step 2 | sw stash')
    check_command('sw stash -D', '''\
#  Name  Message
────────────────
1  step
2  step
''')
示例#11
0
def test_cli_edit(empty_stash):
    check_command('sw step X | sw stash')
    check_command('sw step Y | sw stash')
    check_command('sw stash -a', '''\
#  Name  Message
────────────────
1  step
2  step
''')
    check_command('sw stash peek 1', '''\
{DATE}

\\$ sw step X

1\\. X
''')

    check_command('sw stash edit 1 -m M')
    check_command(
        'sw stash -a', '''\
#  Name  Message
────────────────
1  step  M
2  step
''')

    check_command('sw stash edit 1 -c A')
    check_command(
        'sw stash -a', '''\
#  Name  Category  Message
──────────────────────────
1  step  A         M
2  step
''')

    check_command('sw stash edit 1 -d 2')
    check_command(
        'sw stash -a', '''\
#  Dep  Name  Category  Message
───────────────────────────────
1    2  step  A         M
2       step
''')

    check_command('sw step Z | sw stash edit 1')
    check_command(
        'sw stash -a', '''\
#  Dep  Name  Category  Message
───────────────────────────────
1    2  step  A         M
2       step
''')
    check_command('sw stash peek 1', '''\
{DATE}

\\$ sw step Z

1\\. Z
''')

    check_command('sw stash edit 1 -x -m N')
    check_command(
        'sw stash -a', '''\
#  Name  Message
────────────────
1  step  N
2  step
''')

    check_command('sw stash edit 1 -x -c B')
    check_command(
        'sw stash -a', '''\
#  Name  Category  Message
──────────────────────────
1  step  B
2  step
''')

    check_command('sw stash edit 1 -x -d 2')
    check_command(
        'sw stash -a', '''\
#  Dep  Name  Message
─────────────────────
1    2  step
2       step
''')
示例#12
0
def test_cli_ls_dependencies(empty_stash):
    check_command('sw step 1 | sw stash')
    check_command('sw step 2 | sw stash -d 1')
    check_command('sw step 3 | sw stash -d 1')
    check_command('sw step 4 | sw stash -d 2,3')

    check_command(
        'sw stash -D', '''\
#  Dep  Name  Message
─────────────────────
1       step
2    1  step
3    1  step
4  2,3  step
''')

    check_command('sw stash', '''\
#  Name  Message
────────────────
1  step
''')

    check_command(
        'sw stash -d 1', '''\
#  Dep  Name  Message
─────────────────────
2    1  step
3    1  step
''')

    check_command(
        'sw stash -d 2', '''\
#  Dep  Name  Message
─────────────────────
4  2,3  step
''')

    check_command(
        'sw stash -d 3', '''\
#  Dep  Name  Message
─────────────────────
4  2,3  step
''')

    check_command('sw stash -d 4', '''\
No matching protocols found.
''')

    # Complete a dependency:
    check_command('sw stash drop 1')

    check_command(
        'sw stash -D', '''\
#  Dep  Name  Message
─────────────────────
2       step
3       step
4  2,3  step
''')

    check_command('sw stash', '''\
#  Name  Message
────────────────
2  step
3  step
''')
示例#13
0
def test_cli_ls_categories(empty_stash):
    check_command('sw step X | sw stash -c A')
    check_command('sw step Y | sw stash -c A,B')

    check_command(
        'sw stash ls', '''\
#  Name  Category  Message
──────────────────────────
1  step  A
2  step  A,B
''')

    check_command(
        'sw stash ls -c A', '''\
#  Name  Category  Message
──────────────────────────
1  step  A
2  step  A,B
''')

    check_command(
        'sw stash ls -c B', '''\
#  Name  Category  Message
──────────────────────────
2  step  A,B
''')

    check_command('sw stash ls -c C', '''\
No matching protocols found.
''')
示例#14
0
def test_cli_ls_empty(empty_stash):
    check_command('sw stash ls', '^No stashed protocols.$')
    check_command('sw stash', '^No stashed protocols.$')
示例#15
0
def full_stash(empty_stash):
    check_command('sw step X | sw stash -m M')
    check_command('sw step Y | sw stash -c A')
    check_command('sw step Z | sw stash -d 1')
示例#16
0
def empty_stash():
    check_command('sw stash clear')
    check_command('sw stash reset')