Skip to content

Commit

Permalink
test all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Aug 7, 2023
1 parent 0bb28f7 commit 2962b92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
matrix:
sentencecase: ['on+guess', 'on', 'off']
caseprotection: [ 'as-needed', 'strict', 'off' ]
preservequoted: [ 'false', 'true' ]
steps:
- uses: actions/checkout@v3
- run: echo "::version="`jq -r .version package.json` >> $GITHUB_OUTPUT
Expand All @@ -34,7 +35,7 @@ jobs:
- name: install node dependencies
run: npm install

- run: npm test --sentence-case=${{ matrix.sentencecase }} --case-protection=${{ matrix.caseprotection }} --big
- run: npm test --sentence-case=${{ matrix.sentencecase }} --case-protection=${{ matrix.caseprotection }} --preserve-quoted=${{ matrix.preservequoted }}--big

release:
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions test/tap
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ const prefix = 'npm_config_'
const valid = {
sentence_case: ['on+guess', 'on', 'off'],
case_protection: [ 'as-needed', 'strict', 'off' ],
preserveQuoted: [ 'false', 'true' ],
preserve_quoted: [ 'false', 'true' ],
}
const multi = ['test']

const config = Object.assign({
all: '',
sentence_case: valid.sentence_case.slice(0, 1),
case_protection: valid.case_protection.slice(0, 1),
preserveQuoted: valid.preserveQuoted.slice(0, 1),
preserve_quoted: valid.preserve_quoted.slice(0, 1),
test: [''],
snapshot: '',
unabbreviations: path.resolve(path.join(__dirname, '..', 'unabbrev.json')),
Expand Down Expand Up @@ -94,11 +94,11 @@ for (const bibfile of testcases) {

for (const sentence_case of config.sentence_case) {
for (const case_protection of config.case_protection) {
for (const preserveQuoted of config.preserveQuoted) {
for (const preserve_quoted of config.preserve_quoted) {
if (config.toobig.includes(basename)) continue

const unabbreviate = config.unabbreviate.includes(basename);
const settings = `sentencecase=${sentence_case}^caseprotection=${case_protection}${preserveQuoted === 'true' ? '^preservequoted' : ''}`;
const settings = `sentencecase=${sentence_case}^caseprotection=${case_protection}${preserve_quoted === 'true' ? '^preservequoted' : ''}`;

; ((bibfile, options, name, snapshot) => {
tap.test(name, async t => {
Expand All @@ -113,7 +113,7 @@ for (const bibfile of testcases) {
{
caseProtection: case_protection === 'off' ? false : case_protection,
sentenceCase: sentence_case.startsWith('on'),
preserveQuoted: preserveQuoted === 'true',
preserve_quoted: preserve_quoted === 'true',
guessAlreadySentenceCased: sentence_case.endsWith('guess'),
unabbreviations: unabbreviate && config.unabbreviations,
strings: unabbreviate && config.strings,
Expand Down

0 comments on commit 2962b92

Please sign in to comment.