Initial implementation of self-testing ManaMana (Do doo be-do-do!). I think it's cool that I can do this now. On the other hand, the .tdsl file below feels like an extra/unnecessary step. Clearly, ManaMana, is not well suited as a unit-testing tool which is fine because, when I wrote the gem, I imagined its use as an acceptance tool for a web ap…
This file contains 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
RDSL Lexer | |
========== | |
* It tokenizes | |
``` | |
This is a group name | |
==================== | |
``` | |
into | |
``` | |
[ | |
[:GROUP, {:value=>"This is a group name", :offset=>7}] | |
] | |
``` |
This file contains 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
Test Case: | |
It tokenizes ```(.+)``` into ```(.+)``` | |
Variables: | |
* Source = $1 | |
* Tokens = $2 | |
Script: | |
* Tokenized <Source> must equal <Tokens> |
This file contains 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
step /^Tokenized (.+) must equal (.+)$/ do |source, tokens_str| | |
output = ManaMana::RDSL::Lexer.new.tokenize(source) | |
tokens = eval tokens_str | |
output.must_equal tokens | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment