Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues comparing tables because of ordering #135

Closed
mathieujobin opened this issue Feb 26, 2016 · 3 comments
Closed

issues comparing tables because of ordering #135

mathieujobin opened this issue Feb 26, 2016 · 3 comments

Comments

@mathieujobin
Copy link

I am testing lua tables and decoded json output for REST APIs
and my tests keep failing because of table ordering. especially those without keys (AKA arrays)

I tried .same and .equals and I am getting same behavior
is there a better assertion function I could use ?

even, sometimes, the tables looks exactly the same...

Passed in:

(table) {

  [1] = 'dev'

  [2] = 'test' }

Expected:

(table) {

  [1] = 'dev'

  [2] = 'test' }

thanks

@mpeterv
Copy link
Contributor

mpeterv commented Feb 26, 2016

Can you give some example code reproducing this behaviour?

@DorianGray
Copy link
Contributor

You should be using .same here. .equals compares the table reference.

@mathieujobin
Copy link
Author

thanks, I'll see if I can write a tests that reproduce this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants