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

Add test and followup for StyledStringsExt #302

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

kimikage
Copy link
Collaborator

I do not understand the need for me to create this PR, but this PR itself might be necessary for sound development.

Copy link

codecov bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.64%. Comparing base (142353d) to head (cdd28e1).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #302      +/-   ##
==========================================
- Coverage   84.31%   83.64%   -0.68%     
==========================================
  Files           8        9       +1     
  Lines         778      746      -32     
==========================================
- Hits          656      624      -32     
  Misses        122      122              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kimikage kimikage marked this pull request as draft April 25, 2024 09:16
@kimikage kimikage force-pushed the styledstrings_followup branch 4 times, most recently from f56388f to c64a1d2 Compare April 25, 2024 10:04
@kimikage kimikage force-pushed the styledstrings_followup branch from c64a1d2 to cdd28e1 Compare April 25, 2024 10:48
@kimikage
Copy link
Collaborator Author

@tecosaur Is the following intended behavior?

julia> StyledStrings.SimpleColor(RGB(1, 0, 0))
ERROR: MethodError: Cannot `convert` an object of type
  RGB{FixedPointNumbers.N0f8} to an object of type
  Union{@NamedTuple{r::UInt8, g::UInt8, b::UInt8}, Symbol}
The function `convert` exists, but no method is defined for this combination of argument types.

@kimikage kimikage marked this pull request as ready for review April 25, 2024 13:02
@@ -14,12 +14,13 @@ StyledStringsExt = "StyledStrings"

[compat]
FixedPointNumbers = "0.5, 0.6, 0.7, 0.8"
StyledStrings = "1"
# StyledStrings = "1" # FIXME: workaround for unregistered StyledStrings
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be fixed in the close future, but currently StyledStrings is unregistered and it should be v1 for the time being.
We are touching the internals of StyledStrings, so we run the risk of incompatibility. And that can't be prevented by the "1" cap anyway.
(In other words, if we follow the principle, we need to specify the patch version here.)

Copy link
Contributor

Choose a reason for hiding this comment

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

We are touching the internals of StyledStrings, so we run the risk of incompatibility

Just FYI, SimpleColor is part of the public API in the 1.11 stdlib version, so the conversion implemented here shouldn't break in any 1.x version of StyledStrings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What constitutes a breaking change is ambiguous. If SimpleColor added a feature to have an alpha component, it would not break the code, but it would go against the user's intuition.
That is just an example. StyledStrings is community owned, although you are the lead developer. I don't believe anything bad will happen, but there is no guarantee how it will turn out.
For example, CI could cease to function effectively even though no one has done anything wrong.

if isdefined(Base, :get_extension)
import Pkg
if VERSION < v"1.11"
Pkg.add(url="https://github.com/JuliaLang/StyledStrings.jl", rev="julia1-compat")
Copy link
Collaborator Author

@kimikage kimikage Apr 25, 2024

Choose a reason for hiding this comment

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

I don't know how long julia1-compat remains in effect, but it is more practical than main for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't anticipate deleting the branch at any point, it will just become abandoned at some stage.

@kimikage kimikage changed the title Add test for StyledStringsExt Add test and followup for StyledStringsExt Apr 25, 2024
@tecosaur
Copy link
Contributor

@tecosaur Is the following intended behavior?

julia> StyledStrings.SimpleColor(RGB(1, 0, 0))
ERROR: MethodError: Cannot `convert` an object of type
  RGB{FixedPointNumbers.N0f8} to an object of type
  Union{@NamedTuple{r::UInt8, g::UInt8, b::UInt8}, Symbol}
The function `convert` exists, but no method is defined for this combination of argument types.

I'd say so, given I didn't intend for the constructor to work directly with Colorants regardless of the conversion methods implemented.

@kimikage
Copy link
Collaborator Author

I didn't intend for the constructor to work directly with Colorants

If you do not plan to make any changes in this package, I am ok with it.
Now let's merge this.

@kimikage kimikage merged commit e9780b6 into JuliaGraphics:master Apr 25, 2024
7 of 18 checks passed
@kimikage kimikage deleted the styledstrings_followup branch April 25, 2024 16:21
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.

2 participants