From 2c02901d4e3f6377b1bac45b6cc2ff64b00cbc90 Mon Sep 17 00:00:00 2001 From: Loic Coenen Date: Fri, 1 May 2026 19:31:45 +0000 Subject: [PATCH] test: update yank tests to verify clips are stopped after yank Co-authored-by: aider (deepseek/deepseek-coder) --- test_tui.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/test_tui.c b/test_tui.c index a688d8f..c3e3d56 100644 --- a/test_tui.c +++ b/test_tui.c @@ -808,12 +808,11 @@ void test_yank_single_clip(void) { engine->clips[clip_idx].state = CLIP_LOOPING; engine->clips[clip_idx].buffer_size = 100; - // Simulate yanking the clip - int yank_buffer[1] = {clip_idx}; - int yank_count = 1; + // Simulate yanking the clip - should stop it + engine_trigger_clip(engine, clip_idx); // Toggle to stop + engine_process_commands(engine); - assert(yank_buffer[0] == 15); - assert(yank_count == 1); + assert(engine->clips[clip_idx].state == CLIP_STOPPED); destroy_test_engine(engine); printf("PASSED\n"); @@ -831,18 +830,15 @@ void test_yank_visual_selection(void) { engine->clips[clips[i]].buffer_size = 100; } - // Simulate yanking the selection - int yank_buffer[4]; - int yank_count = 4; + // Simulate yanking the selection - should stop all clips for (int i = 0; i < 4; i++) { - yank_buffer[i] = clips[i]; + engine_trigger_clip(engine, clips[i]); // Toggle to stop } + engine_process_commands(engine); - assert(yank_count == 4); - assert(yank_buffer[0] == 18); - assert(yank_buffer[1] == 19); - assert(yank_buffer[2] == 26); - assert(yank_buffer[3] == 27); + for (int i = 0; i < 4; i++) { + assert(engine->clips[clips[i]].state == CLIP_STOPPED); + } destroy_test_engine(engine); printf("PASSED\n"); @@ -1140,16 +1136,16 @@ void test_visual_yank_then_escape(void) { engine->clips[clips[i]].buffer_size = 100; } - // Simulate yanking the selection - int yank_buffer[4]; - int yank_count = 4; + // Simulate yanking the selection - should stop all clips for (int i = 0; i < 4; i++) { - yank_buffer[i] = clips[i]; + engine_trigger_clip(engine, clips[i]); // Toggle to stop } + engine_process_commands(engine); - assert(yank_count == 4); - assert(yank_buffer[0] == 18); - assert(yank_buffer[3] == 27); + // Verify clips are stopped + for (int i = 0; i < 4; i++) { + assert(engine->clips[clips[i]].state == CLIP_STOPPED); + } // Simulate returning to normal mode UIMode current_mode = MODE_NORMAL;