#!/bin/bash
# Run cargo-mutants with the slow / timed-out tests excluded.
#
# The list below was extracted from a CI job log by collecting every test
# that ran for >= 5 seconds, plus the two theme_editor tests that hit the
# 180s nextest timeout. Excluding them keeps each per-mutant test cycle
# fast without changing which mutants are exercised.
#
# Any extra arguments to this script are forwarded to `cargo mutants`,
# e.g. `scripts/mutants-fast.sh --in-place -j 4 --file src/foo.rs`.

set -euo pipefail

SLOW='test_named_color_swatch_uses_native_ansi_color|test_palette_swatch_click_targets_correct_column|test_line_iterator_large_single_line_chunked_correctly|prop_shadow_model_long_sequence|prop_shadow_model_2_ops|prop_multi_cursor_2_cursors|prop_multi_cursor_3_cursors|prop_buffer_length_matches_shadow|prop_cursor_position_valid|prop_piece_tree_matches_shadow|prop_textbuffer_shadow_model|test_buffer_shadow_random_ops_through_remote|test_compose_mode_table_cursor_right_through_emphasis_wrap|test_enter_at_bottom_scrolls_immediately|prop_long_sequence_marker_roundtrip|test_all_operations_on_multibyte_fixture|test_mouse_select_never_creates_invalid_utf8|test_session_cursor_visible_in_splits_after_restore|prop_two_op_marker_roundtrip|test_wrapped_line_scrolling_down_past_viewport|prop_single_op_marker_roundtrip|test_mouse_wheel_scrolls_wrapped_content|test_no_panic_on_rapid_typing_in_large_rust_file|prop_multiple_roundtrips|test_compose_mode_cursor_column_zero_sticky_through_wrapped_list|test_scrollbar_drag_with_wrapped_lines|test_page_down_scrolls_visual_rows_with_wrapped_line|test_command_palette_down_no_wraparound|test_select_word_accented_characters|test_session_persistence_across_project_switches|test_hover_popup_scroll_to_bottom|test_compose_mode_cursor_monotonic_through_tables|prop_ls_contains_created_files|prop_save_overwrite_roundtrip|test_buffer_large_file_edits_at_beginning_middle_and_end_through_remote|test_ctrl_left_jumps_to_word_beginning|test_ctrl_right_jumps_to_word_end|prop_roundtrip_preserves_content|test_view_transform_scroll_with_many_virtual_lines|test_scroll_margin_identical_with_and_without_fold|test_large_jumps_within_buffer_tracked|test_large_file_cursor_down_movement|test_large_file_edits_beginning_middle_end|test_switch_project_restart_flow_with_sessions|test_flow_c_session_scoped_recovery_isolation|prop_overwrite_replaces_content|test_compose_mode_width_survives_session_restore|test_session_restores_scroll_in_splits|test_multiple_reconnections|test_merge_conflict_crlf_line_endings|test_file_open_shortcuts_load_async_issue_903|test_scrollbar_in_multiple_splits|prop_all_encodings_edit_roundtrip|prop_delete_removes_file|prop_exists_agrees_with_stat|prop_write_read_roundtrip|test_cursor_disappears_beyond_long_line_end|test_scrollbar_horizontal_split|test_selected_item_stays_visible_when_scrolling|prop_size_matches_written_length|prop_realpath_is_canonical|test_diff_word_movement_comprehensive|test_multi_language_highlighting|test_session_cursor_visible_after_restore|test_scrollbar_shows_scrollable_content_with_wrapped_lines|test_search_large_file_tick_performance|test_large_file_editing_with_slow_fs|test_session_restores_scroll_position|prop_stat_consistent'

FILTER="not test(/(?:^|::)(${SLOW})\$/)"
exec cargo mutants --in-place --test-tool=nextest "$@" -- -E "${FILTER}"
