✅ test(lsp_server): update test scripts and tsf cases
This commit is contained in:
@@ -708,6 +708,14 @@ else
|
||||
echo " ❌ if语句解析失败"
|
||||
fi
|
||||
|
||||
echo "12.1.1 test if without semicolon before else"
|
||||
echo 'function test(); begin if a > b then x := a else x := b; end;' | tree-sitter parse > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo " ✅ if (no semicolon) parsed"
|
||||
else
|
||||
echo " ❌ if (no semicolon) parse failed"
|
||||
fi
|
||||
|
||||
echo "12.2 测试复杂if语句"
|
||||
cat > temp_if_test.tsf << 'EOF'
|
||||
function test();
|
||||
@@ -763,6 +771,14 @@ else
|
||||
echo " ❌ for循环解析失败"
|
||||
fi
|
||||
|
||||
echo "12.4.1 test for body without semicolon"
|
||||
echo 'function test(); begin for i:=0 to 10 do x += 1 end;' | tree-sitter parse > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo " ✅ for (no semicolon) parsed"
|
||||
else
|
||||
echo " ❌ for (no semicolon) parse failed"
|
||||
fi
|
||||
|
||||
echo "12.5 测试for...to循环"
|
||||
echo 'function test(); begin for i:=0 to 10 do x := i; end;' | tree-sitter parse > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
@@ -779,6 +795,14 @@ else
|
||||
echo " ❌ while循环解析失败"
|
||||
fi
|
||||
|
||||
echo "12.6.1 test while body without semicolon"
|
||||
echo 'function test(); begin while x > 0 do x := x - 1 end;' | tree-sitter parse > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo " ✅ while (no semicolon) parsed"
|
||||
else
|
||||
echo " ❌ while (no semicolon) parse failed"
|
||||
fi
|
||||
|
||||
echo "12.7 测试repeat循环"
|
||||
echo 'function test(); begin repeat x := x + 1; until x > 10; end;' | tree-sitter parse > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user