diff --git a/src/analyzer.rs b/src/analyzer.rs index 1b1e647d81..37d02f098c 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -8,7 +8,7 @@ pub(crate) struct Analyzer<'run, 'src> { modules: Table<'src, Justfile<'src>>, recipes: Vec<&'run Recipe<'src, UnresolvedDependency<'src>>>, sets: Table<'src, Set<'src>>, - unexports: HashSet, + unexports: BTreeSet, warnings: Vec, } diff --git a/src/environment.rs b/src/environment.rs index 942eee7953..34bed20084 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -11,7 +11,7 @@ impl Environment { dotenv: &BTreeMap, scope: &Scope, settings: &Settings, - unexports: &HashSet, + unexports: &BTreeSet, ) -> Environment { let mut environment = Self { variables: BTreeMap::new(), @@ -30,7 +30,7 @@ impl Environment { environment } - fn scope(&mut self, scope: &Scope, settings: &Settings, unexports: &HashSet) { + fn scope(&mut self, scope: &Scope, settings: &Settings, unexports: &BTreeSet) { if let Some(parent) = scope.parent() { self.scope(parent, settings, unexports); } diff --git a/src/justfile.rs b/src/justfile.rs index f2135d7ec9..cb8735d9d3 100644 --- a/src/justfile.rs +++ b/src/justfile.rs @@ -41,7 +41,7 @@ pub(crate) struct Justfile<'src> { pub(crate) recipes: Table<'src, Arc>>, pub(crate) settings: Settings, pub(crate) source: PathBuf, - pub(crate) unexports: HashSet, + pub(crate) unexports: BTreeSet, #[serde(skip)] pub(crate) unstable_features: BTreeSet, pub(crate) warnings: Vec, diff --git a/tests/json.rs b/tests/json.rs index 84c33ec445..3270f0c72a 100644 --- a/tests/json.rs +++ b/tests/json.rs @@ -1574,3 +1574,25 @@ fn arg_help() { }, ); } + +#[test] +fn json_dump_unexports_order_is_nondeterministic() { + Test::new() + .justfile( + " + unexport a + unexport b + unexport c + unexport d + unexport e + unexport f + unexport g + unexport h + unexport i + unexport j + ", + ) + .args(["--dump", "--dump-format", "json"]) + .stdout_regex(r#".*"unexports":\["a","b","c","d","e","f","g","h","i","j"\].*"#) + .success(); +}