diff --git a/coverage_sh/plugin.py b/coverage_sh/plugin.py index 77d328b..da1e74a 100644 --- a/coverage_sh/plugin.py +++ b/coverage_sh/plugin.py @@ -37,7 +37,6 @@ TMP_PATH = Path(os.environ.get("XDG_RUNTIME_DIR", "/tmp")) # noqa: S108 TRACEFILE_PREFIX = "shelltrace" EXECUTABLE_NODE_TYPES = { - "subshell", "redirected_statement", "variable_assignment", "variable_assignments", @@ -51,7 +50,6 @@ "while_statement", "if_statement", "case_statement", - "pipeline", "list", } SUPPORTED_MIME_TYPES = {"text/x-shellscript"} diff --git a/tests/test_plugin.py b/tests/test_plugin.py index a6afb2d..7ec48cb 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -248,6 +248,41 @@ def test_lines_should_return_executable_lines(self, tmp_path: Path) -> None: pytest.param( "case x in\n x) echo match ;;\nesac\n", {2, 3}, id="esac_excluded" ), + pytest.param( + """\ + echo aaa + func() + { + echo bbb + } + func + """, + {2, 5, 7}, + id="func_brace", + ), + pytest.param( + """\ + echo aaa + func() + ( + echo aaa + ) + func + """, + {2, 5, 7}, + id="func_paren", + ), + pytest.param( + """\ + { + echo aaa + # comment + echo bbb + } | grep a + """, + {3, 5, 6}, + id="long_pipeline", + ), ], ) def test_executable_lines(