Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change test files to be .luau #179

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 57 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -24,62 +24,62 @@ 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
strategy:
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
4 changes: 2 additions & 2 deletions CLI/Repl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
}
Expand Down Expand Up @@ -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);
});
}
Expand Down
66 changes: 33 additions & 33 deletions tests/Conformance.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");

Expand Down Expand Up @@ -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);
Expand All @@ -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")
Expand All @@ -487,7 +487,7 @@ TEST_CASE("Debugger")
interruptedthread = nullptr;

runConformance(
"debugger.lua",
"debugger.luau",
[](lua_State* L) {
lua_Callbacks* cb = lua_callbacks(L);

Expand Down Expand Up @@ -683,7 +683,7 @@ TEST_CASE("Reference")

TEST_CASE("ApiFunctionCalls")
{
StateRef globalState = runConformance("apicalls.lua");
StateRef globalState = runConformance("apicalls.luau");
lua_State* L = globalState.get();

lua_getfield(L, LUA_GLOBALSINDEX, "add");
Expand Down Expand Up @@ -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();

{
Expand Down Expand Up @@ -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) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading