Skip to content

Instantly share code, notes, and snippets.

@relaxdiego relaxdiego/lexer.rdsl
Last active Dec 23, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.