diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cdee2f6c..063dd955 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/CLI/Repl.cpp b/CLI/Repl.cpp index 323ab144..845e39cf 100644 --- a/CLI/Repl.cpp +++ b/CLI/Repl.cpp @@ -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); }); } diff --git a/bench/bench.py b/bench/bench.py index b23ca891..48622399 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -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) diff --git a/tests/Conformance.test.cpp b/tests/Conformance.test.cpp index 06b3c523..b040f19f 100644 --- a/tests/Conformance.test.cpp +++ b/tests/Conformance.test.cpp @@ -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) { diff --git a/tests/conformance/apicalls.lua b/tests/conformance/apicalls.luau similarity index 100% rename from tests/conformance/apicalls.lua rename to tests/conformance/apicalls.luau diff --git a/tests/conformance/assert.lua b/tests/conformance/assert.luau similarity index 100% rename from tests/conformance/assert.lua rename to tests/conformance/assert.luau diff --git a/tests/conformance/attrib.lua b/tests/conformance/attrib.luau similarity index 100% rename from tests/conformance/attrib.lua rename to tests/conformance/attrib.luau diff --git a/tests/conformance/basic.lua b/tests/conformance/basic.luau similarity index 99% rename from tests/conformance/basic.lua rename to tests/conformance/basic.luau index 687fff1e..e06cdbe4 100644 --- a/tests/conformance/basic.lua +++ b/tests/conformance/basic.luau @@ -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) diff --git a/tests/conformance/bitwise.lua b/tests/conformance/bitwise.luau similarity index 100% rename from tests/conformance/bitwise.lua rename to tests/conformance/bitwise.luau diff --git a/tests/conformance/calls.lua b/tests/conformance/calls.luau similarity index 100% rename from tests/conformance/calls.lua rename to tests/conformance/calls.luau diff --git a/tests/conformance/clear.lua b/tests/conformance/clear.luau similarity index 100% rename from tests/conformance/clear.lua rename to tests/conformance/clear.luau diff --git a/tests/conformance/closure.lua b/tests/conformance/closure.luau similarity index 99% rename from tests/conformance/closure.lua rename to tests/conformance/closure.luau index aac42c56..36acef88 100644 --- a/tests/conformance/closure.lua +++ b/tests/conformance/closure.luau @@ -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) diff --git a/tests/conformance/constructs.lua b/tests/conformance/constructs.luau similarity index 100% rename from tests/conformance/constructs.lua rename to tests/conformance/constructs.luau diff --git a/tests/conformance/coroutine.lua b/tests/conformance/coroutine.luau similarity index 100% rename from tests/conformance/coroutine.lua rename to tests/conformance/coroutine.luau diff --git a/tests/conformance/datetime.lua b/tests/conformance/datetime.luau similarity index 100% rename from tests/conformance/datetime.lua rename to tests/conformance/datetime.luau diff --git a/tests/conformance/debug.lua b/tests/conformance/debug.luau similarity index 96% rename from tests/conformance/debug.lua rename to tests/conformance/debug.luau index ee79a14f..182f5c1b 100644 --- a/tests/conformance/debug.lua +++ b/tests/conformance/debug.luau @@ -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 diff --git a/tests/conformance/debugger.lua b/tests/conformance/debugger.luau similarity index 100% rename from tests/conformance/debugger.lua rename to tests/conformance/debugger.luau diff --git a/tests/conformance/errors.lua b/tests/conformance/errors.luau similarity index 100% rename from tests/conformance/errors.lua rename to tests/conformance/errors.luau diff --git a/tests/conformance/events.lua b/tests/conformance/events.luau similarity index 100% rename from tests/conformance/events.lua rename to tests/conformance/events.luau diff --git a/tests/conformance/exceptions.lua b/tests/conformance/exceptions.luau similarity index 100% rename from tests/conformance/exceptions.lua rename to tests/conformance/exceptions.luau diff --git a/tests/conformance/gc.lua b/tests/conformance/gc.luau similarity index 100% rename from tests/conformance/gc.lua rename to tests/conformance/gc.luau diff --git a/tests/conformance/ifelseexpr.lua b/tests/conformance/ifelseexpr.luau similarity index 100% rename from tests/conformance/ifelseexpr.lua rename to tests/conformance/ifelseexpr.luau diff --git a/tests/conformance/literals.lua b/tests/conformance/literals.luau similarity index 100% rename from tests/conformance/literals.lua rename to tests/conformance/literals.luau diff --git a/tests/conformance/locals.lua b/tests/conformance/locals.luau similarity index 100% rename from tests/conformance/locals.lua rename to tests/conformance/locals.luau diff --git a/tests/conformance/math.lua b/tests/conformance/math.luau similarity index 100% rename from tests/conformance/math.lua rename to tests/conformance/math.luau diff --git a/tests/conformance/move.lua b/tests/conformance/move.luau similarity index 100% rename from tests/conformance/move.lua rename to tests/conformance/move.luau diff --git a/tests/conformance/nextvar.lua b/tests/conformance/nextvar.luau similarity index 100% rename from tests/conformance/nextvar.lua rename to tests/conformance/nextvar.luau diff --git a/tests/conformance/pcall.lua b/tests/conformance/pcall.luau similarity index 82% rename from tests/conformance/pcall.lua rename to tests/conformance/pcall.luau index a2072d2c..99ef3455 100644 --- a/tests/conformance/pcall.lua +++ b/tests/conformance/pcall.luau @@ -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)) diff --git a/tests/conformance/pm.lua b/tests/conformance/pm.luau similarity index 100% rename from tests/conformance/pm.lua rename to tests/conformance/pm.luau diff --git a/tests/conformance/sort.lua b/tests/conformance/sort.luau similarity index 100% rename from tests/conformance/sort.lua rename to tests/conformance/sort.luau diff --git a/tests/conformance/strings.lua b/tests/conformance/strings.luau similarity index 100% rename from tests/conformance/strings.lua rename to tests/conformance/strings.luau diff --git a/tests/conformance/tmerror.lua b/tests/conformance/tmerror.luau similarity index 100% rename from tests/conformance/tmerror.lua rename to tests/conformance/tmerror.luau diff --git a/tests/conformance/tpack.lua b/tests/conformance/tpack.luau similarity index 100% rename from tests/conformance/tpack.lua rename to tests/conformance/tpack.luau diff --git a/tests/conformance/types.lua b/tests/conformance/types.luau similarity index 100% rename from tests/conformance/types.lua rename to tests/conformance/types.luau diff --git a/tests/conformance/utf8.lua b/tests/conformance/utf8.luau similarity index 100% rename from tests/conformance/utf8.lua rename to tests/conformance/utf8.luau diff --git a/tests/conformance/vararg.lua b/tests/conformance/vararg.luau similarity index 100% rename from tests/conformance/vararg.lua rename to tests/conformance/vararg.luau diff --git a/tests/conformance/vector.lua b/tests/conformance/vector.luau similarity index 100% rename from tests/conformance/vector.lua rename to tests/conformance/vector.luau