summaryrefslogtreecommitdiffstats
path: root/tests/hash.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hash.rs')
-rw-r--r--tests/hash.rs22
1 files changed, 6 insertions, 16 deletions
diff --git a/tests/hash.rs b/tests/hash.rs
index 427f8ae..46ecdb4 100644
--- a/tests/hash.rs
+++ b/tests/hash.rs
@@ -1,19 +1,10 @@
-//! The digest helpers (§3, §5.1a).
-//!
-//! `sha256` hex is the currency of identity and provenance here, and one of
-//! those digests — `Identity::hash` — is the value a reviewer's approval echoes
-//! back. Everything that guards "we published what we reviewed" rests on that
-//! digest being a function of the identity and of nothing else: not of the
-//! order fields were declared in, and never of whether serialization happened
-//! to fail.
-
use std::collections::HashMap;
use aur_build::db::model::Identity;
use aur_build::hash;
-/// A value that refuses to be serialized, which is the input the old
-/// implementation answered with `"{}"` — a digest every failed value shared.
+/// A value that refuses to be serialized — the input the old implementation
+/// answered with `"{}"`, a digest every failed value shared.
struct Unserializable;
impl serde::Serialize for Unserializable {
@@ -26,16 +17,15 @@ impl serde::Serialize for Unserializable {
fn a_value_that_cannot_be_serialized_is_an_error_not_an_empty_object() {
let err = hash::canonical_json(&Unserializable).unwrap_err();
assert!(err.to_string().contains("cannot be serialized"), "the failure was swallowed: {err}");
- // The point of propagating: two different unserializable values now fail
- // loudly instead of hashing to the same digest as each other.
+ // Two different unserializable values now fail loudly instead of hashing to
+ // the same digest.
assert!(hash::canonical_json(&Unserializable).is_err());
}
#[test]
fn the_rendering_is_canonical_in_fact_not_in_name() {
- // Same fields, different declaration order: routed through `Value`, both
- // come out with the keys sorted, so the bytes — and any digest of them —
- // are the same.
+ // Same fields, different declaration order: routed through `Value`, both come
+ // out with the keys sorted.
#[derive(serde::Serialize)]
struct Ab {
alpha: String,