Add an eval for and fix unsafe cloning behavior. (#24457)

This commit is contained in:
Christian Gunderman
2026-04-07 03:17:44 +00:00
committed by GitHub
parent 0a8da988ed
commit d2b775f9a7
8 changed files with 150 additions and 22 deletions
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { renderWithProviders } from '../../test-utils/render.js';
import { renderWithProviders, cleanup } from '../../test-utils/render.js';
import { createMockSettings } from '../../test-utils/settings.js';
import { makeFakeConfig } from '@google/gemini-cli-core';
import { waitFor } from '../../test-utils/async.js';
@@ -23,6 +23,7 @@ import {
import {
ApprovalMode,
debugLogger,
coreEvents,
type Config,
} from '@google/gemini-cli-core';
import * as path from 'node:path';
@@ -93,6 +94,8 @@ vi.mock('ink', async (importOriginal) => {
afterEach(() => {
vi.restoreAllMocks();
vi.useRealTimers();
cleanup();
});
const mockSlashCommands: SlashCommand[] = [
@@ -236,6 +239,7 @@ describe('InputPrompt', () => {
beforeEach(() => {
vi.resetAllMocks();
coreEvents.removeAllListeners();
vi.spyOn(
terminalCapabilityManager,
'isKittyProtocolEnabled',
@@ -432,7 +432,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
slashCommands,
);
if (commandToExecute?.isSafeConcurrent) {
inputHistory.handleSubmit(trimmedMessage);
handleSubmitAndClear(trimmedMessage);
return;
}
}
@@ -450,6 +450,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
streamingState,
setQueueErrorMessage,
slashCommands,
handleSubmitAndClear,
],
);
@@ -168,6 +168,13 @@ exports[`InputPrompt > mouse interaction > should toggle paste expansion on doub
"
`;
exports[`InputPrompt > mouse interaction > should toggle paste expansion on double-click 4`] = `
"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
> [Pasted Text: 10 lines]
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
"
`;
exports[`InputPrompt > multiline rendering > should correctly render multiline input including blank lines 1`] = `
"────────────────────────────────────────────────────────────────────────────────────────────────────
│ > hello │