diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-11T09·15+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-08-25T12·07+0000 |
commit | a0cbc78a8330941b43a6aec00e1f3b8d72eb0f81 (patch) | |
tree | bd48043e13af7c98ffdc9cae618deb288b890e1c /tvix/eval/src/value/attrs/tests.rs | |
parent | 9407af5684ca5602df51c4edddc428db7fc98417 (diff) |
refactor(tvix/value): ensure internal attrs representation is hidden r/4481
Wraps the attrs representation in an additional newtype struct with a private field in order to hide the representation from other modules. This is done in order to avoid accidental leakage of the internals outside of value::attrs. Change-Id: I68d1d02514aa0443df4c39801001a3f1f6cc5d5c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6146 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/value/attrs/tests.rs')
-rw-r--r-- | tvix/eval/src/value/attrs/tests.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tvix/eval/src/value/attrs/tests.rs b/tvix/eval/src/value/attrs/tests.rs index 9bd8305482ab..647a35865549 100644 --- a/tvix/eval/src/value/attrs/tests.rs +++ b/tvix/eval/src/value/attrs/tests.rs @@ -5,7 +5,7 @@ fn test_empty_attrs() { let attrs = NixAttrs::construct(0, vec![]).expect("empty attr construction should succeed"); assert!( - matches!(attrs, NixAttrs::Empty), + matches!(attrs, NixAttrs(AttrsRep::Empty)), "empty attribute set should use optimised representation" ); } @@ -19,7 +19,7 @@ fn test_simple_attrs() { .expect("simple attr construction should succeed"); assert!( - matches!(attrs, NixAttrs::Map(_)), + matches!(attrs, NixAttrs(AttrsRep::Map(_))), "simple attribute set should use map representation", ) } @@ -43,7 +43,8 @@ fn test_kv_attrs() { .expect("constructing K/V pair attrs should succeed"); match kv_attrs { - NixAttrs::KV { name, value } if name == meaning_val || value == forty_two_val => {} + NixAttrs(AttrsRep::KV { name, value }) if name == meaning_val || value == forty_two_val => { + } _ => panic!( "K/V attribute set should use optimised representation, but got {:?}", |