From 832690957a9cff797d87dfb681bb7ea7c6c655e3 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Tue, 27 Jan 2026 19:49:16 +0000 Subject: [PATCH] Require loot-condition-interpreter v6 It includes new functionality that is required for the metadata syntax v0.29. Add a couple of tests that rely on that new functionality so that the dependency is backed by tests that fail if it's not met. --- Cargo.toml | 2 +- src/database/conditions.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index dd321ec4..a4bd95be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ crc32fast = "1" esplugin = "6.1" libloadorder = "18.5" log = { version = "0.4.6", features = ["std"] } -loot-condition-interpreter = ">= 5, < 7" +loot-condition-interpreter = "6" petgraph = ">= 0.6, < 0.9" rayon = "1" regress = "0.10.5" diff --git a/src/database/conditions.rs b/src/database/conditions.rs index bad6d2f9..9d3138c3 100644 --- a/src/database/conditions.rs +++ b/src/database/conditions.rs @@ -194,4 +194,31 @@ mod tests { assert!(evaluate_all_conditions(plugin, &state).unwrap().is_none()); } } + + mod evaluate_condition { + use crate::tests::source_plugins_path; + + use super::*; + + #[test] + fn should_support_version_with_comparator_as_second_parameter() { + let mut state = loot_condition_interpreter::State::new( + loot_condition_interpreter::GameType::Oblivion, + source_plugins_path(crate::GameType::Oblivion), + ); + state.set_plugin_versions(&[("Blank.esp", "1.0.0")]); + + assert!(evaluate_condition("version(\"Blank.esp\", ==, \"1.0.0\")", &state).unwrap()); + } + + #[test] + fn should_eval_less_than_missing_version_as_false() { + let state = loot_condition_interpreter::State::new( + loot_condition_interpreter::GameType::Oblivion, + source_plugins_path(crate::GameType::Oblivion), + ); + + assert!(!evaluate_condition("version(\"example.esp\", \"1.0.0\", <)", &state).unwrap()); + } + } }