pik-piam / gms

Other
1 stars 15 forks source link

if chooseFromList gets empty list, just return it #70

Closed orichters closed 1 year ago

orichters commented 1 year ago
  1. chooseFromList(NULL) or chooseFromList(list()) now directly returns the empty list instead of this nonsense where you cannot actually select anything meaningful:
    
    Please choose runs to be used for output generation:

1,a: all 2,p: Search pattern by regular expression... 3,f: Search by fixed pattern...


2. I use the `with_mocked_bindings` binding `getLine` to `stop()` or some specific value now everywhere in chooseFromList tests to avoid that the script hangs on such a call instead of failing. The only substantive change in the test script is adding:
zerolength <- list(NULL, logical(0), character(0), numeric(0), list(), a = NULL)
for (z in zerolength) {
  expect_identical(chooseFromList(z), z)
  expect_message(chooseFromList(z), "returning the empty list")
}
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.23% :tada:

Comparison is base (7bdb21f) 34.72% compared to head (764429f) 34.96%.

:exclamation: Current head 764429f differs from pull request most recent head 829080c. Consider uploading reports for the commit 829080c to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #70 +/- ## ========================================== + Coverage 34.72% 34.96% +0.23% ========================================== Files 51 51 Lines 1673 1676 +3 ========================================== + Hits 581 586 +5 + Misses 1092 1090 -2 ``` | [Files Changed](https://app.codecov.io/gh/pik-piam/gms/pull/70?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pik-piam) | Coverage Δ | | |---|---|---| | [R/chooseFromList.R](https://app.codecov.io/gh/pik-piam/gms/pull/70?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pik-piam#diff-Ui9jaG9vc2VGcm9tTGlzdC5S) | `98.78% <100.00%> (+2.57%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.