mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Attempt 1
This commit is contained in:
parent
f1649a43cd
commit
b6d724c5b1
37 changed files with 104 additions and 104 deletions
114
.github/workflows/build.yml
vendored
114
.github/workflows/build.yml
vendored
|
@ -3,18 +3,18 @@ name: build
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- "master"
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'papers/**'
|
||||
- 'rfcs/**'
|
||||
- '*.md'
|
||||
- "docs/**"
|
||||
- "papers/**"
|
||||
- "rfcs/**"
|
||||
- "*.md"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'papers/**'
|
||||
- 'rfcs/**'
|
||||
- '*.md'
|
||||
- "docs/**"
|
||||
- "papers/**"
|
||||
- "rfcs/**"
|
||||
- "*.md"
|
||||
|
||||
jobs:
|
||||
unix:
|
||||
|
@ -24,18 +24,18 @@ jobs:
|
|||
name: ${{matrix.os}}
|
||||
runs-on: ${{matrix.os}}-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: make test
|
||||
run: |
|
||||
make -j2 config=sanitize test
|
||||
- name: make test w/flags
|
||||
run: |
|
||||
make -j2 config=sanitize flags=true test
|
||||
- name: make cli
|
||||
run: |
|
||||
make -j2 config=sanitize luau luau-analyze # match config with tests to improve build time
|
||||
./luau tests/conformance/assert.lua
|
||||
./luau-analyze tests/conformance/assert.lua
|
||||
- uses: actions/checkout@v1
|
||||
- name: make test
|
||||
run: |
|
||||
make -j2 config=sanitize test
|
||||
- name: make test w/flags
|
||||
run: |
|
||||
make -j2 config=sanitize flags=true test
|
||||
- name: make cli
|
||||
run: |
|
||||
make -j2 config=sanitize luau luau-analyze # match config with tests to improve build time
|
||||
./luau tests/conformance/assert.luau
|
||||
./luau-analyze tests/conformance/assert.luau
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
|
@ -43,43 +43,43 @@ jobs:
|
|||
matrix:
|
||||
arch: [Win32, x64]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: cmake configure
|
||||
run: cmake . -A ${{matrix.arch}}
|
||||
- name: cmake test
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
cmake --build . --target Luau.UnitTest Luau.Conformance --config Debug
|
||||
Debug/Luau.UnitTest.exe
|
||||
Debug/Luau.Conformance.exe
|
||||
- name: cmake test w/flags
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
Debug/Luau.UnitTest.exe --fflags=true
|
||||
Debug/Luau.Conformance.exe --fflags=true
|
||||
- name: cmake cli
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
cmake --build . --target Luau.Repl.CLI Luau.Analyze.CLI --config Debug # match config with tests to improve build time
|
||||
Debug/luau tests/conformance/assert.lua
|
||||
Debug/luau-analyze tests/conformance/assert.lua
|
||||
- uses: actions/checkout@v1
|
||||
- name: cmake configure
|
||||
run: cmake . -A ${{matrix.arch}}
|
||||
- name: cmake test
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
cmake --build . --target Luau.UnitTest Luau.Conformance --config Debug
|
||||
Debug/Luau.UnitTest.exe
|
||||
Debug/Luau.Conformance.exe
|
||||
- name: cmake test w/flags
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
Debug/Luau.UnitTest.exe --fflags=true
|
||||
Debug/Luau.Conformance.exe --fflags=true
|
||||
- name: cmake cli
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
cmake --build . --target Luau.Repl.CLI Luau.Analyze.CLI --config Debug # match config with tests to improve build time
|
||||
Debug/luau tests/conformance/assert.luau
|
||||
Debug/luau-analyze tests/conformance/assert.luau
|
||||
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install
|
||||
run: |
|
||||
sudo apt install llvm
|
||||
- name: make coverage
|
||||
run: |
|
||||
CXX=clang++-10 make -j2 config=coverage coverage
|
||||
- name: upload coverage
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
path-to-lcov: ./coverage.info
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: coverage
|
||||
path: coverage
|
||||
- uses: actions/checkout@v1
|
||||
- name: install
|
||||
run: |
|
||||
sudo apt install llvm
|
||||
- name: make coverage
|
||||
run: |
|
||||
CXX=clang++-10 make -j2 config=coverage coverage
|
||||
- name: upload coverage
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
path-to-lcov: ./coverage.info
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: coverage
|
||||
path: coverage
|
||||
|
|
|
@ -456,7 +456,7 @@ int main(int argc, char** argv)
|
|||
if (isDirectory(argv[i]))
|
||||
{
|
||||
traverseDirectory(argv[i], [&](const std::string& name) {
|
||||
if (name.length() > 4 && name.rfind(".lua") == name.length() - 4)
|
||||
if (name.length() > 4 && (name.rfind(".lua") == name.length() - 4 || name.rfind(".luau") == name.length() - 5))
|
||||
failed += !compileFile(name.c_str());
|
||||
});
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ int main(int argc, char** argv)
|
|||
if (isDirectory(argv[i]))
|
||||
{
|
||||
traverseDirectory(argv[i], [&](const std::string& name) {
|
||||
if (name.length() > 4 && name.rfind(".lua") == name.length() - 4)
|
||||
if (name.length() > 4 && (name.rfind(".lua") == name.length() - 4 || name.rfind(".luau") == name.length() - 5))
|
||||
failed += !runFile(name.c_str(), L);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -810,7 +810,7 @@ def run(args, argsubcb):
|
|||
for filename in files:
|
||||
filepath = subdir + os.sep + filename
|
||||
|
||||
if filename.endswith(".lua"):
|
||||
if filename.endswith(".luau"):
|
||||
if arguments.run_test == None or re.match(arguments.run_test, filename[:-4]):
|
||||
runTest(subdir, filename, filepath)
|
||||
|
||||
|
|
|
@ -225,119 +225,119 @@ TEST_SUITE_BEGIN("Conformance");
|
|||
|
||||
TEST_CASE("Assert")
|
||||
{
|
||||
runConformance("assert.lua");
|
||||
runConformance("assert.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Basic")
|
||||
{
|
||||
runConformance("basic.lua");
|
||||
runConformance("basic.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Math")
|
||||
{
|
||||
runConformance("math.lua");
|
||||
runConformance("math.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Table")
|
||||
{
|
||||
ScopedFastFlag sff("LuauTableFreeze", true);
|
||||
|
||||
runConformance("nextvar.lua");
|
||||
runConformance("nextvar.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("PatternMatch")
|
||||
{
|
||||
runConformance("pm.lua");
|
||||
runConformance("pm.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Sort")
|
||||
{
|
||||
runConformance("sort.lua");
|
||||
runConformance("sort.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Move")
|
||||
{
|
||||
runConformance("move.lua");
|
||||
runConformance("move.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Clear")
|
||||
{
|
||||
runConformance("clear.lua");
|
||||
runConformance("clear.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Strings")
|
||||
{
|
||||
runConformance("strings.lua");
|
||||
runConformance("strings.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("VarArg")
|
||||
{
|
||||
runConformance("vararg.lua");
|
||||
runConformance("vararg.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Locals")
|
||||
{
|
||||
runConformance("locals.lua");
|
||||
runConformance("locals.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Literals")
|
||||
{
|
||||
runConformance("literals.lua");
|
||||
runConformance("literals.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Errors")
|
||||
{
|
||||
runConformance("errors.lua");
|
||||
runConformance("errors.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Events")
|
||||
{
|
||||
runConformance("events.lua");
|
||||
runConformance("events.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Constructs")
|
||||
{
|
||||
runConformance("constructs.lua");
|
||||
runConformance("constructs.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Closure")
|
||||
{
|
||||
runConformance("closure.lua");
|
||||
runConformance("closure.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Calls")
|
||||
{
|
||||
runConformance("calls.lua");
|
||||
runConformance("calls.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Attrib")
|
||||
{
|
||||
runConformance("attrib.lua");
|
||||
runConformance("attrib.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("GC")
|
||||
{
|
||||
runConformance("gc.lua");
|
||||
runConformance("gc.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Bitwise")
|
||||
{
|
||||
runConformance("bitwise.lua");
|
||||
runConformance("bitwise.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("UTF8")
|
||||
{
|
||||
runConformance("utf8.lua");
|
||||
runConformance("utf8.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Coroutine")
|
||||
{
|
||||
runConformance("coroutine.lua");
|
||||
runConformance("coroutine.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("PCall")
|
||||
{
|
||||
runConformance("pcall.lua", [](lua_State* L) {
|
||||
runConformance("pcall.luau", [](lua_State* L) {
|
||||
lua_pushcfunction(L, [](lua_State* L) -> int {
|
||||
#if LUA_USE_LONGJMP
|
||||
luaL_error(L, "oops");
|
||||
|
@ -359,12 +359,12 @@ TEST_CASE("PCall")
|
|||
|
||||
TEST_CASE("Pack")
|
||||
{
|
||||
runConformance("tpack.lua");
|
||||
runConformance("tpack.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Vector")
|
||||
{
|
||||
runConformance("vector.lua", [](lua_State* L) {
|
||||
runConformance("vector.luau", [](lua_State* L) {
|
||||
lua_pushcfunction(L, lua_vector);
|
||||
lua_setglobal(L, "vector");
|
||||
|
||||
|
@ -448,7 +448,7 @@ static void populateRTTI(lua_State* L, Luau::TypeId type)
|
|||
|
||||
TEST_CASE("Types")
|
||||
{
|
||||
runConformance("types.lua", [](lua_State* L) {
|
||||
runConformance("types.luau", [](lua_State* L) {
|
||||
Luau::NullModuleResolver moduleResolver;
|
||||
Luau::InternalErrorReporter iceHandler;
|
||||
Luau::TypeChecker env(&moduleResolver, &iceHandler);
|
||||
|
@ -470,12 +470,12 @@ TEST_CASE("Types")
|
|||
|
||||
TEST_CASE("DateTime")
|
||||
{
|
||||
runConformance("datetime.lua");
|
||||
runConformance("datetime.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Debug")
|
||||
{
|
||||
runConformance("debug.lua");
|
||||
runConformance("debug.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("Debugger")
|
||||
|
@ -487,7 +487,7 @@ TEST_CASE("Debugger")
|
|||
interruptedthread = nullptr;
|
||||
|
||||
runConformance(
|
||||
"debugger.lua",
|
||||
"debugger.luau",
|
||||
[](lua_State* L) {
|
||||
lua_Callbacks* cb = lua_callbacks(L);
|
||||
|
||||
|
@ -757,7 +757,7 @@ TEST_CASE("ExceptionObject")
|
|||
}
|
||||
};
|
||||
|
||||
StateRef globalState = runConformance("exceptions.lua", nullptr, nullptr, lua_newstate(reallocFunc, nullptr));
|
||||
StateRef globalState = runConformance("exceptions.luau", nullptr, nullptr, lua_newstate(reallocFunc, nullptr));
|
||||
lua_State* L = globalState.get();
|
||||
|
||||
{
|
||||
|
@ -798,14 +798,14 @@ TEST_CASE("IfElseExpression")
|
|||
{
|
||||
ScopedFastFlag sff{"LuauIfElseExpressionBaseSupport", true};
|
||||
|
||||
runConformance("ifelseexpr.lua");
|
||||
runConformance("ifelseexpr.luau");
|
||||
}
|
||||
|
||||
TEST_CASE("TagMethodError")
|
||||
{
|
||||
ScopedFastFlag sff{"LuauCcallRestoreFix", true};
|
||||
|
||||
runConformance("tmerror.lua", [](lua_State* L) {
|
||||
runConformance("tmerror.luau", [](lua_State* L) {
|
||||
auto* cb = lua_callbacks(L);
|
||||
|
||||
cb->debugprotectederror = [](lua_State* L) {
|
||||
|
|
|
@ -36,7 +36,7 @@ assert(foo(1, 2, 3) == 2)
|
|||
assert(concat(pcall(function () end)) == "true")
|
||||
assert(concat(pcall(function () return nil end)) == "true,nil")
|
||||
assert(concat(pcall(function () return 1,2,3 end)) == "true,1,2,3")
|
||||
assert(concat(pcall(function () error("oops") end)) == "false,basic.lua:39: oops")
|
||||
assert(concat(pcall(function () error("oops") end)) == "false,basic.luau:39: oops")
|
||||
|
||||
-- assignments
|
||||
assert((function() local a = 1 a = 2 return a end)() == 2)
|
|
@ -284,7 +284,7 @@ function foo ()
|
|||
error("foo")
|
||||
end
|
||||
|
||||
local fooerr = "closure.lua:284: foo"
|
||||
local fooerr = "closure.luau:284: foo"
|
||||
|
||||
function goo() foo() end
|
||||
x = coroutine.wrap(goo)
|
|
@ -35,7 +35,7 @@ end
|
|||
local co2 = coroutine.create(halp)
|
||||
coroutine.resume(co2, 0 / 0, 42)
|
||||
|
||||
assert(debug.traceback(co2) == "debug.lua:31 function halp\n")
|
||||
assert(debug.traceback(co2) == "debug.luau:31 function halp\n")
|
||||
assert(debug.info(co2, 0, "l") == 31)
|
||||
|
||||
-- info errors
|
||||
|
@ -83,7 +83,7 @@ end
|
|||
assert(#(quux(1, "nlsf")) == 4)
|
||||
assert(quux(1, "nlsf")[1] == "quux")
|
||||
assert(quux(1, "nlsf")[2] > 64)
|
||||
assert(quux(1, "nlsf")[3] == "debug.lua")
|
||||
assert(quux(1, "nlsf")[3] == "debug.luau")
|
||||
assert(quux(1, "nlsf")[4] == quux)
|
||||
|
||||
-- info arity
|
|
@ -77,9 +77,9 @@ checkresults({ "yield", "return", true, 1, 2, 3}, colog(function() return pcall(
|
|||
checkresults({ "yield", 1, "yield", 2, "return", true, true, 3}, colog(function() return pcall(function() coroutine.yield(1) return pcall(function() coroutine.yield(2) return 3 end) end) end))
|
||||
|
||||
-- error after yield tests
|
||||
checkresults({ "yield", "return", false, "pcall.lua:80: foo" }, colog(function() return pcall(function() coroutine.yield() error("foo") end) end))
|
||||
checkresults({ "yield", "yield", "return", true, false, "pcall.lua:81: foo" }, colog(function() return pcall(function() coroutine.yield() return pcall(function() coroutine.yield() error("foo") end) end) end))
|
||||
checkresults({ "yield", "yield", "return", false, "pcall.lua:82: bar" }, colog(function() return pcall(function() coroutine.yield() pcall(function() coroutine.yield() error("foo") end) error("bar") end) end))
|
||||
checkresults({ "yield", "return", false, "pcall.luau:80: foo" }, colog(function() return pcall(function() coroutine.yield() error("foo") end) end))
|
||||
checkresults({ "yield", "yield", "return", true, false, "pcall.luau:81: foo" }, colog(function() return pcall(function() coroutine.yield() return pcall(function() coroutine.yield() error("foo") end) end) end))
|
||||
checkresults({ "yield", "yield", "return", false, "pcall.luau:82: bar" }, colog(function() return pcall(function() coroutine.yield() pcall(function() coroutine.yield() error("foo") end) error("bar") end) end))
|
||||
|
||||
-- returning lots of results (past MINSTACK limits)
|
||||
local res = {pcall(function() return table.unpack(table.create(100, 'a')) end)}
|
||||
|
@ -100,15 +100,15 @@ checkresults({ true, 2 }, xpcall(function(...) return select('#', ...) end, erro
|
|||
checkresults({ "yield", "return", true, 42 }, colog(function() return xpcall(function() coroutine.yield() return 42 end, error) end))
|
||||
|
||||
-- xpcall immediate error handling
|
||||
checkresults({ false, "pcall.lua:103: foo" }, xpcall(function() error("foo") end, function(err) return err end))
|
||||
checkresults({ false, "pcall.luau:103: foo" }, xpcall(function() error("foo") end, function(err) return err end))
|
||||
checkresults({ false, "bar" }, xpcall(function() error("foo") end, function(err) return "bar" end))
|
||||
checkresults({ false, 1 }, xpcall(function() error("foo") end, function(err) return 1, 2 end))
|
||||
checkresults({ false, "pcall.lua:106: foo\npcall.lua:106\npcall.lua:106\n" }, xpcall(function() error("foo") end, debug.traceback))
|
||||
checkresults({ false, "pcall.luau:106: foo\npcall.luau:106\npcall.luau:106\n" }, xpcall(function() error("foo") end, debug.traceback))
|
||||
checkresults({ false, "error in error handling" }, xpcall(function() error("foo") end, function(err) error("bar") end))
|
||||
|
||||
-- xpcall error handling after yields
|
||||
checkresults({ "yield", "return", false, "pcall.lua:110: foo" }, colog(function() return xpcall(function() coroutine.yield() error("foo") end, function(err) return err end) end))
|
||||
checkresults({ "yield", "return", false, "pcall.lua:111: foo\npcall.lua:111\npcall.lua:111\n" }, colog(function() return xpcall(function() coroutine.yield() error("foo") end, debug.traceback) end))
|
||||
checkresults({ "yield", "return", false, "pcall.luau:110: foo" }, colog(function() return xpcall(function() coroutine.yield() error("foo") end, function(err) return err end) end))
|
||||
checkresults({ "yield", "return", false, "pcall.luau:111: foo\npcall.luau:111\npcall.luau:111\n" }, colog(function() return xpcall(function() coroutine.yield() error("foo") end, debug.traceback) end))
|
||||
|
||||
-- xpcall error handling during error handling inside xpcall after yields
|
||||
checkresults({ "yield", "return", true, false, "error in error handling" }, colog(function() return xpcall(function() return xpcall(function() coroutine.yield() error("foo") end, function(err) error("bar") end) end, error) end))
|
||||
|
@ -126,7 +126,7 @@ coroutine.yield(weird)
|
|||
weird()
|
||||
end
|
||||
|
||||
checkresults({ false, "pcall.lua:129: cannot resume dead coroutine" }, pcall(function() for _ in coroutine.wrap(pcall), weird do end end))
|
||||
checkresults({ false, "pcall.luau:129: cannot resume dead coroutine" }, pcall(function() for _ in coroutine.wrap(pcall), weird do end end))
|
||||
|
||||
-- c++ exception
|
||||
checkresults({ false, "oops" }, pcall(cxxthrow))
|
Loading…
Add table
Reference in a new issue