Allow specifying max length when using shortstrings to create short strings#55
Open
Wynand wants to merge 4 commits intoJuliaString:masterfrom
Open
Allow specifying max length when using shortstrings to create short strings#55Wynand wants to merge 4 commits intoJuliaString:masterfrom
Wynand wants to merge 4 commits intoJuliaString:masterfrom
Conversation
oxinabox
reviewed
Sep 15, 2021
Comment on lines
+127
to
+134
| @test ShortString( | ||
| ss127"Be honest, do you actually need a string longer than this. Seriously. C'mon this is pretty long.", | ||
| 127, | ||
| ) == "Be honest, do you actually need a string longer than this. Seriously. C'mon this is pretty long." | ||
| @test ShortString( | ||
| ss63"Basically a fairly long string really", 63 | ||
| ) == "Basically a fairly long string really" | ||
| @test ShortString(ss31"A Longer String!!!", 31) == "A Longer String!!!" |
Member
There was a problem hiding this comment.
I don't think we need these test.
They don't test anything different do they?
We should test things with:
- shortstring below maxlen
- shortstring at maxlen
- shortstring above maxlen
oxinabox
reviewed
Sep 15, 2021
| ss31"A Longer String!!!", 0 | ||
| ) == "A Longer String!!!" | ||
| @test_throws ErrorException ShortString(ss15"Short String!!!", 0) == "Short String!!!" | ||
| @test_throws ErrorException ShortString(ss7"ShrtStr", 0) == "ShrtStr" |
Member
There was a problem hiding this comment.
Including the right-hand side == here seems like it is adding nothing?
It makes it unclear what should throw the error.
oxinabox
reviewed
Sep 15, 2021
| types, in order of their size, then one of those types will be used. | ||
| """ | ||
| ShortString(str::Union{String,SubString{String}}, maxlen = sizeof(str); types=def_types) = | ||
| ShortString(str::AbstractString, maxlen = sizeof(str); types=def_types) = |
Member
There was a problem hiding this comment.
If relaxing it always to AbstractString,
need to also test that Test.GenericString works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently
ShortString(ss127"hello",5)errors, and this fixes that