1.0.0 初始版
This commit is contained in:
59
test_comments_fix.nut
Normal file
59
test_comments_fix.nut
Normal file
@@ -0,0 +1,59 @@
|
||||
// 测试注释中的代码不会被错误检测
|
||||
|
||||
// ========== 正常代码 - 应该检测错误 ==========
|
||||
|
||||
functoin normalError() { // 这个应该被检测为拼写错误
|
||||
loacl x = "test; // 这个也应该被检测
|
||||
if (x = 5) { // 赋值操作符错误
|
||||
retun true; // 拼写错误
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 注释掉的代码 - 不应该检测错误 ==========
|
||||
|
||||
// functoin commentedFunction() { // 这个不应该被检测
|
||||
// loacl badVariable = "unclosed string;
|
||||
// if (array[0 = 10) { // 各种错误,但在注释中
|
||||
// retun false;
|
||||
// }
|
||||
|
||||
/*
|
||||
块注释中的代码也不应该检测错误:
|
||||
functoin anotherBadFunction() {
|
||||
loacl x = "unclosed;
|
||||
if (x = bad) {
|
||||
retun nothing;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ========== 混合情况 ==========
|
||||
|
||||
local validCode = "This is fine"; // 这行正常
|
||||
// functoin commentedBad() { // 这行注释掉的不应该检测
|
||||
|
||||
// 内联注释测试
|
||||
local test = 5; // functoin在注释中不应该报错
|
||||
|
||||
/* 多行注释测试
|
||||
functoin 在这里
|
||||
loacl bad = "test
|
||||
应该都不报错
|
||||
*/
|
||||
|
||||
// ========== 字符串和括号测试 ==========
|
||||
|
||||
// 注释中的未闭合字符串: "this is not closed
|
||||
// 注释中的未闭合括号: function test() { missing close
|
||||
|
||||
local realString = "This should work fine";
|
||||
local realArray = [1, 2, 3];
|
||||
if (realArray.len() > 0) {
|
||||
return "success";
|
||||
}
|
||||
|
||||
// 验证正常代码仍然工作
|
||||
local message = "Hello World";
|
||||
function greeting() {
|
||||
return message;
|
||||
}
|
||||
Reference in New Issue
Block a user