mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 01:51:14 -03:00
cargo-test: remove unnecessary TTY initialization
This commit is contained in:
@@ -293,7 +293,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_abbreviations() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
{
|
||||
let mut abbrs = abbrs_get_set();
|
||||
@@ -424,7 +424,7 @@ macro_rules! validate {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn rename_abbrs() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
|
||||
with_abbrs_mut(|abbrs_g| {
|
||||
let mut add = |name: &wstr, repl: &wstr, position: Position| {
|
||||
|
||||
@@ -2832,7 +2832,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_ast_parse() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let src = L!("echo");
|
||||
let ast = ast::parse(src, ParseTreeFlags::default(), None);
|
||||
assert!(!ast.any_error);
|
||||
|
||||
@@ -463,7 +463,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_autoload() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
use crate::fds::wopen_cloexec;
|
||||
use fish_widestring::wcs2zstring;
|
||||
use nix::fcntl::OFlag;
|
||||
|
||||
@@ -74,7 +74,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "escape"], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "escape", ""], STATUS_CMD_OK, "''\n");
|
||||
validate!(["string", "escape", "-n", ""], STATUS_CMD_OK, "\n");
|
||||
|
||||
@@ -113,7 +113,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "join"], STATUS_INVALID_ARGS, "");
|
||||
validate!(["string", "join", ""], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "join", "", "", "", ""], STATUS_CMD_OK, "\n");
|
||||
|
||||
@@ -87,7 +87,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "length"], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "length", ""], STATUS_CMD_ERROR, "0\n");
|
||||
validate!(["string", "length", "", "", ""], STATUS_CMD_ERROR, "0\n0\n0\n");
|
||||
|
||||
@@ -427,7 +427,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "match"], STATUS_INVALID_ARGS, "");
|
||||
validate!(["string", "match", ""], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "match", "", ""], STATUS_CMD_OK, "\n");
|
||||
|
||||
@@ -281,7 +281,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "replace", ""], STATUS_INVALID_ARGS, "");
|
||||
validate!(["string", "replace", "", ""], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "replace", "", "", ""], STATUS_CMD_ERROR, "\n");
|
||||
|
||||
@@ -299,7 +299,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "split"], STATUS_INVALID_ARGS, "");
|
||||
validate!(["string", "split", ":"], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "split", ".", "www.ch.ic.ac.uk"], STATUS_CMD_OK, "www\nch\nic\nac\nuk\n");
|
||||
|
||||
@@ -130,7 +130,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "sub"], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "sub", "abcde"], STATUS_CMD_OK, "abcde\n");
|
||||
validate!(["string", "sub", "-l", "x", "abcde"], STATUS_INVALID_ARGS, "");
|
||||
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
#[serial]
|
||||
#[rustfmt::skip]
|
||||
fn plain() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
validate!(["string", "trim"], STATUS_CMD_ERROR, "");
|
||||
validate!(["string", "trim", ""], STATUS_CMD_ERROR, "\n");
|
||||
validate!(["string", "trim", " "], STATUS_CMD_OK, "\n");
|
||||
|
||||
@@ -1261,7 +1261,7 @@ fn test_test() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_test_builtin() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
test_test_brackets();
|
||||
test_test();
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ fn test_escape_no_printables() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_escape_quotes() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
macro_rules! validate {
|
||||
($cmd:expr, $quote:expr, $no_tilde:expr, $expected:expr) => {
|
||||
assert_eq!(
|
||||
|
||||
@@ -2646,7 +2646,7 @@ fn comma_join(lst: Vec<WString>) -> WString {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_complete() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let vars = PwdEnvironment {
|
||||
parent: TestEnvironment {
|
||||
vars: HashMap::from([
|
||||
@@ -3164,7 +3164,7 @@ macro_rules! unique_completion_applies_as {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_autosuggest_suggest_special() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
macro_rules! perform_one_autosuggestion_cd_test {
|
||||
($command:literal, $expected:literal, $vars:expr) => {
|
||||
@@ -3345,7 +3345,7 @@ macro_rules! perform_one_completion_cd_test {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_autosuggestion_ignores() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Testing scenarios that should produce no autosuggestions
|
||||
macro_rules! perform_one_autosuggestion_should_ignore_test {
|
||||
($command:literal) => {
|
||||
|
||||
2
src/env/environment.rs
vendored
2
src/env/environment.rs
vendored
@@ -812,7 +812,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_env_snapshot() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
std::fs::create_dir_all("test/fish_env_snapshot_test/").unwrap();
|
||||
let parser = TestParser::new();
|
||||
let vars = parser.vars();
|
||||
|
||||
2
src/env/var.rs
vendored
2
src/env/var.rs
vendored
@@ -369,7 +369,7 @@ fn test_timezone_env_vars() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_env_vars() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
test_timezone_env_vars();
|
||||
// TODO: Add tests for the locale vars.
|
||||
|
||||
|
||||
@@ -830,7 +830,7 @@ fn make_test_uvar_path() -> std::io::Result<(TempDir, WString)> {
|
||||
}
|
||||
|
||||
fn test_universal_helper(x: usize, path: &wstr) {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let mut uvars = EnvUniversal::new();
|
||||
uvars.initialize_at_path(path.to_owned());
|
||||
|
||||
@@ -853,7 +853,7 @@ fn test_universal_helper(x: usize, path: &wstr) {
|
||||
|
||||
#[test]
|
||||
fn test_universal() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let (_test_dir, test_path) = make_test_uvar_path().unwrap();
|
||||
|
||||
let threads = 1;
|
||||
@@ -893,7 +893,7 @@ fn test_universal() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_universal_output() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let flag_export = EnvVarFlags::EXPORT;
|
||||
let flag_pathvar = EnvVarFlags::PATHVAR;
|
||||
|
||||
@@ -950,7 +950,7 @@ fn test_universal_output() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_universal_parsing() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let input = concat!(
|
||||
"# This file contains fish universal variable definitions.\n",
|
||||
"# VERSION: 3.0\n",
|
||||
@@ -1002,7 +1002,7 @@ fn test_universal_parsing() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_universal_parsing_legacy() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let input = concat!(
|
||||
"# This file contains fish universal variable definitions.\n",
|
||||
"SET varA:ValA1\\x1eValA2\n",
|
||||
@@ -1030,7 +1030,7 @@ fn test_universal_parsing_legacy() {
|
||||
|
||||
#[test]
|
||||
fn test_universal_callbacks() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let (_test_dir, test_path) = make_test_uvar_path().unwrap();
|
||||
let mut uvars1 = EnvUniversal::new();
|
||||
let mut uvars2 = EnvUniversal::new();
|
||||
@@ -1100,7 +1100,7 @@ macro_rules! sync {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_universal_formats() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
macro_rules! validate {
|
||||
( $version_line:literal, $expected_format:expr ) => {
|
||||
assert_eq!(
|
||||
@@ -1121,7 +1121,7 @@ macro_rules! validate {
|
||||
|
||||
#[test]
|
||||
fn test_universal_ok_to_save() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Ensure we don't try to save after reading from a newer fish.
|
||||
let (_test_dir, test_path) = make_test_uvar_path().unwrap();
|
||||
let contents = b"# VERSION: 99999.99\n";
|
||||
|
||||
@@ -1606,7 +1606,7 @@ fn expand_test_impl(
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_expand() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
/// Perform parameter expansion and test if the output equals the zero-terminated parameter list /// supplied.
|
||||
///
|
||||
@@ -1900,7 +1900,7 @@ macro_rules! expand_test {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_expand_overflow() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Testing overflowing expansions
|
||||
// Ensure that we have sane limits on number of expansions - see #7497.
|
||||
|
||||
@@ -1937,7 +1937,7 @@ fn test_expand_overflow() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_abbreviations() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Testing abbreviations
|
||||
|
||||
with_abbrs_mut(|abbrset| {
|
||||
|
||||
@@ -551,7 +551,7 @@ fn write42(&self) {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn fd_monitor_items() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let monitor = FdMonitor::new();
|
||||
|
||||
// Item which will never receive data or be called.
|
||||
|
||||
@@ -323,7 +323,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_pipes() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Here we just test that each pipe has CLOEXEC set and is in the high range.
|
||||
// Note pipe creation may fail due to fd exhaustion; don't fail in that case.
|
||||
let mut pipes = vec![];
|
||||
|
||||
@@ -733,7 +733,7 @@ fn test_redirections() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_is_potential_path() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Directories
|
||||
std::fs::create_dir_all("test/is_potential_path_test/alpha/").unwrap();
|
||||
std::fs::create_dir_all("test/is_potential_path_test/beta/").unwrap();
|
||||
|
||||
@@ -1330,7 +1330,7 @@ fn get_overlong_path() -> String {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_highlighting() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
// Testing syntax highlighting
|
||||
parser.pushd("test/fish_highlight_test/");
|
||||
@@ -1815,7 +1815,7 @@ macro_rules! validate {
|
||||
#[serial]
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
fn test_trailing_spaces_after_command() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
let vars = parser.vars();
|
||||
|
||||
@@ -1869,7 +1869,7 @@ fn test_trailing_spaces_after_command() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_resolve_role() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
let vars = parser.vars();
|
||||
|
||||
|
||||
@@ -2288,7 +2288,7 @@ fn test_history_merge() {
|
||||
|
||||
#[test]
|
||||
fn test_history_path_detection() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Regression test for #7582.
|
||||
// Temporary directory for the history files.
|
||||
let hist_tmpdir = fish_tempfile::new_dir().unwrap();
|
||||
|
||||
@@ -204,7 +204,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_unlocalized() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let abc_str = LocalizableString::from_external_source(WString::from("abc"));
|
||||
let s: &'static wstr = wgettext!(abc_str);
|
||||
assert_eq!(s, "abc");
|
||||
|
||||
@@ -1322,7 +1322,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_pager_navigation() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Generate 19 strings of width 10. There's 2 spaces between completions, and our term size is
|
||||
// 80; these can therefore fit into 6 columns (6 * 12 - 2 = 70) or 5 columns (58) but not 7
|
||||
// columns (7 * 12 - 2 = 82).
|
||||
@@ -1412,7 +1412,7 @@ macro_rules! validate {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_pager_layout() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// These tests are woefully incomplete
|
||||
|
||||
let rendered_lines = |pager: &mut Pager, width: u16| {
|
||||
|
||||
@@ -1915,7 +1915,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_error_messages() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Given a format string, returns a list of non-empty strings separated by format specifiers. The
|
||||
// format specifiers themselves are omitted.
|
||||
fn separate_by_format_specifiers(format: &wstr) -> Vec<&wstr> {
|
||||
@@ -2007,7 +2007,7 @@ macro_rules! validate {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_get_cmdsubst_extent() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let a = L!("echo (echo (echo hi");
|
||||
assert_eq!(get_cmdsubst_extent(a, 0), 0..a.len());
|
||||
assert_eq!(get_cmdsubst_extent(a, 1), 0..a.len());
|
||||
@@ -2023,7 +2023,7 @@ fn test_get_cmdsubst_extent() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_slice_length() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
assert_eq!(slice_length(L!("[2]")), Some(3));
|
||||
assert_eq!(slice_length(L!("[12]")), Some(4));
|
||||
assert_eq!(slice_length(L!("[\"foo\"]")), Some(7));
|
||||
@@ -2033,7 +2033,7 @@ fn test_slice_length() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_indents() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// A struct which is either text or a new indent.
|
||||
struct Segment {
|
||||
// The indent to set
|
||||
|
||||
@@ -1522,7 +1522,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_parser() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
macro_rules! detect_errors {
|
||||
($src:literal) => {
|
||||
detect_parse_errors(L!($src), None, true /* accept incomplete */)
|
||||
@@ -1825,7 +1825,7 @@ fn detect_argument_errors(src: &str) -> Result<(), ParseIssue> {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_new_parser_correctness() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
macro_rules! validate {
|
||||
($src:expr, $ok:expr) => {
|
||||
let ast = ast::parse(L!($src), ParseTreeFlags::default(), None);
|
||||
@@ -1855,7 +1855,7 @@ macro_rules! validate {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_new_parser_correctness_by_fuzzing() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let fuzzes = [
|
||||
L!("if"),
|
||||
L!("else"),
|
||||
@@ -1921,7 +1921,7 @@ fn string_for_permutation(
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_new_parser_ll2() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Parse a statement, returning the command, args (joined by spaces), and the decoration. Returns
|
||||
// true if successful.
|
||||
fn test_1_parse_ll2(src: &wstr) -> Option<(WString, WString, StatementDecoration)> {
|
||||
@@ -2042,7 +2042,7 @@ macro_rules! check_function_help {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_new_parser_ad_hoc() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Very ad-hoc tests for issues encountered.
|
||||
|
||||
// Ensure that 'case' terminates a job list.
|
||||
@@ -2102,7 +2102,7 @@ fn test_new_parser_ad_hoc() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_new_parser_errors() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
macro_rules! validate {
|
||||
($src:expr, $expected_code:expr) => {
|
||||
let mut errors = vec![];
|
||||
@@ -2138,7 +2138,7 @@ macro_rules! validate {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_eval_recursion_detection() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
// Ensure that we don't crash on infinite self recursion and mutual recursion.
|
||||
let parser = TestParser::new();
|
||||
parser.eval(
|
||||
@@ -2158,7 +2158,7 @@ fn test_eval_recursion_detection() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_eval_illegal_exit_code() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
macro_rules! validate {
|
||||
($cmd:expr, $result:expr) => {
|
||||
@@ -2184,7 +2184,7 @@ macro_rules! validate {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_eval_empty_function_name() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
parser.eval(
|
||||
L!("function '' ; echo fail; exit 42 ; end ; ''"),
|
||||
@@ -2195,7 +2195,7 @@ fn test_eval_empty_function_name() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_expand_argument_list() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = TestParser::new();
|
||||
let comps: Vec<WString> = Parser::expand_argument_list(
|
||||
L!("alpha 'beta gamma' delta"),
|
||||
@@ -2237,7 +2237,7 @@ fn test_1_cancellation(parser: &Parser, src: &wstr) {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_cancellation() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let parser = Parser::new(EnvStack::new(), CancelBehavior::Clear);
|
||||
let _pop = fake_scoped_reader(&parser);
|
||||
|
||||
|
||||
@@ -989,6 +989,7 @@ fn read_ni(parser: &Parser, fd: RawFd, io: &IoChain) -> Result<(), ErrorCode> {
|
||||
|
||||
/// Initialize the reader.
|
||||
pub fn reader_init(will_restore_foreground_pgroup: bool) {
|
||||
assert_is_main_thread();
|
||||
let terminal_mode_on_startup = match tcgetattr(unsafe { BorrowedFd::borrow_raw(STDIN_FILENO) })
|
||||
{
|
||||
Ok(modes) => {
|
||||
@@ -1000,9 +1001,7 @@ pub fn reader_init(will_restore_foreground_pgroup: bool) {
|
||||
Err(_) => zeroed_termios(),
|
||||
};
|
||||
|
||||
if !cfg!(test) {
|
||||
assert!(AT_EXIT.get().is_none());
|
||||
}
|
||||
assert!(AT_EXIT.get().is_none());
|
||||
AT_EXIT.get_or_init(|| Box::new(move || reader_deinit(will_restore_foreground_pgroup)));
|
||||
|
||||
// Set the mode used for program execution, initialized to the current mode.
|
||||
|
||||
@@ -2086,7 +2086,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_escape_code_length() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let mut lc = LayoutCache::new();
|
||||
assert_eq!(lc.escape_code_length(L!("")), 0);
|
||||
assert_eq!(lc.escape_code_length(L!("abcd")), 0);
|
||||
@@ -2121,7 +2121,7 @@ fn test_escape_code_length() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_layout_cache() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let mut seqs = LayoutCache::new();
|
||||
|
||||
// Verify escape code cache.
|
||||
@@ -2193,7 +2193,7 @@ fn test_layout_cache() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_prompt_truncation() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let mut cache = LayoutCache::new();
|
||||
let mut trunc = WString::new();
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_termsize() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let env_global = EnvSetMode::new(EnvMode::GLOBAL, false);
|
||||
let parser = TestParser::new();
|
||||
let vars = parser.vars();
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
use crate::locale::set_libc_locales;
|
||||
use crate::parser::{CancelBehavior, Parser};
|
||||
use crate::prelude::*;
|
||||
use crate::reader::{reader_deinit, reader_init};
|
||||
use crate::signal::signal_reset_handlers;
|
||||
use crate::topic_monitor::topic_monitor_init;
|
||||
use crate::wutil::wgetcwd;
|
||||
use crate::{env::EnvStack, proc::proc_init};
|
||||
use fish_common::{ScopeGuard, ScopeGuarding};
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::env::set_current_dir;
|
||||
@@ -18,7 +16,7 @@
|
||||
|
||||
pub use serial_test::serial;
|
||||
|
||||
pub fn test_init() -> impl ScopeGuarding<Target = ()> {
|
||||
pub fn test_init() {
|
||||
static DONE: OnceLock<()> = OnceLock::new();
|
||||
DONE.get_or_init(|| {
|
||||
// If we are building with `cargo build` and have build w/ `cmake`, this might not
|
||||
@@ -42,10 +40,6 @@ pub fn test_init() -> impl ScopeGuarding<Target = ()> {
|
||||
// Set PWD from getcwd - fixes #5599
|
||||
EnvStack::globals().set_pwd_from_getcwd();
|
||||
});
|
||||
reader_init(false);
|
||||
ScopeGuard::new((), |()| {
|
||||
reader_deinit(false);
|
||||
})
|
||||
}
|
||||
|
||||
/// An environment built around an std::map.
|
||||
|
||||
@@ -618,7 +618,7 @@ mod tests {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_topic_monitor() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let monitor = TopicMonitor::default();
|
||||
let gens = GenerationsList::new();
|
||||
let t = Topic::SigChld;
|
||||
@@ -644,7 +644,7 @@ fn test_topic_monitor() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_topic_monitor_torture() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let monitor = Arc::new(TopicMonitor::default());
|
||||
const THREAD_COUNT: usize = 64;
|
||||
let t1 = Topic::SigChld;
|
||||
|
||||
@@ -641,7 +641,7 @@ fn test_wdirname_wbasename() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_wwrite_to_fd() {
|
||||
let _cleanup = test_init();
|
||||
test_init();
|
||||
let temp_file = fish_tempfile::new_file().unwrap();
|
||||
let mut rng = rand::rng();
|
||||
let sizes = [1, 2, 3, 5, 13, 23, 64, 128, 255, 4096, 4096 * 2];
|
||||
|
||||
Reference in New Issue
Block a user