util.human.io: Use tail call in test to get correct line numbers
authorKim Alvefur <zash@zash.se>
Sun, 16 Jul 2023 18:42:58 +0200
changeset 13200 eca44e058eed
parent 13199 1a59a40c6443
child 13201 6beec4de8e63
util.human.io: Use tail call in test to get correct line numbers This is probably not guaranteed to work and might vary with Lua version, but it's good enough for me to get accurate line numbers out of Busted that don't all point to the test() function.
spec/util_human_io_spec.lua
--- a/spec/util_human_io_spec.lua	Sun Jul 16 18:33:53 2023 +0200
+++ b/spec/util_human_io_spec.lua	Sun Jul 16 18:42:58 2023 +0200
@@ -45,7 +45,7 @@
 
 	describe("parse_duration", function ()
 		local function test(expected, duration)
-			assert.equal(expected, human_io.parse_duration(duration));
+			return assert.equal(expected, human_io.parse_duration(duration));
 		end
 		it("works", function ()
 			test(1, "1s");