- Add comprehensive formatter test suite with 38 tests - Test multiline assignments, FB calls, control structures - Test IF, FOR, WHILE, CASE, REPEAT statements - Test regions, structs, var sections - Update AGENTS.md with formatter test command
49 lines
1.1 KiB
Lua
49 lines
1.1 KiB
Lua
#!/usr/bin/env lua
|
|
|
|
package.path = package.path .. ";lua/?.lua;src/?.lua"
|
|
|
|
local test = dofile("test/test_harness.lua")
|
|
|
|
print("========================================")
|
|
print(" SCL LSP - Test Suite")
|
|
print("========================================")
|
|
print(string.format("Reference Project: %s", test.REF_PROJECT))
|
|
|
|
local function run_all_tests()
|
|
print("\n" .. string.rep("=", 40))
|
|
print("Running All Tests")
|
|
print(string.rep("=", 40))
|
|
|
|
test.reset()
|
|
|
|
local function run_test_file(name)
|
|
print(string.format("\n>>> Running %s", name))
|
|
local ok, err = pcall(dofile, "test/" .. name)
|
|
if not ok then
|
|
print("ERROR: " .. tostring(err))
|
|
test.fail_count = test.fail_count + 1
|
|
end
|
|
end
|
|
|
|
run_test_file("test_udt.lua")
|
|
run_test_file("test_db.lua")
|
|
run_test_file("test_fb.lua")
|
|
run_test_file("test_formatter.lua")
|
|
run_test_file("test_plc_json.lua")
|
|
run_test_file("test_integration.lua")
|
|
|
|
test.report()
|
|
|
|
return test.fail_count == 0
|
|
end
|
|
|
|
local success = run_all_tests()
|
|
|
|
if success then
|
|
print("\n=== ALL TESTS PASSED ===")
|
|
os.exit(0)
|
|
else
|
|
print("\n=== SOME TESTS FAILED ===")
|
|
os.exit(1)
|
|
end
|