Skip to content

Add string.Left/string.Right - #25

Open
thecraftianman wants to merge 5 commits into
CFC-Servers:mainfrom
thecraftianman:more-string-tests
Open

Add string.Left/string.Right#25
thecraftianman wants to merge 5 commits into
CFC-Servers:mainfrom
thecraftianman:more-string-tests

Conversation

@thecraftianman

Copy link
Copy Markdown
Contributor

Just a couple more string library tests I wrote up real quick while testing.

@sarahsturgeon sarahsturgeon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of updates to the expected err message! 🙏

Comment thread lua/tests/gmod/unit/libraries/string/Left.lua Outdated
Comment thread lua/tests/gmod/unit/libraries/string/Right.lua Outdated
Comment thread lua/tests/gmod/unit/libraries/string/Left.lua
@thecraftianman

Copy link
Copy Markdown
Contributor Author

Should be good now

@sarahsturgeon sarahsturgeon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last thing 🙏

Comment thread lua/tests/gmod/unit/libraries/string/Left.lua Outdated
Comment thread lua/tests/gmod/unit/libraries/string/Right.lua Outdated
@sarahsturgeon

Copy link
Copy Markdown
Member

Weird batch of errors on the latest run, dunno why it's doing that

@thecraftianman

Copy link
Copy Markdown
Contributor Author

Yeah that's really strange. I don't think there's anything else wrong with the test cases themselves as far as I can tell. Does it still do that even if the tests are run again?

@sarahsturgeon

Copy link
Copy Markdown
Member

I think the error message just says ? instead of Left/Right - idk why it does that but it's probably a simple fix

@thecraftianman

Copy link
Copy Markdown
Contributor Author

Anything else I should do for this on my end? Changing the expected error messages to have ? doesn't really seem right considering that's not the error that actually shows up in-game.

@RaphaelIT7 RaphaelIT7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :D
the current issues with the error messages showing '?' are because of GLuaTest failing in your special case, in all other tests the errWith calls are not given directly the function that will error, instead they are are either wrapped in something like local testFunc = function(...) yourFunction(...) end or the error is thrown inside the function by another function that it uses inside of it.
In your case, you give expect directly to the function that throws the error, like string.Left with the nil argument, which hasn't been done before apparently and causes the error message to contain '?' as Lua loses track of the function you passed that is then called by pcall.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants