Merge pull request #224 from biojppm/fix/223_terminating_line

fix assertion peeking scalar on last line when it is whitespace only
This commit is contained in:
jpmag
2022-03-09 10:47:18 +01:00
committed by GitHub
5 changed files with 131 additions and 47 deletions

View File

@@ -160,51 +160,6 @@ jobs:
- {name: shared32-run, run: source .github/setenv.sh && c4_run_test shared32}
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}
#----------------------------------------------------------------------------
clang_tidy:
name: ${{matrix.cxx}}/tidy/c++${{matrix.std}}/${{matrix.bt}}
needs: clang_canary
if: |
(!contains(github.event.head_commit.message, 'skip all')) ||
(!contains(github.event.head_commit.message, 'skip clang')) ||
contains(github.event.head_commit.message, 'only clang')
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
# clang tidy takes a long time, so don't do multiple bits/linktypes
- {std: 11, cxx: clang++-10, bt: Debug , lint: clang-tidy, bitlinks: shared64 static64, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: Debug , lint: clang-tidy, bitlinks: shared32 static32, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: ReleaseWithDebInfo, lint: clang-tidy, bitlinks: shared64 static64, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: ReleaseWithDebInfo, lint: clang-tidy, bitlinks: shared32 static32, os: ubuntu-18.04}
env: {STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"}
steps:
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
- {name: install requirements, run: source .github/reqs.sh && c4_install_test_requirements $OS}
- {name: show info, run: source .github/setenv.sh && c4_show_info}
- name: shared64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared64
- {name: shared64-build, run: source .github/setenv.sh && c4_build_test shared64}
- {name: shared64-run, run: source .github/setenv.sh && c4_run_test shared64}
- {name: shared64-pack, run: source .github/setenv.sh && c4_package shared64}
- name: static64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static64
- {name: static64-build, run: source .github/setenv.sh && c4_build_test static64}
- {name: static64-run, run: source .github/setenv.sh && c4_run_test static64}
- {name: static64-pack, run: source .github/setenv.sh && c4_package static64}
- name: static32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static32
- {name: static32-build, run: source .github/setenv.sh && c4_build_test static32}
- {name: static32-run, run: source .github/setenv.sh && c4_run_test static32}
- {name: static32-pack, run: source .github/setenv.sh && c4_package static32}
- name: shared32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared32
- {name: shared32-build, run: source .github/setenv.sh && c4_build_test shared32}
- {name: shared32-run, run: source .github/setenv.sh && c4_run_test shared32}
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}
#----------------------------------------------------------------------------
clang_sanitize:
name: ${{matrix.cxx}}/san/c++${{matrix.std}}/${{matrix.bt}}

72
.github/workflows/clang_tidy.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: clang_tidy
defaults:
run:
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash -e -x {0}
on:
# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
env:
PROJ_PFX_TARGET: ryml-
PROJ_PFX_CMAKE: RYML_
CMAKE_FLAGS: -DRYML_TEST_SUITE=ON
NUM_JOBS_BUILD: # 4
jobs:
clang_tidy:
name: ${{matrix.cxx}}/tidy/c++${{matrix.std}}/${{matrix.bt}}
if: |
(!contains(github.event.head_commit.message, 'skip all')) ||
(!contains(github.event.head_commit.message, 'skip clang')) ||
contains(github.event.head_commit.message, 'only clang')
continue-on-error: false
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
# clang tidy takes a long time, so don't do multiple bits/linktypes
- {std: 11, cxx: clang++-10, bt: Debug , lint: clang-tidy, bitlinks: shared64, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: Debug , lint: clang-tidy, bitlinks: static64, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: Debug , lint: clang-tidy, bitlinks: shared32, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: Debug , lint: clang-tidy, bitlinks: static32, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: ReleaseWithDebInfo, lint: clang-tidy, bitlinks: shared64, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: ReleaseWithDebInfo, lint: clang-tidy, bitlinks: static64, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: ReleaseWithDebInfo, lint: clang-tidy, bitlinks: shared32, os: ubuntu-18.04}
- {std: 11, cxx: clang++-10, bt: ReleaseWithDebInfo, lint: clang-tidy, bitlinks: static32, os: ubuntu-18.04}
env: {STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"}
steps:
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
- {name: install requirements, run: source .github/reqs.sh && c4_install_test_requirements $OS}
- {name: show info, run: source .github/setenv.sh && c4_show_info}
- name: shared64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared64
- {name: shared64-build, run: source .github/setenv.sh && c4_build_test shared64}
- {name: shared64-run, run: source .github/setenv.sh && c4_run_test shared64}
- {name: shared64-pack, run: source .github/setenv.sh && c4_package shared64}
- name: static64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static64
- {name: static64-build, run: source .github/setenv.sh && c4_build_test static64}
- {name: static64-run, run: source .github/setenv.sh && c4_run_test static64}
- {name: static64-pack, run: source .github/setenv.sh && c4_package static64}
- name: static32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static32
- {name: static32-build, run: source .github/setenv.sh && c4_build_test static32}
- {name: static32-run, run: source .github/setenv.sh && c4_run_test static32}
- {name: static32-pack, run: source .github/setenv.sh && c4_package static32}
- name: shared32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared32
- {name: shared32-build, run: source .github/setenv.sh && c4_build_test shared32}
- {name: shared32-run, run: source .github/setenv.sh && c4_run_test shared32}
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}

View File

@@ -0,0 +1,3 @@
### Fixes
- Fix [#223](https://github.com/biojppm/rapidyaml/issues/223): assertion peeking into the last line when it was whitespaces only.

View File

@@ -2823,10 +2823,8 @@ C4_ALWAYS_INLINE size_t _extend_from_combined_newline(char nl, char following)
csubstr from_next_line(csubstr rem)
{
size_t nlpos = rem.first_of("\r\n");
#ifdef RYML_NO_COVERAGE__TO_BE_DELETED
if(nlpos == csubstr::npos)
return {};
#endif
const char nl = rem[nlpos];
rem = rem.right_of(nlpos);
if(rem.empty())

View File

@@ -944,6 +944,62 @@ N(STREAM,
}),
})
);
ADD_CASE_TO_GROUP("issue223 0 fails",
R"(
A:
- 1
- 4
B:
- 2
- 3
)",
N(L{
N("A", L{N("1"), N("4")}),
N("B", L{N("2"), N("3")}),
})
);
ADD_CASE_TO_GROUP("issue223 1 passes",
R"(A:
- 1
- 4
B:
- 2
- 3
)",
N(L{
N("A", L{N("1"), N("4")}),
N("B", L{N("2"), N("3")}),
})
);
ADD_CASE_TO_GROUP("issue223 2 passes",
R"(A:
- 1
- 4
B:
- 2
- 3)",
N(L{
N("A", L{N("1"), N("4")}),
N("B", L{N("2"), N("3")}),
})
);
ADD_CASE_TO_GROUP("issue223 3 fails",
R"(A:
- 1
- 4
B:
- 2
- 3
)",
N(L{
N("A", L{N("1"), N("4")}),
N("B", L{N("2"), N("3")}),
})
);
}
} // namespace yml