Skip to content

Commit

Permalink
Fix tests broken in debug mode
Browse files Browse the repository at this point in the history
We remove some unrelated stmts from a test case, and gate another one behind a cfg flag
  • Loading branch information
JohnnyMorganz committed Nov 14, 2023
1 parent 42a66fe commit 711e4a8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Test (Luau)
run: cargo test --features luau --release # TODO: ideally we don't need to run in release mode!
run: cargo test --features luau

# TODO: ideally this step isn't needed, but we have to gate some tests behind release mode
# we do this to ensure they still run in CI
# https://github.com/Kampfkarren/full-moon/issues/140
test_luau_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test (Luau - Release mode)
run: cargo test --features luau --release

test_lua52:
runs-on: ubuntu-latest
Expand Down
6 changes: 4 additions & 2 deletions tests/inputs-luau/assignment-hang-1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ exports.separateDisplayNameAndHOCs =
displayName = nextMatch
hocDisplayNames = {}
while nextMatch :: any ~= nil do
nextMatch = matches()
table.insert(hocDisplayNames :: Array<string>, nextMatch)
-- TODO: https://github.com/Kampfkarren/full-moon/issues/140
-- Including the following statements cause a stack overflow:
-- nextMatch = matches()
-- table.insert(hocDisplayNames :: Array<string>, nextMatch)
end
end
end
Expand Down
7 changes: 5 additions & 2 deletions tests/snapshots/tests__luau@assignment-hang-1.lua.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: tests/tests.rs
expression: format(&contents)
input_file: tests/inputs-luau/assignment-hang-1.lua
---
-- https://github.com/JohnnyMorganz/StyLua/issues/439
exports.separateDisplayNameAndHOCs = function(
Expand Down Expand Up @@ -28,8 +29,10 @@ exports.separateDisplayNameAndHOCs = function(
displayName = nextMatch
hocDisplayNames = {}
while nextMatch :: any ~= nil do
nextMatch = matches()
table.insert(hocDisplayNames :: Array<string>, nextMatch)
-- TODO: https://github.com/Kampfkarren/full-moon/issues/140
-- Including the following statements cause a stack overflow:
-- nextMatch = matches()
-- table.insert(hocDisplayNames :: Array<string>, nextMatch)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions tests/test_ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ fn test_incomplete_range() {
}

#[test]
#[cfg_attr(
all(debug_assertions, feature = "luau"),
ignore = "fails in debug mode" // TODO: https://github.com/Kampfkarren/full-moon/issues/140
)]
fn test_large_example() {
insta::assert_snapshot!(
format(
Expand Down

0 comments on commit 711e4a8

Please sign in to comment.