From 9580bde8777160e3f613f47ea90baac7a69d5b67 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:03:43 -0400 Subject: [PATCH 01/10] Lune Unit Testing --- .github/workflows/UnitTests.yml | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/UnitTests.yml diff --git a/.github/workflows/UnitTests.yml b/.github/workflows/UnitTests.yml new file mode 100644 index 0000000..b59e52b --- /dev/null +++ b/.github/workflows/UnitTests.yml @@ -0,0 +1,41 @@ +name: UnitTests + +on: + pull_request: + push: + branches: + - master + +jobs: + unit-tests: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + path: luau-ast + + - name: Checkout Repository roblox-ts + uses: actions/checkout@v4 + with: + repository: roblox-ts/roblox-ts + ref: lune + path: roblox-ts + + - name: Setup luau-ast repo + run: | + cd luau-ast + npm install + npm run build + + - name: Setup roblox-ts repo + run: | + cd roblox-ts + npm install + npm install ../luau-ast + + - name: Run Tests + run: | + cd roblox-ts + npm test From f835d614b9e7dece653b15958ef34a5c12e631c6 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:05:53 -0400 Subject: [PATCH 02/10] Update UnitTests.yml --- .github/workflows/UnitTests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/UnitTests.yml b/.github/workflows/UnitTests.yml index b59e52b..4035b81 100644 --- a/.github/workflows/UnitTests.yml +++ b/.github/workflows/UnitTests.yml @@ -34,6 +34,7 @@ jobs: cd roblox-ts npm install npm install ../luau-ast + npm run update-test-types - name: Run Tests run: | From f7a870576677d31648df07a358437eebac0ee516 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:07:45 -0400 Subject: [PATCH 03/10] Add Install Foreman step --- .github/workflows/UnitTests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/UnitTests.yml b/.github/workflows/UnitTests.yml index 4035b81..df69cba 100644 --- a/.github/workflows/UnitTests.yml +++ b/.github/workflows/UnitTests.yml @@ -23,6 +23,11 @@ jobs: ref: lune path: roblox-ts + - name: Install Foreman + uses: Roblox/setup-foreman@v2.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup luau-ast repo run: | cd luau-ast From d66165f16f2867e41878dc3c0d2573c54d7af95f Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:09:49 -0400 Subject: [PATCH 04/10] Add foreman.toml --- foreman.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 foreman.toml diff --git a/foreman.toml b/foreman.toml new file mode 100644 index 0000000..ed1be29 --- /dev/null +++ b/foreman.toml @@ -0,0 +1,3 @@ +[tools] +rojo = { source = "rojo-rbx/rojo", version = "=7.3.0" } +lune = { source = "filiptibell/lune", version = "=0.7.7" } From 1e0d903919c85dfe67a967ff43816cf0761a44c1 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:11:53 -0400 Subject: [PATCH 05/10] Add foreman install command --- .github/workflows/UnitTests.yml | 5 +++-- foreman.toml | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 foreman.toml diff --git a/.github/workflows/UnitTests.yml b/.github/workflows/UnitTests.yml index df69cba..a5ad0f0 100644 --- a/.github/workflows/UnitTests.yml +++ b/.github/workflows/UnitTests.yml @@ -11,12 +11,12 @@ jobs: name: Unit Tests runs-on: ubuntu-latest steps: - - name: Checkout Repository + - name: Checkout luau-ast repo uses: actions/checkout@v4 with: path: luau-ast - - name: Checkout Repository roblox-ts + - name: Checkout roblox-ts repo uses: actions/checkout@v4 with: repository: roblox-ts/roblox-ts @@ -37,6 +37,7 @@ jobs: - name: Setup roblox-ts repo run: | cd roblox-ts + foreman install npm install npm install ../luau-ast npm run update-test-types diff --git a/foreman.toml b/foreman.toml deleted file mode 100644 index ed1be29..0000000 --- a/foreman.toml +++ /dev/null @@ -1,3 +0,0 @@ -[tools] -rojo = { source = "rojo-rbx/rojo", version = "=7.3.0" } -lune = { source = "filiptibell/lune", version = "=0.7.7" } From a30496ef662866eb0790031aadb743ff9384862a Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:16:15 -0400 Subject: [PATCH 06/10] Break things for fun --- .../indexable/renderParenthesizedExpression.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts b/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts index 655c235..af2e88d 100644 --- a/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts +++ b/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts @@ -2,14 +2,5 @@ import luau from "LuauAST"; import { render, RenderState } from "LuauRenderer"; export function renderParenthesizedExpression(state: RenderState, node: luau.ParenthesizedExpression) { - // skip nested parentheses - let expression = node.expression; - while (luau.isParenthesizedExpression(expression)) { - expression = expression.expression; - } - if (luau.isSimple(expression)) { - return render(state, node.expression); - } else { - return `(${render(state, node.expression)})`; - } + return render(state, node.expression); } From 6c169262f8482ac3f33c85810ab2e2b2a9dd9cdd Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:18:25 -0400 Subject: [PATCH 07/10] Unbreak thing --- .../indexable/renderParenthesizedExpression.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts b/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts index af2e88d..655c235 100644 --- a/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts +++ b/src/LuauRenderer/nodes/expressions/indexable/renderParenthesizedExpression.ts @@ -2,5 +2,14 @@ import luau from "LuauAST"; import { render, RenderState } from "LuauRenderer"; export function renderParenthesizedExpression(state: RenderState, node: luau.ParenthesizedExpression) { - return render(state, node.expression); + // skip nested parentheses + let expression = node.expression; + while (luau.isParenthesizedExpression(expression)) { + expression = expression.expression; + } + if (luau.isSimple(expression)) { + return render(state, node.expression); + } else { + return `(${render(state, node.expression)})`; + } } From e344fe1fe8f58118d490cecf4b0480adcad81bc1 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:18:47 -0400 Subject: [PATCH 08/10] Break different thing --- src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts b/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts index 1c754b1..77ec965 100644 --- a/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts +++ b/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts @@ -2,5 +2,5 @@ import luau from "LuauAST"; import { RenderState } from "LuauRenderer"; export function renderNumberLiteral(state: RenderState, node: luau.NumberLiteral) { - return luau.isValidNumberLiteral(node.value) ? node.value : String(Number(node.value.replace(/_/g, ""))); + return luau.isValidNumberLiteral(node.value) ? node.value + "0" : String(Number(node.value.replace(/_/g, ""))); } From 476ea55daf3dfce0d422be199d341e41baf7c80a Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:24:12 -0400 Subject: [PATCH 09/10] Test From 13101f41ede0b0abdd935439cb0d887e2629a599 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 4 Oct 2023 21:28:05 -0400 Subject: [PATCH 10/10] Unbreak thing --- src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts b/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts index 77ec965..1c754b1 100644 --- a/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts +++ b/src/LuauRenderer/nodes/expressions/renderNumberLiteral.ts @@ -2,5 +2,5 @@ import luau from "LuauAST"; import { RenderState } from "LuauRenderer"; export function renderNumberLiteral(state: RenderState, node: luau.NumberLiteral) { - return luau.isValidNumberLiteral(node.value) ? node.value + "0" : String(Number(node.value.replace(/_/g, ""))); + return luau.isValidNumberLiteral(node.value) ? node.value : String(Number(node.value.replace(/_/g, ""))); }