lunarmodules / luassert

Assertion library for Lua
MIT License
202 stars 76 forks source link

Fix failing tests #157

Closed BooleanCat closed 5 years ago

BooleanCat commented 5 years ago

Hi there!

I cloned this repo with the intention of adding some new features but I noticed there were failing tests on master.

What I did

git clone https://github.com/Olivine-Labs/luassert
cd luassert
busted

Then I observe this:

(master → origin {1} ✓) luassert busted
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●◼●●●●●●◼●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
196 successes / 2 failures / 0 errors / 0 pending : 0.172567 seconds

Failure → spec/assertions_spec.lua @ 475
Test Assertions Checks error_matches compares error strings with pattern
spec/assertions_spec.lua:478: Expected a different error.
Caught:
(number) 123
Expected:
(string) '^%d+$'

Failure → spec/assertions_spec.lua @ 560
Test Assertions Checks assert.has_error returns thrown error on success
spec/assertions_spec.lua:564: Expected objects to be the same.
Passed in:
(table) {
 *[1] = 0
  [2] = 0 }
Expected:
(table) {
 *[1] = '0'
  [2] = 0 }

I noticed that, for the two failing tests, the types being asserted seem incorrect - this commit fixes that (although I'm not sure how travis tests are passing on master).

System info

Tieske commented 5 years ago

I cannot reproduce those failures.

What Lua are you running? I tried LuaJIT with 5.2 compatibility enabled.

BooleanCat commented 5 years ago

I'm using Lua 5.3.5. I noticed Travis tests failing on my PR, there must be something going on here.

When I get time I'm going to try and make a docker image that looks like the Travis build and see if I can isolate what's causing failures on my system.

BooleanCat commented 5 years ago

Interesting I just tried this on my macbook running Mojave, with Lua 5.3.5 and I observe the same failures:

workspace git clone https://github.com/Olivine-Labs/luassert
Cloning into 'luassert'...
remote: Enumerating objects: 1580, done.
remote: Total 1580 (delta 0), reused 0 (delta 0), pack-reused 1580
Receiving objects: 100% (1580/1580), 314.90 KiB | 674.00 KiB/s, done.
Resolving deltas: 100% (986/986), done.
 workspace cd luassert/
(master ✓) luassert busted
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●◼●●●●●●◼●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
196 successes / 2 failures / 0 errors / 0 pending : 0.163071 seconds

Failure → spec/assertions_spec.lua @ 475
Test Assertions Checks error_matches compares error strings with pattern
spec/assertions_spec.lua:478: Expected a different error.
Caught:
(number) 123
Expected:
(string) '^%d+$'

Failure → spec/assertions_spec.lua @ 560
Test Assertions Checks assert.has_error returns thrown error on success
spec/assertions_spec.lua:564: Expected objects to be the same.
Passed in:
(table) {
 *[1] = 0
  [2] = 0 }
Expected:
(table) {
 *[1] = '0'
  [2] = 0 }

I installed lua and the rocks like so:

brew install lua
brew install luarocks
luarocks install busted

Then checking out from my PR tests pass:

(master ✓) luassert git remote add bcat https://github.com/BooleanCat/luassert.git
(master → origin ✓) luassert git fetch --all
Fetching origin
Fetching bcat
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/BooleanCat/luassert
 * [new branch]      master             -> bcat/master
 * [new branch]      returned-arguments -> bcat/returned-arguments
(master → origin ✓) luassert git checkout bcat/master
HEAD is now at 7ceb563 Fix failing tests
(detached:remotes/bcat/master ✓) luassert busted
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
198 successes / 0 failures / 0 errors / 0 pending : 0.165532 seconds
DorianGray commented 5 years ago

Hi @BooleanCat sorry for the late response on this PR... let's just say things have been hard

These tests work in our CI system, can you determine why they are failing locally?