Skip to content

Commit d8e607f

Browse files
committed
chore; 暂不处理行尾注释
1 parent 2711dc9 commit d8e607f

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

psutils/modules/string.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ function Convert-JsoncToJson {
110110

111111
# 移除行尾注释 (/*...*/)
112112
# TODO
113-
$jsonContent = $jsonContent -replace '(?m)/\*.*?\*/\s*$', ''
114-
Write-Debug "移除行尾注释后:$jsonContent"
113+
# $jsonContent = $jsonContent -replace '(?m)/\*.*?\*/\s*$', ''
114+
# Write-Debug "移除行尾注释后:$jsonContent"
115115

116116
# 移除多行注释 (/*...*/)
117117
$jsonContent = $jsonContent -replace '(?s)/\*.*?\*/', ''

psutils/tests/string.Tests.ps1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ Describe "Convert-JsoncToJson 函数测试" {
4444
$testJsonc | Out-File -FilePath $testJsoncPath -Encoding utf8
4545

4646
# 新增带$schema的测试用例
47+
# $testJsoncWithSchema = @"
48+
# {
49+
# "`$schema": "http://json-schema.org/draft-07/schema#",
50+
# // 带schema的配置
51+
# "name": "schema_test",
52+
# /**
53+
# * 测试多行需求**/
54+
# "config": {
55+
# "url": "http://example.com", // URL注释
56+
# "path": "some//path" // 包含//的字符串
57+
# }
58+
# }
59+
# "@
4760
$testJsoncWithSchema = @"
4861
{
4962
"`$schema": "http://json-schema.org/draft-07/schema#",
@@ -52,8 +65,8 @@ Describe "Convert-JsoncToJson 函数测试" {
5265
/**
5366
* 测试多行需求**/
5467
"config": {
55-
"url": "http://example.com", // URL注释
56-
"path": "some//path" // 包含//的字符串
68+
"url": "http://example.com",
69+
"path": "some//path"
5770
}
5871
}
5972
"@

0 commit comments

Comments
 (0)