11import * as assert from 'assert' ;
22import * as vscode from 'vscode' ;
3- import { applyGlobalReplace , normalizeInput } from '../cvbManager' ;
3+ import { applyGlobalReplace , normalizeInput , normalizeData } from '../cvbManager' ;
44import * as fuzzyMatch from '../fuzzyMatch' ;
55
66// 定义 GlobalReplaceOperation 接口
@@ -29,13 +29,6 @@ class GlobalReplaceOperation extends TcvbOperation {
2929 }
3030}
3131
32- // 函数:规范化 GlobalReplaceOperation 实例的成员
33- function normalizeData ( operation : GlobalReplaceOperation ) : GlobalReplaceOperation {
34- operation . m_strOldContent = normalizeInput ( operation . m_strOldContent ) ;
35- operation . m_strNewContent = normalizeInput ( operation . m_strNewContent ) ;
36- return operation ;
37- }
38-
3932suite ( 'Extension Test Suite' , ( ) => {
4033 vscode . window . showInformationMessage ( 'Start all tests.' ) ;
4134
@@ -236,7 +229,7 @@ function anotherCompute(a, b) {
236229 m_strType : "global-replace" ,
237230 m_strFilePath : 'test.js' ,
238231 m_strOldContent : `
239- return a + b ;
232+ return aaa + bbb ;
240233 ` ,
241234 m_strNewContent : `
242235return a - b;
@@ -513,12 +506,12 @@ function logWarning(warning) {
513506 const result = fuzzyMatch . applyReplacements ( originalContent , matches , newContent ) ;
514507
515508 assert . strictEqual ( result . trim ( ) , expectedContent , 'Replacement should match expected output' ) ;
516- assert . ok ( ! result . includes ( 'g );' ) , 'Result should not contain extra characters like "g);" ' ) ;
509+ assert . ok ( ! result . includes ( 'warn );' ) , 'Result should not contain incorrectly replaced warn); ' ) ;
517510 } ) ;
518511
519512 test ( 'applyFuzzyGlobalReplace should perform the full replacement correctly' , ( ) => {
520513 const result = fuzzyMatch . applyFuzzyGlobalReplace ( originalContent , oldContent , newContent ) ;
521514 assert . strictEqual ( result . trim ( ) , expectedContent , 'Full fuzzy replace should produce the expected output' ) ;
522- assert . ok ( ! result . includes ( 'g );' ) , 'Result should not contain extra characters like "g);" ' ) ;
515+ assert . ok ( ! result . includes ( 'warn );' ) , 'Result should not contain incorrectly replaced warn); ' ) ;
523516 } ) ;
524517} ) ;
0 commit comments