summaryrefslogtreecommitdiff
path: root/sid_test.ml
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2018-11-08 13:13:04 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2018-11-08 13:20:09 +0100
commit7b3d8e1d13bab22c82b38012cfcb8cbfe67ed7e5 (patch)
treefe3ff12c741040042e2f55222420d2bde802ca9c /sid_test.ml
parent5fb6d7cbb60bb5420562b9aa336a796d1bb63a2f (diff)
downloadocaml-sid-7b3d8e1d13bab22c82b38012cfcb8cbfe67ed7e5.tar.gz
sid: functorize well-formedness checks
Offload the test for member count and size constraints of sas and ia, respectively, into a separate validation module. This is a preparatory step toward adding less rigid parsing modes.
Diffstat (limited to 'sid_test.ml')
-rw-r--r--sid_test.ml16
1 files changed, 8 insertions, 8 deletions
diff --git a/sid_test.ml b/sid_test.ml
index 7da0d7f..26a125b 100644
--- a/sid_test.ml
+++ b/sid_test.ml
@@ -111,8 +111,8 @@ let sf_parse_nosa_fail () =
(Printf.sprintf "unexpectedly parsed garbage as SID [%s]"
(Sid.to_string s))
| Error e ->
- assert_equal e "Invalid SID: error parsing SID [S-1-1] at position 5, \
- grammar mandates at least one subauthority"
+ assert_equal e "input malformed: subauthority list failed “strict” \
+ validation (count=0)"
let sf_parse_trailing_ok () =
let s = unwrap_of_string "S-1-0-0-" in
@@ -139,8 +139,8 @@ let sf_parse_oobia_fail () =
with
| Ok _ -> assert_failure "unexpectedly parsed the out of bounds subauth"
| Error e ->
- assert_equal e "input malformed: identifier authority from 2³² on must \
- be hex-encoded (value=18446744073709551615)"
+ assert_equal e "input malformed: decimal identifier authority failed \
+ “strict” validation (value=18446744073709551615)"
let sf_parse_oobsa_fail () =
match Sid.of_string
@@ -189,8 +189,8 @@ let sf_parse_iaxxoob_fail () =
(* ias <= UINT32_MAX → decimal; hex not allowed *)
match Sid.of_string "S-1-0x0000deadbeef-17-01" with
| Error e ->
- let expect = "input malformed: identifier authority less than 2³² must \
- not be hex-encoded (value=3735928559)"
+ let expect = "input malformed: hex-encoded identifier authority failed \
+ “strict” validation (value=3735928559)"
in
assert_equal
~msg:(Printf.sprintf "[%s] ≠ [%s]" e expect)
@@ -236,8 +236,8 @@ let sf_parse_iaxxlong_fail () =
(* too many digits, need exactly 12 *)
match Sid.of_string "S-1-0xC01DC01DB100D-17-01" with
| Error e ->
- let expect = "Invalid SID: error parsing SID [S-1-0xC01DC01DB100D-17-01] \
- at position 18, grammar mandates at least one subauthority"
+ let expect = "input malformed: subauthority list failed “strict” \
+ validation (count=0)"
in
assert_equal
~msg:(Printf.sprintf "[%s] ≠ [%s]" e expect)