mirror of
https://github.com/nushell/nushell
synced 2024-12-27 13:33:16 +00:00
add back in the tests for query_web in the nu_plugin_query (#4614)
* fix first test * fix 2nd query_web test
This commit is contained in:
parent
676457acd3
commit
63487941fb
1 changed files with 25 additions and 22 deletions
|
@ -276,28 +276,31 @@ pub fn css(selector: &str) -> ScraperSelector {
|
||||||
ScraperSelector::parse(selector).expect("this should never trigger")
|
ScraperSelector::parse(selector).expect("this should never trigger")
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[cfg(test)]
|
#[cfg(test)]
|
||||||
// mod tests {
|
mod tests {
|
||||||
// use super::*;
|
use super::*;
|
||||||
|
|
||||||
// const SIMPLE_LIST: &str = r#"
|
const SIMPLE_LIST: &str = r#"
|
||||||
// <ul>
|
<ul>
|
||||||
// <li>Coffee</li>
|
<li>Coffee</li>
|
||||||
// <li>Tea</li>
|
<li>Tea</li>
|
||||||
// <li>Milk</li>
|
<li>Milk</li>
|
||||||
// </ul>
|
</ul>
|
||||||
// "#;
|
"#;
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn test_first_child_is_not_empty() {
|
fn test_first_child_is_not_empty() {
|
||||||
// assert!(!execute_selector_query(SIMPLE_LIST, "li:first-child", false).is_empty())
|
assert!(
|
||||||
// }
|
!execute_selector_query(SIMPLE_LIST, "li:first-child", false, Span::test_data())
|
||||||
|
.is_empty()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn test_first_child() {
|
fn test_first_child() {
|
||||||
// assert_eq!(
|
let item = execute_selector_query(SIMPLE_LIST, "li:first-child", false, Span::test_data());
|
||||||
// vec!["Coffee".to_string()],
|
let config = nu_protocol::Config::default();
|
||||||
// execute_selector_query(SIMPLE_LIST, "li:first-child", false)
|
let out = item.into_string("\n", &config);
|
||||||
// )
|
assert_eq!("[Coffee]".to_string(), out)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
Loading…
Reference in a new issue