Skip to content

Commit

Permalink
ci: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roosta committed Dec 15, 2024
1 parent 87bdd01 commit 167d8ca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ use std::sync::atomic::{AtomicBool, Ordering};
/// use std::sync::atomic::Ordering;
///
/// // Enable verbose output
/// VERBOSE.store(true, Ordering::Relaxed);
/// i3wsr_core::VERBOSE.store(true, Ordering::Relaxed);
///
/// // Check if verbose is enabled
/// if VERBOSE.load(Ordering::Relaxed) {
/// if i3wsr_core::VERBOSE.load(Ordering::Relaxed) {
/// println!("Verbose output enabled");
/// }
/// ```
Expand Down
32 changes: 16 additions & 16 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use std::env;
use std::error::Error;
use swayipc::{Connection, WindowProperties};
use i3wsr::{Config, update_tree};
use i3wsr_core::{Config, update_tree};

#[test]
fn connection_tree() -> Result<(), Box<dyn Error>> {
env::set_var("DISPLAY", ":99.0");
let mut conn = Connection::new()?;
let config = Config::default();
let res = i3wsr::regex::parse_config(&config)?;
let res = i3wsr_core::regex::parse_config(&config)?;
assert!(update_tree(&mut conn, &config, &res).is_ok());

let tree = conn.get_tree()?;
let workspaces = i3wsr::get_workspaces(tree);
let workspaces = i3wsr_core::get_workspaces(tree);

let name = workspaces.first()
.and_then(|ws| ws.name.as_ref())
Expand All @@ -30,21 +30,21 @@ fn get_title() -> Result<(), Box<dyn Error>> {

let tree = conn.get_tree()?;
let mut properties: Vec<WindowProperties> = Vec::new();
let workspaces = i3wsr::get_workspaces(tree);
let workspaces = i3wsr_core::get_workspaces(tree);
for workspace in &workspaces {
let window_props = {
let mut f = i3wsr::get_properties(vec![workspace.floating_nodes.iter().collect()]);
let mut n = i3wsr::get_properties(vec![workspace.nodes.iter().collect()]);
let mut f = i3wsr_core::get_properties(vec![workspace.floating_nodes.iter().collect()]);
let mut n = i3wsr_core::get_properties(vec![workspace.nodes.iter().collect()]);
n.append(&mut f);
n
};
properties.extend(window_props);
}
let config = i3wsr::Config::default();
let res = i3wsr::regex::parse_config(&config)?;
let config = i3wsr_core::Config::default();
let res = i3wsr_core::regex::parse_config(&config)?;
let result: Result<Vec<String>, _> = properties
.iter()
.map(|props| i3wsr::get_title(props, &config, &res))
.map(|props| i3wsr_core::get_title(props, &config, &res))
.collect();
assert_eq!(result?, vec!["Gpick", "XTerm"]);
Ok(())
Expand All @@ -55,12 +55,12 @@ fn collect_titles() -> Result<(), Box<dyn Error>> {
env::set_var("DISPLAY", ":99.0");
let mut conn = swayipc::Connection::new()?;
let tree = conn.get_tree()?;
let workspaces = i3wsr::get_workspaces(tree);
let workspaces = i3wsr_core::get_workspaces(tree);
let mut result: Vec<Vec<String>> = Vec::new();
let config = i3wsr::Config::default();
let res = i3wsr::regex::parse_config(&config)?;
let config = i3wsr_core::Config::default();
let res = i3wsr_core::regex::parse_config(&config)?;
for workspace in workspaces {
result.push(i3wsr::collect_titles(&workspace, &config, &res));
result.push(i3wsr_core::collect_titles(&workspace, &config, &res));
}
let expected = vec![vec!["Gpick", "XTerm"]];
assert_eq!(result, expected);
Expand All @@ -72,12 +72,12 @@ fn get_properties() -> Result<(), Box<dyn Error>> {
env::set_var("DISPLAY", ":99.0");
let mut conn = swayipc::Connection::new()?;
let tree = conn.get_tree()?;
let workspaces = i3wsr::get_workspaces(tree);
let workspaces = i3wsr_core::get_workspaces(tree);
let mut result: Vec<WindowProperties> = Vec::new();
for workspace in workspaces {
let window_props = {
let mut f = i3wsr::get_properties(vec![workspace.floating_nodes.iter().collect()]);
let mut n = i3wsr::get_properties(vec![workspace.nodes.iter().collect()]);
let mut f = i3wsr_core::get_properties(vec![workspace.floating_nodes.iter().collect()]);
let mut n = i3wsr_core::get_properties(vec![workspace.nodes.iter().collect()]);
n.append(&mut f);
n
};
Expand Down

0 comments on commit 167d8ca

Please sign in to comment.