Skip to content

Instantly share code, notes, and snippets.

@relaxdiego
Last active December 23, 2015 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save relaxdiego/6557728 to your computer and use it in GitHub Desktop.
Save relaxdiego/6557728 to your computer and use it in GitHub Desktop.
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…
RDSL Lexer
==========
* It tokenizes
```
This is a group name
====================
```
into
```
[
[:GROUP, {:value=>"This is a group name", :offset=>7}]
]
```
Test Case:
It tokenizes ```(.+)``` into ```(.+)```
Variables:
* Source = $1
* Tokens = $2
Script:
* Tokenized <Source> must equal <Tokens>
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