From e34ce43f4a77fd0cb0b18498e36154662c2fa63f Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 8 Feb 2022 12:15:54 -0800 Subject: [PATCH 1/2] Initially strip only newlines from matched lines Previously all whitespace was stripped, which caused regex patterns that explicitly checked for whitespace at the end of the line to incorrectly fail. --- filecheck/filecheck.py | 2 +- .../07-positive-regex-match-trailing-space/filecheck.check | 1 + .../07-positive-regex-match-trailing-space/filecheck.input | 1 + .../07-positive-regex-match-trailing-space/sample.itest | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.check create mode 100644 tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.input create mode 100644 tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/sample.itest diff --git a/filecheck/filecheck.py b/filecheck/filecheck.py index c1a155e..4fb0efe 100755 --- a/filecheck/filecheck.py +++ b/filecheck/filecheck.py @@ -597,7 +597,7 @@ def exit_handler(code): failed_implicit_check = None while True: - line = line.rstrip() + line = line.rstrip("\n\r") unstripped_line = line diff --git a/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.check b/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.check new file mode 100644 index 0000000..e1237c0 --- /dev/null +++ b/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.check @@ -0,0 +1 @@ +CHECK: {{^}}hello {{$}} diff --git a/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.input b/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.input new file mode 100644 index 0000000..f2aa86d --- /dev/null +++ b/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/filecheck.input @@ -0,0 +1 @@ +hello diff --git a/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/sample.itest b/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/sample.itest new file mode 100644 index 0000000..6b675bd --- /dev/null +++ b/tests/integration/tests/check_commands/CHECK/one_string/positive-match/07-positive-regex-match-trailing-space/sample.itest @@ -0,0 +1 @@ +RUN: %cat "%S/filecheck.input" | %expect_exit 0 --expect-no-content %FILECHECK_EXEC "%S/filecheck.check" From 5fb3a7a8d921ea0e52b9517d1700e823ee560fad Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Wed, 16 Feb 2022 20:24:18 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Bump=20version:=200.0.21=20=E2=86=92=200.0.?= =?UTF-8?q?22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- .github/workflows/ci-mac.yml | 2 +- filecheck/filecheck.py | 2 +- pyproject.toml | 2 +- tests/integration/tests/py-only/version/sample.itest | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0b85048..8e8db36 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.21 +current_version = 0.0.22 commit = True tag = True diff --git a/.github/workflows/ci-mac.yml b/.github/workflows/ci-mac.yml index 735d61a..57cc949 100644 --- a/.github/workflows/ci-mac.yml +++ b/.github/workflows/ci-mac.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 diff --git a/filecheck/filecheck.py b/filecheck/filecheck.py index 4fb0efe..523afc4 100755 --- a/filecheck/filecheck.py +++ b/filecheck/filecheck.py @@ -9,7 +9,7 @@ from difflib import SequenceMatcher from enum import Enum -__version__ = "0.0.21" +__version__ = "0.0.22" from typing import Optional, List, Iterable diff --git a/pyproject.toml b/pyproject.toml index 24b9b53..c8e13d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "filecheck" -version = "0.0.21" +version = "0.0.22" description = "Python port of LLVM's FileCheck, flexible pattern matching file verifier" authors = ["Stanislav Pankevich "] diff --git a/tests/integration/tests/py-only/version/sample.itest b/tests/integration/tests/py-only/version/sample.itest index 98db440..aaeeba7 100644 --- a/tests/integration/tests/py-only/version/sample.itest +++ b/tests/integration/tests/py-only/version/sample.itest @@ -1,4 +1,4 @@ RUN: %FILECHECK_EXEC --version | %FILECHECK_TESTER_EXEC %s --match-full-lines CHECK: {{^.*}}FileCheck{{(\.py)?$}} -CHECK: Version: 0.0.21 +CHECK: Version: 0.0.22 CHECK-EMPTY: