From 99b6aba783ba65fc6b5764f7fbc3ec4f67769008 Mon Sep 17 00:00:00 2001 From: Cameron Marotti <39228422+Cyerunix@users.noreply.github.com> Date: Fri, 12 Jul 2024 15:36:39 -0400 Subject: [PATCH] Add test for parsing empty string operands --- .../parser/tests/test_parser_empty_str.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pash_annotations/parser/tests/test_parser_empty_str.py diff --git a/pash_annotations/parser/tests/test_parser_empty_str.py b/pash_annotations/parser/tests/test_parser_empty_str.py new file mode 100644 index 0000000..8a46a25 --- /dev/null +++ b/pash_annotations/parser/tests/test_parser_empty_str.py @@ -0,0 +1,23 @@ +'''This is solely to test whether commands with the empty string as an operand +such as echo "" function properly''' + +from pash_annotations.datatypes.CommandInvocationInitial import CommandInvocationInitial +from pash_annotations.parser.parser import parse + +def test_empty_str_1(): + parser_result = parse('echo ""') + + args = [] + operands = [] + expected_result = CommandInvocationInitial("echo", args, operands) + + assert expected_result == parser_result + +def test_empty_str_2(): + parser_result = parse('cat ""') + + args = [] + operands = [] + expected_result = CommandInvocationInitial("cat", args, operands) + + assert expected_result == parser_result