Skip to content

Commit da84dd6

Browse files
committed
Made test for iteration order a unit test
# Conflicts: # string-cache-codegen/tests/reproducibility_test.rs
1 parent 42a87bd commit da84dd6

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

string-cache-codegen/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ edition = "2018"
1212
name = "string_cache_codegen"
1313
path = "lib.rs"
1414

15-
[[test]]
16-
name = "reproducibility_test"
17-
harness = true
18-
1915
[dependencies]
2016
phf_generator = "0.11"
2117
phf_shared = "0.11"

string-cache-codegen/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ impl AtomType {
181181
)
182182
}
183183

184+
#[cfg(test)]
184185
/// Write generated code to destination [`Vec<u8>`] and return it as [`String`]
185186
///
186187
/// Used mostly for testing or displaying a value.
@@ -334,3 +335,16 @@ impl AtomType {
334335
self.write_to(BufWriter::new(File::create(path)?))
335336
}
336337
}
338+
339+
#[test]
340+
fn test_iteration_order() {
341+
let x1 = crate::AtomType::new("foo::Atom", "foo_atom!")
342+
.atoms(&["x", "xlink", "svg", "test"])
343+
.write_to_string(Vec::new()).expect("write to string cache x1");
344+
345+
let x2 = crate::AtomType::new("foo::Atom", "foo_atom!")
346+
.atoms(&["x", "xlink", "svg", "test"])
347+
.write_to_string(Vec::new()).expect("write to string cache x2");
348+
349+
assert_eq!(x1, x2);
350+
}

string-cache-codegen/tests/reproducibility_test.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)