-
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
Changes from 2 commits
0bdc55c
7930b83
f9fa921
568ad39
d78dca0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
defmodule Color | ||
def ansi_from_symbol(sym) | ||
when sym == :black | ||
return ANSI_BLACK | ||
when sym == :red | ||
return ANSI_RED | ||
when sym == :green | ||
return ANSI_GREEN | ||
when sym == :yellow | ||
return ANSI_YELLOW | ||
when sym == :blue | ||
return ANSI_BLUE | ||
when sym == :purple | ||
return ANSI_PURPLE | ||
when sym == :cyan | ||
return ANSI_CYAN | ||
when sym == :white | ||
return ANSI_WHITE | ||
else | ||
raise ":\"<(sym)>\" is not a valid color" | ||
end | ||
end | ||
|
||
ANSI_RESET = "\e[0m" | ||
|
||
ANSI_BLACK = "\e[0;30m" | ||
ANSI_RED = "\e[0;31m" | ||
ANSI_GREEN = "\e[0;32m" | ||
ANSI_YELLOW = "\e[0;33m" | ||
ANSI_BLUE = "\e[0;34m" | ||
ANSI_PURPLE = "\e[0;35m" | ||
ANSI_CYAN = "\e[0;36m" | ||
ANSI_WHITE = "\e[0;37m" | ||
|
||
def colored(string, sym) | ||
color = ansi_from_symbol(sym) | ||
"<(color)><(string.to_s)><(ANSI_RESET)>" | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule Spec | ||
deftype DescribeContainer | ||
def initialize(name : String) | ||
@name = name | ||
end | ||
|
||
def name; @name; end | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Haven't actually run this yet, but is Looks like we don't have a There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually that wouldn't work here anyways if there was nested |
||
else | ||
"<(@name)> <(current)>" | ||
end | ||
end | ||
end | ||
end |
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.