@@ -280,6 +280,65 @@ npm install
280280 }
281281 } )
282282 } )
283+
284+ it ( "should match commands with Chinese characters" , ( ) => {
285+ const commandRegex =
286+ / (?: ^ | \s ) \/ ( [ a - z A - Z 0 - 9 _ \. \- \u4e00 - \u9fff \u3040 - \u309f \u30a0 - \u30ff \uac00 - \ud7af ] + ) (? = \s | $ ) / g
287+
288+ const chinesePatterns = [
289+ "/中文命令" ,
290+ "/测试文件" ,
291+ "/配置文件" ,
292+ "/部署脚本" ,
293+ "Use /中文 command" ,
294+ "Run /测试 now" ,
295+ ]
296+
297+ chinesePatterns . forEach ( ( pattern ) => {
298+ const matches = pattern . match ( commandRegex )
299+ expect ( matches ) . toBeTruthy ( )
300+ expect ( matches ?. length ) . toBeGreaterThan ( 0 )
301+ } )
302+ } )
303+
304+ it ( "should match commands with Japanese characters" , ( ) => {
305+ const commandRegex =
306+ / (?: ^ | \s ) \/ ( [ a - z A - Z 0 - 9 _ \. \- \u4e00 - \u9fff \u3040 - \u309f \u30a0 - \u30ff \uac00 - \ud7af ] + ) (? = \s | $ ) / g
307+
308+ const japanesePatterns = [ "/テスト" , "/ファイル" , "/デプロイ" , "Use /日本語 command" , "Run /テスト now" ]
309+
310+ japanesePatterns . forEach ( ( pattern ) => {
311+ const matches = pattern . match ( commandRegex )
312+ expect ( matches ) . toBeTruthy ( )
313+ expect ( matches ?. length ) . toBeGreaterThan ( 0 )
314+ } )
315+ } )
316+
317+ it ( "should match commands with Korean characters" , ( ) => {
318+ const commandRegex =
319+ / (?: ^ | \s ) \/ ( [ a - z A - Z 0 - 9 _ \. \- \u4e00 - \u9fff \u3040 - \u309f \u30a0 - \u30ff \uac00 - \ud7af ] + ) (? = \s | $ ) / g
320+
321+ const koreanPatterns = [ "/테스트" , "/파일" , "/배포" , "Use /한국어 command" , "Run /테스트 now" ]
322+
323+ koreanPatterns . forEach ( ( pattern ) => {
324+ const matches = pattern . match ( commandRegex )
325+ expect ( matches ) . toBeTruthy ( )
326+ expect ( matches ?. length ) . toBeGreaterThan ( 0 )
327+ } )
328+ } )
329+
330+ it ( "should match commands with mixed characters" , ( ) => {
331+ const commandRegex =
332+ / (?: ^ | \s ) \/ ( [ a - z A - Z 0 - 9 _ \. \- \u4e00 - \u9fff \u3040 - \u309f \u30a0 - \u30ff \uac00 - \ud7af ] + ) (? = \s | $ ) / g
333+
334+ const mixedPatterns = [ "/test中文" , "/deploy部署" , "/file文件123" , "/テストtest" , "/한국어korean" ]
335+
336+ mixedPatterns . forEach ( ( pattern ) => {
337+ const matches = pattern . match ( commandRegex )
338+ expect ( matches ) . toBeTruthy ( )
339+ expect ( matches ?. length ) . toBe ( 1 )
340+ } )
341+ } )
283342 } )
284343
285344 describe ( "command mention text transformation" , ( ) => {
0 commit comments