Skip to content

Commit

Permalink
add tests for default case without semicolon
Browse files Browse the repository at this point in the history
  • Loading branch information
cymotive-eldad-sitbon authored and idank committed Apr 7, 2024
1 parent 9595d79 commit b619964
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,41 @@ def test_case_clause_sequence(self):
)
)

def test_case_default_without_semicolon(self):
s = """case ${1} in
pattern1) echo pattern1;;
*) echo pattern2
esac"""
self.assertASTEquals(s,
compoundnode(s,
casenode(s,
reservedwordnode('case', 'case'),
wordnode('${1}', '${1}', [
parameternode('1', '${1}'),
]),
reservedwordnode('in', 'in'),
compoundnode('pattern1) echo pattern1',
patternnode('pattern1', wordnode('pattern1', 'pattern1')),
reservedwordnode(')', ')'),
commandnode('echo pattern1',
wordnode('echo', 'echo'),
wordnode('pattern1', 'pattern1'),
),
),
reservedwordnode(';;', ';;'),
compoundnode('*) echo pattern2',
patternnode('*', wordnode('*', '*')),
reservedwordnode(')', ')'),
commandnode('echo pattern2',
wordnode('echo', 'echo'),
wordnode('pattern2', 'pattern2'),
),
),
reservedwordnode('esac', 'esac'),
)
)
)

def test_unimplemented(self):
s = 'coproc echo'
self.assertASTEquals(s,
Expand Down

0 comments on commit b619964

Please sign in to comment.