Skip to content

Commit

Permalink
psh: add help command test
Browse files Browse the repository at this point in the history
JIRA: PD-77
  • Loading branch information
damianloew committed Jan 2, 2023
1 parent 05d7394 commit 20a8a37
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions psh/test-help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Phoenix-RTOS
#
# phoenix-rtos-tests
#
# psh help command test
#
# Copyright 2023 Phoenix Systems
# Author: Damian Loewnau
#
# This file is part of Phoenix-RTOS.
#
# %LICENSE%
#

import psh.tools.psh as psh

HELP_LINE_PATTERN = r'((\s*)(?P<cmd>\w+)(\s+)-(\s+\w+)+(\s*)(\n))'


@psh.run
def harness(p):
# asserts that at least 15 help commands are displayed in proper format
psh.assert_cmd(p, 'help', rf'{HELP_LINE_PATTERN}{15,}', is_regex=True)

# psh help does not fail when passing arguments
psh.assert_cmd(p, 'help -a arg1 --arg2 -arg3', rf'{HELP_LINE_PATTERN}{15,}', is_regex=True)
3 changes: 3 additions & 0 deletions psh/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ test:

- name: history
harness: test-history.py

- name: help
harness: test-history.py

0 comments on commit 20a8a37

Please sign in to comment.