From b61996483d494b5f51e2fc648bd9e4371139aae6 Mon Sep 17 00:00:00 2001 From: Eldad Sitbon Date: Wed, 3 Apr 2024 15:44:24 +0300 Subject: [PATCH] add tests for default case without semicolon --- tests/test_parser.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/test_parser.py b/tests/test_parser.py index edffe9ca..10809c79 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -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,