Skip to content

Commit

Permalink
test: discovers test that have the 'function' keyword (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasia authored Nov 7, 2023
1 parent 6ffc74d commit 7d8919f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/core/position_discoverer_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ describe("PositionDiscoverer", function()
--then
-- local test_file_node = tree:to_list()[1]
local test_function_node = tree:to_list()[2][1]
local test_function_node_2 = tree:to_list()[3][1]
local actual_test_name = test_function_node.name
local actual_test_name_2 = test_function_node_2.name

assert.are.equal("test_sum_1_plus_1", actual_test_name)
assert.are.equal("test_sum_2_plus_2", actual_test_name_2)

-- there is only one test function
assert.are.equal(1, #tree:children())
assert.are.equal(2, #tree:children())
end)

async.it("ignores functions that are not tests", function()
Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/example_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ test_sum_1_plus_1() {
assert_equals 2 $(1 + 1)
}

function test_sum_2_plus_2() {
assert_equals 4 $(2 + 2)
}

this_is_not_a_test() {
echo "This is not a test"
}
Expand Down

0 comments on commit 7d8919f

Please sign in to comment.