mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 13:01:21 -03:00
Fix threads::init() was not called at startup!
Happens when running `cargo nextest run test_replace_home_directory_with_tilde`, due to process-isolation model.
Backtrace shows:
EnvStack::set_one(HOME)
EnvStack::set
env_dispatch_var_change
reader_current_data
reader_data_stack
assert_is_main_thread
is_main_thread
main_thread_id
Fix by using TestEnvironment instead, as this is a unit-test and does
not need anything more.
This commit is contained in:
committed by
Peter Ammon
parent
8513bb8dc4
commit
8dee291200
@@ -1559,7 +1559,7 @@ mod tests {
|
||||
tests::prelude::*,
|
||||
};
|
||||
use fish_widestring::{ANY_STRING, str2wcstring};
|
||||
use std::collections::{HashSet, hash_map::RandomState};
|
||||
use std::collections::{HashMap, HashSet, hash_map::RandomState};
|
||||
|
||||
fn expand_test_impl(
|
||||
input: &wstr,
|
||||
@@ -2004,13 +2004,9 @@ fn test_abbreviations() {
|
||||
#[test]
|
||||
fn test_replace_home_directory_with_tilde() {
|
||||
use super::replace_home_directory_with_tilde as rhdwt;
|
||||
use crate::env::{EnvMode, EnvSetMode, EnvStack};
|
||||
let vars = EnvStack::new();
|
||||
vars.set_one(
|
||||
L!("HOME"),
|
||||
EnvSetMode::new(EnvMode::GLOBAL, false),
|
||||
L!("/home/testuser").to_owned(),
|
||||
);
|
||||
let vars = TestEnvironment {
|
||||
vars: HashMap::from([(L!("HOME").to_owned(), L!("/home/testuser").to_owned())]),
|
||||
};
|
||||
|
||||
assert_eq!(rhdwt("/home/testuser/", &vars), "~/");
|
||||
assert_eq!(rhdwt("/home/testuser/Documents/", &vars), "~/Documents/");
|
||||
|
||||
Reference in New Issue
Block a user