-
Notifications
You must be signed in to change notification settings - Fork 17
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
[Stdlib, Spec-lib] Myst spec failures now includes path to the failure #161
[Stdlib, Spec-lib] Myst spec failures now includes path to the failure #161
Conversation
``` require "stdlib/spec.mt" describe("Fish") do describe("#swim") do it("moves the fish forward")do assert(false) end end end ``` Will now print: ```text Fish #swim moves the fish forward Assertion failed. Expected: true Got: false ``` In red :D Also with this came a simple module `Color` with `#colored` which is what is used for printing red and green stuff here. To make that work, I added some lexing for escape codes (notably `\e`).
(Forgot to put some stuff in the previous)
stdlib/spec/describe_container.mt
Outdated
|
||
def get_path(current : String) | ||
when !describe_stack.empty? | ||
return describe_stack.pop.get_path("<(@name)> <(current)>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't actually run this yet, but is pop
the desired behavior here? Seems like it would be modifying the stack when you're just trying to get a value from it.
Looks like we don't have a List#last
method that could replace it anyway. Could be worth adding (along with List#first
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, i just though it didn't matter as the program exits when a spec fails. I should do a first
and last
still though, for #140.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually that wouldn't work here anyways if there was nested describe
s. So i'll figure something else
This is awesome stuff! I'm excited to get this in and be able to use it :) |
stdlib/colored.mt
Outdated
ANSI_CYAN = "\e[0;36m" | ||
ANSI_WHITE = "\e[0;37m" | ||
|
||
def colored(string, sym) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a type restriction on sym
would make sense here. Since the only valid input is a symbol, it doesn't make sense to accept anything else.
Looks good! Thanks for all of this :) |
This completes #139 and #141
Will now print:
In red :D
Also with this came a simple module
Color
with#colored
which is what is used for printing red and green stuff here. To make that work, I added some lexing for escape codes (notably\e
).