Fix parsing of or chains from string
Signed-off-by: trivernis <trivernis@protonmail.com>pull/8/head
parent
36d0853a8b
commit
fa904761f5
@ -0,0 +1,26 @@
|
||||
use super::super::common;
|
||||
use hydrus_api::wrapper::builders::or_chain_builder::OrChainBuilder;
|
||||
use hydrus_api::wrapper::builders::tag_builder::TagBuilder;
|
||||
use hydrus_api::wrapper::or_chain::OrChain;
|
||||
|
||||
#[test]
|
||||
fn it_parses_from_string() {
|
||||
common::setup();
|
||||
let chain_string =
|
||||
"'character:megumin' or 'character:aqua' OR '-character:hatsune miku'or 'terminator'";
|
||||
let chain = OrChain::from(chain_string);
|
||||
assert_eq!(
|
||||
chain,
|
||||
OrChainBuilder::new()
|
||||
.add_tag("character:megumin".into())
|
||||
.add_tag("character:aqua".into())
|
||||
.add_tag(
|
||||
TagBuilder::new("hatsune miku")
|
||||
.namespace("character")
|
||||
.negate()
|
||||
.build()
|
||||
)
|
||||
.add_tag("terminator".into())
|
||||
.build()
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue