More tests, workflows PR comment for feature test - #405
Conversation
…s and add-features
|
Split into two workflows now (Since PR from forked repo does not have write permissions) First workflow runs the Feature test (test-phonemes.R) first and stores data. Then runs the tests suite. Verified the workflow on my forked branch, PR comment works with PR from a forked repo. Will work once the new workflow file gets added to master. Current test fails are the 5 ISOcodes that do not match with glottolog (More info in this PR that fixes them: #403) |
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| actions: write |
There was a problem hiding this comment.
why does this job need actions: write?
There was a problem hiding this comment.
Job does not need actions: write. I wrongly assumed writing file needed it. Removed in 520b592. Tested on separate fork.
| run: | | ||
| Rscript -e "testthat::test_dir('.', stop_on_failure=TRUE)" | ||
| Rscript -e "testthat::test_dir('.', filter = 'phonemes', invert = TRUE, stop_on_failure = TRUE)" | ||
|
No newline at end of file |
There was a problem hiding this comment.
stray whitespace
| test_that("multiple clicks in sequence with a modifier are all preserved", { | ||
| ## two different clicks + one modifier, all typed "M". | ||
| result <- order_ipa("ǀǁʰ") | ||
| expect(stri_detect_fixed(result, "ǀ"), | ||
| paste("First click character was lost from", shQuote(result))) | ||
| expect(stri_detect_fixed(result, "ǁ"), | ||
| paste("Second click character was lost from", shQuote(result))) | ||
| expect(nchar(result) == 3, | ||
| paste("Expected a 3-character result, got", shQuote(result), | ||
| "(", nchar(result), "characters)")) | ||
| }) | ||
|
|
There was a problem hiding this comment.
| test_that("multiple clicks in sequence with a modifier are all preserved", { | |
| ## two different clicks + one modifier, all typed "M". | |
| result <- order_ipa("ǀǁʰ") | |
| expect(stri_detect_fixed(result, "ǀ"), | |
| paste("First click character was lost from", shQuote(result))) | |
| expect(stri_detect_fixed(result, "ǁ"), | |
| paste("Second click character was lost from", shQuote(result))) | |
| expect(nchar(result) == 3, | |
| paste("Expected a 3-character result, got", shQuote(result), | |
| "(", nchar(result), "characters)")) | |
| }) |
no point to test this as you can't have 2 click glyphs in a row (click glyphs must always be accompanied by a preceding base glyph that denotes the place of back closure; the click glyph denotes front closure). In other words ǀǁʰ would really have to be kǀkǁʰ or qǀkǁʰ or something like that
| test_that("two separate click+diacritic pairs in one string are both skipped", { | ||
| ## typestring "MDMD" both with clicks, so both should be skipped | ||
| result <- order_ipa("ǀ̥ǁ̥") | ||
| expect(stri_detect_fixed(result, "ǀ"), | ||
| paste("First click character was lost from", shQuote(result))) | ||
| expect(stri_detect_fixed(result, "ǁ"), | ||
| paste("Second click character was lost from", shQuote(result))) | ||
| expect(nchar(result) == 4, | ||
| paste("Expected a 4-character result, got", shQuote(result), | ||
| "(", nchar(result), "characters)")) | ||
| }) | ||
|
|
There was a problem hiding this comment.
I think we can skip this one too, for the same reason as above
| test_that("two separate click+diacritic pairs in one string are both skipped", { | |
| ## typestring "MDMD" both with clicks, so both should be skipped | |
| result <- order_ipa("ǀ̥ǁ̥") | |
| expect(stri_detect_fixed(result, "ǀ"), | |
| paste("First click character was lost from", shQuote(result))) | |
| expect(stri_detect_fixed(result, "ǁ"), | |
| paste("Second click character was lost from", shQuote(result))) | |
| expect(nchar(result) == 4, | |
| paste("Expected a 4-character result, got", shQuote(result), | |
| "(", nchar(result), "characters)")) | |
| }) |
| ## every add-features.R `special_cases` pair has a matching row in special-feature-table.csv | ||
| special_cases <- c("pɸ", "pf", "tθ", "ts", "tʃ", "ʈʂ", "cç", "kx", | ||
| "qχ", "bβ", "bv", "dð", "dz", "dʒ", "ɖʐ", "ɟʝ", "ɡɣ", | ||
| "ɢʁ", "kp", "ɡb") | ||
| special_feats <- read.csv(file.path("..", "raw-data", "FEATURES", | ||
| "special-feature-table.csv"), | ||
| fileEncoding="UTF-8") | ||
| missing <- setdiff(special_cases, special_feats$segment) | ||
| expect(length(missing) == 0, | ||
| paste("special_cases pair(s) missing from special-feature-table.csv:", | ||
| paste(missing, collapse=", "))) | ||
| }) |
There was a problem hiding this comment.
this is OK, but it seems like we could achieve the same thing by calling stopifnot(nrow(base_vec) == 1) right after the lookup, to make sure we got back exactly one row:
Lines 145 to 146 in 6da1f9e
There was a problem hiding this comment.
I agree, that is better. Avoids issue of hardcoded special_cases list in test.
Removed the test in f1c78ca
And renamed file to test-regression-c-cedilla.R since it only tests for c-cedilla now 792ea5a
Added the stopifnow assert in 9f8864d
Reran pipeline, phoible.csv has no diff with committed version.
Added the following regression tests:
Added the following new test
Added the following extra test to test-inventory-metadata.R
Excluded test-phonemes.R from github workflows test suite, but added it as a separate job which writes the output as a comment in the PR
Added tasks to pixi.toml (exactly the same as #398)