Files
tia-lsp/test/run_tests.lua
T
lazar d5b8d7b153 feat: add testing framework with reference project integration
- Add test/ directory with test harness and test files
- Add UDT, DB, FB parser tests
- Add PLC JSON and integration tests
- Test against reference project (239 UDTs, 12 DBs, 37 SCL, 13 XML)
- Fix attribute parsing to handle underscores (S7_SetPoint)
- Add ORGANIZATION_BLOCK support to FB parser
2026-02-23 13:29:38 +01:00

48 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_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