summaryrefslogtreecommitdiff
path: root/src/twelve.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2020-06-17 19:31:00 -0400
committerOwen Jacobson <owen@grimoire.ca>2020-06-17 20:04:59 -0400
commit29645913aed26471b6d6f9303d6fc2825c00931c (patch)
tree471c5c06a8e7f8c46e985f12afc239fa98efbccb /src/twelve.rs
parent5257b85551459098b8e74cb14e6294a4f1a4226e (diff)
Disregard test strings that can be converted to numbers when testing non-numeric strings.
This is a straight oversight in the property. We asserted the proposition "the string contains no NULs implies the string will be rejected," but the test suite found a counterexample: `"0"` contains no NULs and is not rejected. This is correct behaviour - the string "0" should be converted to the port number 0! So, now the proposition is more complex: "the string contains no NULs and cannot be converted to a number implies the string will be rejected." This closely mirrors the implementation, which isn't fantastic, but I can't see a more succinct and accurate way to frame the property.
Diffstat (limited to 'src/twelve.rs')
-rw-r--r--src/twelve.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/twelve.rs b/src/twelve.rs
index 34b7756..273b17f 100644
--- a/src/twelve.rs
+++ b/src/twelve.rs
@@ -195,6 +195,9 @@ mod tests {
if env_port.contains("\x00") {
return TestResult::discard();
}
+ if env_port.parse::<u16>().is_ok() {
+ return TestResult::discard();
+ }
env_locked(|| {
env::set_var("PORT", env_port.to_string());