@@ -52,6 +52,45 @@ Hotfix(s): 7 Hotfix(s) Installed.
52
52
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.
53
53
''' ;
54
54
55
+ const String validWindows11CnStdOut = r'''
56
+ 主机名: XXXXXXXXXXXX
57
+ OS 名称: Microsoft Windows 11 专业版
58
+ OS 版本: 10.0.22621 暂缺 Build 22621
59
+ OS 制造商: Microsoft Corporation
60
+ OS 配置: 独立工作站
61
+ OS 构建类型: Multiprocessor Free
62
+ 注册的所有人: 暂缺
63
+ 注册的组织: 暂缺
64
+ 产品 ID: XXXXXXXXXXXX
65
+ 初始安装日期: 2022/11/9, 13:33:50
66
+ 系统启动时间: 2022/11/30, 13:36:47
67
+ 系统制造商: ASUS
68
+ 系统型号: System Product Name
69
+ 系统类型: x64-based PC
70
+ 处理器: 安装了 1 个处理器。
71
+ [01]: Intel64 Family 6 Model 151 Stepping 2 GenuineIntel ~3600 Mhz
72
+ BIOS 版本: American Megatrends Inc. 2103, 2022/9/30
73
+ Windows 目录: C:\WINDOWS
74
+ 系统目录: C:\WINDOWS\system32
75
+ 启动设备: \Device\HarddiskVolume1
76
+ 系统区域设置: zh-cn;中文(中国)
77
+ 输入法区域设置: zh-cn;中文(中国)
78
+ 时区: (UTC+08:00) 北京,重庆,香港特别行政区,乌鲁木齐
79
+ 物理内存总量: 65,277 MB
80
+ 可用的物理内存: 55,333 MB
81
+ 虚拟内存: 最大值: 75,005 MB
82
+ 虚拟内存: 可用: 61,781 MB
83
+ 虚拟内存: 使用中: 13,224 MB
84
+ 页面文件位置: C:\pagefile.sys
85
+ 域: WORKGROUP
86
+ 登录服务器: \\XXXXXXXXXXXX
87
+ 修补程序: 安装了 3 个修补程序。
88
+ [01]: KB5020622
89
+ [02]: KB5019980
90
+ [03]: KB5019304
91
+ Hyper-V 要求: 已检测到虚拟机监控程序。将不显示 Hyper-V 所需的功能。
92
+ ''' ;
93
+
55
94
/// Example output from `systeminfo` from version != 10
56
95
const String invalidWindowsStdOut = r'''
57
96
Host Name: XXXXXXXXXXXX
@@ -151,6 +190,36 @@ void main() {
151
190
reason: 'The ValidationResult statusInfo messages should be the same' );
152
191
});
153
192
193
+ testWithoutContext (
194
+ 'Successfully running windows version check on windows 11 CN' ,
195
+ () async {
196
+ final WindowsVersionValidator windowsVersionValidator =
197
+ WindowsVersionValidator (
198
+ processManager: FakeProcessManager .list (
199
+ < FakeCommand > [
200
+ const FakeCommand (
201
+ command: < String > ['systeminfo' ],
202
+ stdout: validWindows11CnStdOut,
203
+ ),
204
+ ],
205
+ ),
206
+ );
207
+
208
+ final ValidationResult result = await windowsVersionValidator.validate ();
209
+
210
+ expect (
211
+ result.type,
212
+ validWindows10ValidationResult.type,
213
+ reason: 'The ValidationResult type should be the same (installed)' ,
214
+ );
215
+ expect (
216
+ result.statusInfo,
217
+ validWindows10ValidationResult.statusInfo,
218
+ reason: 'The ValidationResult statusInfo messages should be the same' ,
219
+ );
220
+ },
221
+ );
222
+
154
223
testWithoutContext ('Failing to invoke the `systeminfo` command' , () async {
155
224
final WindowsVersionValidator windowsVersionValidator =
156
225
WindowsVersionValidator (
@@ -217,19 +286,24 @@ void main() {
217
286
const String testStr = r'''
218
287
OS Version: 10.0.19044 N/A Build 19044
219
288
OSz Version: 10.0.19044 N/A Build 19044
220
- OS 6Version: 10.0.19044 N/A Build 19044
221
289
OxS Version: 10.0.19044 N/A Build 19044
222
290
OS Version: 10.19044 N/A Build 19044
223
291
OS Version: 10.x.19044 N/A Build 19044
224
292
OS Version: 10.0.19044 N/A Build 19044
225
293
OS Version: .0.19044 N/A Build 19044
294
+ OS 版本: 10.0.22621 暂缺 Build 22621
226
295
''' ;
227
296
228
- final RegExp regex =
229
- RegExp (kWindowsOSVersionSemVerPattern, multiLine: true );
297
+ final RegExp regex = RegExp (
298
+ kWindowsOSVersionSemVerPattern,
299
+ multiLine: true ,
300
+ );
230
301
final Iterable <RegExpMatch > matches = regex.allMatches (testStr);
231
302
232
- expect (matches.length, 2 ,
233
- reason: 'There should be only two matches for the pattern provided' );
303
+ expect (
304
+ matches.length,
305
+ 3 ,
306
+ reason: 'There should be only two matches for the pattern provided' ,
307
+ );
234
308
});
235
309
}
0 commit comments