Skip to content

Commit 4698e45

Browse files
committed
Fix the empty section test
Because these are coming from a HashMap, the order is not guaranteed. The workaround is to put them into a HashSet and compare those so order doesn't matter.
1 parent 1f6f20c commit 4698e45

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
use configparser::ini::{Ini, WriteOptions};
1+
use configparser::ini::Ini;
2+
use std::collections::HashSet;
23
use std::error::Error;
34

5+
#[cfg(feature = "indexmap")]
6+
use configparser::ini::WriteOptions;
7+
48
#[test]
59
#[allow(clippy::approx_constant)]
610
fn non_cs() -> Result<(), Box<dyn Error>> {
@@ -243,8 +247,8 @@ basic_option=basic_value
243247
config.read(FILE_CONTENTS.to_owned())?;
244248

245249
assert_eq!(
246-
config.sections(),
247-
vec![String::from("basic_section"), String::from("empty_section")]
250+
HashSet::from_iter(config.sections().into_iter()),
251+
HashSet::from([String::from("basic_section"), String::from("empty_section")])
248252
);
249253

250254
Ok(())

0 commit comments

Comments
 (0)