Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: cucumber/gherkin
...
head fork: cucumber/gherkin
  • 6 commits
  • 32 files changed
  • 0 commit comments
  • 2 contributors
Showing with 140 additions and 109 deletions.
  1. +3 −3 Gemfile.lock
  2. +6 −0 History.md
  3. +1 −1  README.md
  4. +2 −1  features/json_formatter.feature
  5. +1 −1  features/step_definitions/eyeball_steps.rb
  6. +1 −1  gherkin.gemspec
  7. +2 −2 ikvm/Gherkin/Gherkin.csproj
  8. +1 −11 java/pom.xml
  9. +1 −1  java/src/main/java/gherkin/JSONParser.java
  10. +0 −5 java/src/main/java/gherkin/formatter/AbstractEvent.java
  11. +0 −17 java/src/main/java/gherkin/formatter/ArgumentFormat.java
  12. +7 −1 java/src/main/java/gherkin/formatter/model/DocString.java
  13. +1 −1  java/src/main/java/gherkin/lexer/Listener.java
  14. +2 −6 java/src/main/java/gherkin/parser/FormatterListener.java
  15. +2 −2 java/src/main/java/gherkin/parser/Parser.java
  16. +1 −1  java/src/main/java/gherkin/parser/StateMachineReader.java
  17. +1 −1  js/package.json
  18. +5 −4 lib/gherkin/formatter/model.rb
  19. +1 −1  lib/gherkin/formatter/pretty_formatter.rb
  20. +1 −1  lib/gherkin/json_parser.rb
  21. +2 −2 lib/gherkin/listener/formatter_listener.rb
  22. +1 −1  lib/gherkin/rubify.rb
  23. +23 −8 ragel/lexer.c.rl.erb
  24. +15 −4 ragel/lexer.java.rl.erb
  25. +13 −4 ragel/lexer.js.rl.erb
  26. +12 −5 ragel/lexer.rb.rl.erb
  27. +4 −4 ragel/lexer_common.rl.erb
  28. +1 −0  spec/gherkin/fixtures/complex.json
  29. +25 −15 spec/gherkin/shared/doc_string_group.rb
  30. +3 −3 spec/gherkin/shared/lexer_group.rb
  31. +1 −1  tasks/cucumber.rake
  32. +1 −1  tasks/release.rake
6 Gemfile.lock
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- gherkin (2.4.17)
+ gherkin (2.4.18)
json (>= 1.4.6)
GEM
@@ -11,9 +11,9 @@ GEM
cucumber (1.0.2)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (~> 2.4.5)
+ gherkin (~> 2.4.16)
json (>= 1.4.6)
- term-ansicolor (>= 1.0.5)
+ term-ansicolor (>= 1.0.6)
diff-lcs (1.1.3)
json (1.5.4)
json (1.5.4-java)
6 History.md
View
@@ -1,3 +1,9 @@
+## [2.4.18](https://github.com/cucumber/gherkin/compare/v2.4.17...v2.4.18)
+
+### New Features
+
+* Fenced Code Blocks for DocStrings ([#123](https://github.com/cucumber/gherkin/issues/123) Gregory Hnatiuk, Aslak Hellesøy)
+
## [2.4.17](https://github.com/cucumber/gherkin/compare/v2.4.16...v2.4.17)
### New Features
2  README.md
View
@@ -52,7 +52,7 @@ The jar file is in the central Maven repo.
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
- <version>2.4.17</version>
+ <version>2.4.18</version>
</dependency>
You can get it manually from [ibiblio](http://mirrors.ibiblio.org/pub/mirrors/maven2/info/cukes/gherkin) or by searching at [maven central](http://search.maven.org/)
3  features/json_formatter.feature
View
@@ -53,7 +53,7 @@ Feature: JSON formatter
When I was
|asleep|
And so
- \"\"\"
+ \"\"\"plaintext
innocent
\"\"\"
@@ -181,6 +181,7 @@ Feature: JSON formatter
"line": 26,
"multiline_arg": {
"type": "doc_string",
+ "content_type": "plaintext",
"value": "innocent",
"line": 27
}
2  features/step_definitions/eyeball_steps.rb
View
@@ -1,3 +1,3 @@
Given /^they have arrived$/ do |table|
- announce table.raw
+ puts table.raw
end
2  gherkin.gemspec
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = "gherkin"
- s.version = "2.4.17"
+ s.version = "2.4.18"
s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
s.description = "A fast Gherkin lexer/parser based on the Ragel State Machine Compiler."
s.summary = "#{s.name}-#{s.version}"
4 ikvm/Gherkin/Gherkin.csproj
View
@@ -43,9 +43,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\release\IKVM.OpenJDK.Text.dll</HintPath>
</Reference>
- <Reference Include="gherkin-2.4.17, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
+ <Reference Include="gherkin-2.4.18, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\release\gherkin-2.4.17.dll</HintPath>
+ <HintPath>..\..\release\gherkin-2.4.18.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
12 java/pom.xml
View
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
- <version>2.4.17</version>
+ <version>2.4.18</version>
<packaging>jar</packaging>
<name>Gherkin</name>
<description>Pure Java Gherkin</description>
@@ -85,16 +85,6 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.2.1</version>
- <configuration>
- <prepare>
- <remoteTagging>false</remoteTagging>
- </prepare>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
2  java/src/main/java/gherkin/JSONParser.java
View
@@ -62,7 +62,7 @@ private void step(JSONObject o) {
if (ma.get("type").equals("table")) {
step.setMultilineArg(rows(getList(ma, "value")));
} else {
- step.setMultilineArg(new DocString(getString(ma, "value"), getInt(ma, "line")));
+ step.setMultilineArg(new DocString(getString(ma, "content_type"), getString(ma, "value"), getInt(ma, "line")));
}
}
step.replay(formatter);
5 java/src/main/java/gherkin/formatter/AbstractEvent.java
View
@@ -1,5 +0,0 @@
-package gherkin.formatter;
-
-public abstract class AbstractEvent {
- public abstract void replay(Formatter formatter);
-}
17 java/src/main/java/gherkin/formatter/ArgumentFormat.java
View
@@ -1,17 +0,0 @@
-package gherkin.formatter;
-
-import java.io.UnsupportedEncodingException;
-
-public class ArgumentFormat {
- private final String prefix;
- private final String suffix;
-
- public ArgumentFormat(String prefix, String suffix) {
- this.prefix = prefix;
- this.suffix = suffix;
- }
-
- public byte[] formatArgument(byte[] argument) throws UnsupportedEncodingException {
- return (prefix + new String(argument, "UTF-8") + suffix).getBytes("UTF-8");
- }
-}
8 java/src/main/java/gherkin/formatter/model/DocString.java
View
@@ -3,9 +3,14 @@
import gherkin.formatter.Mappable;
public class DocString extends Mappable {
+ private final String content_type;
private final String value;
private final int line;
+ public String getContentType() {
+ return content_type;
+ }
+
public String getValue() {
return value;
}
@@ -14,7 +19,8 @@ public int getLine() {
return line;
}
- public DocString(String value, int line) {
+ public DocString(String contentType, String value, int line) {
+ this.content_type = contentType;
this.value = value;
this.line = line;
}
2  java/src/main/java/gherkin/lexer/Listener.java
View
@@ -21,7 +21,7 @@
void row(List<String> cells, int line);
- void docString(String string, int line);
+ void docString(String contentType, String content, int line);
void eof();
}
8 java/src/main/java/gherkin/parser/FormatterListener.java
View
@@ -63,8 +63,8 @@ public void row(List<String> cells, int line) {
table.add(new Row(grabComments(), cells, line, Row.DiffType.NONE));
}
- public void docString(String string, int line) {
- this.docString = new DocString(string, line);
+ public void docString(String contentType, String content, int line) {
+ this.docString = new DocString(contentType, content, line);
}
public void eof() {
@@ -72,10 +72,6 @@ public void eof() {
formatter.eof();
}
- public void syntaxError(String state, String event, List<String> legalEvents, int line) {
- throw new UnsupportedOperationException();
- }
-
/**
* Not part of the API. Used for testing only.
*/
4 java/src/main/java/gherkin/parser/Parser.java
View
@@ -72,9 +72,9 @@ public void tag(String tag, int line) {
}
}
- public void docString(String string, int line) {
+ public void docString(String contentType, String content, int line) {
if (event("doc_string", line)) {
- listener.docString(string, line);
+ listener.docString(contentType, content, line);
}
}
2  java/src/main/java/gherkin/parser/StateMachineReader.java
View
@@ -47,7 +47,7 @@ public void examples(String keyword, String name, String description, int line)
public void step(String keyword, String name, int line) {
}
- public void docString(String string, int line) {
+ public void docString(String contentType, String content, int line) {
}
public void eof() {
2  js/package.json
View
@@ -1,7 +1,7 @@
{ "name" : "gherkin"
, "description" : "A fast Gherkin lexer/parser based on the Ragel State Machine Compiler."
, "keywords" : [ "testing", "bdd", "cucumber", "gherkin", "tests" ]
-, "version" : "2.4.17"
+, "version" : "2.4.18"
, "homepage" : "http://github.com/cucumber/gherkin"
, "author" : "Aslak Hellesøy <aslak.hellesoy@gmail.com>"
, "contributors" : [ "Aslak Hellesøy <aslak.hellesoy@gmail.com>" ]
9 lib/gherkin/formatter/model.rb
View
@@ -146,6 +146,7 @@ def to_hash
}
elsif DocString === @multiline_arg
hash['multiline_arg']['type'] = 'doc_string'
+ hash['multiline_arg']['content_type'] = @multiline_arg.content_type
end
hash
end
@@ -182,10 +183,10 @@ def hash
class DocString < Hashable
native_impl('gherkin')
- attr_reader :value, :line
+ attr_reader :content_type, :value, :line
- def initialize(value, line)
- @value, @line = value, line
+ def initialize(content_type, value, line)
+ @content_type, @value, @line = content_type, value, line
end
def line_range
@@ -233,4 +234,4 @@ def replay(formatter)
end
end
end
-end
+end
2  lib/gherkin/formatter/pretty_formatter.rb
View
@@ -181,7 +181,7 @@ def table(rows)
private
def doc_string(doc_string)
- @io.puts " \"\"\"\n" + escape_triple_quotes(indent(doc_string.value, ' ')) + "\n \"\"\""
+ @io.puts " \"\"\"" + doc_string.content_type + "\n" + escape_triple_quotes(indent(doc_string.value, ' ')) + "\n \"\"\""
end
def exception(exception)
2  lib/gherkin/json_parser.rb
View
@@ -57,7 +57,7 @@ def step(o)
if(ma['type'] == 'table')
step.multiline_arg = rows(ma['value'])
else
- step.multiline_arg = Formatter::Model::DocString.new(ma['value'], ma['line'])
+ step.multiline_arg = Formatter::Model::DocString.new(ma['content_type'].to_s, ma['value'], ma['line'])
end
end
4 lib/gherkin/listener/formatter_listener.rb
View
@@ -57,8 +57,8 @@ def row(cells, line)
@table << Formatter::Model::Row.new(grab_comments!, cells, line)
end
- def doc_string(string, line)
- @doc_string = Formatter::Model::DocString.new(string, line)
+ def doc_string(string, content_type, line)
+ @doc_string = Formatter::Model::DocString.new(string, content_type, line)
end
def eof
2  lib/gherkin/rubify.rb
View
@@ -10,7 +10,7 @@ def rubify(o)
o.map{|e| rubify(e)}
when Java.gherkin.formatter.model.DocString
require 'gherkin/formatter/model'
- Formatter::Model::DocString.new(o.value, o.line)
+ Formatter::Model::DocString.new(o.content_type, o.value, o.line)
else
o
end
31 ragel/lexer.c.rl.erb
View
@@ -45,6 +45,8 @@ typedef struct lexer_state {
size_t next_keyword_start;
size_t content_start;
size_t content_end;
+ size_t docstring_content_type_start;
+ size_t docstring_content_type_end;
size_t query_start;
size_t last_newline;
size_t final_newline;
@@ -84,23 +86,33 @@ static VALUE rb_eGherkinLexingError;
lexer->start_col = lexer->content_start - lexer->last_newline - (lexer->keyword_end - lexer->keyword_start) + 2;
}
- action begin_pystring_content {
+ action begin_docstring_content {
MARK(content_start, p);
}
- action start_pystring {
+ action start_docstring {
lexer->current_line = lexer->line_number;
lexer->start_col = p - data - lexer->last_newline;
}
- action store_pystring_content {
+ action store_docstring_content {
int len = LEN(content_start, PTR_TO(final_newline));
+ int type_len = LEN(docstring_content_type_start, PTR_TO(docstring_content_type_end));
if (len < 0) len = 0;
+ if (type_len < 0) len = 0;
- store_pystring_content(listener, lexer->start_col, PTR_TO(content_start), len, lexer->current_line);
+ store_docstring_content(listener, lexer->start_col, PTR_TO(docstring_content_type_start), type_len, PTR_TO(content_start), len, lexer->current_line);
}
+ action start_docstring_content_type {
+ MARK(docstring_content_type_start, p);
+ }
+
+ action end_docstring_content_type {
+ MARK(docstring_content_type_end, p);
+ }
+
action store_feature_content {
STORE_KW_END_CON(feature);
}
@@ -311,26 +323,27 @@ store_attr(VALUE listener, const char * attr_type,
VALUE val = ENCODED_STR_NEW(at, length);
rb_funcall(listener, rb_intern(attr_type), 2, val, INT2FIX(line));
}
-
static void
-store_pystring_content(VALUE listener,
+store_docstring_content(VALUE listener,
int start_col,
+ const char *type_at, size_t type_length,
const char *at, size_t length,
int current_line)
{
VALUE re2;
VALUE unescape_escaped_quotes;
VALUE con = ENCODED_STR_NEW(at, length);
+ VALUE con_type = ENCODED_STR_NEW(type_at, type_length);
unindent(con, start_col);
re2 = rb_reg_regcomp(rb_str_new2("\r\\Z"));
unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\""));
rb_funcall(con, rb_intern("sub!"), 2, re2, rb_str_new2(""));
+ rb_funcall(con_type, rb_intern("strip!"), 0);
rb_funcall(con, rb_intern("gsub!"), 2, unescape_escaped_quotes, rb_str_new2("\"\"\""));
- rb_funcall(listener, rb_intern("doc_string"), 2, con, INT2FIX(current_line));
+ rb_funcall(listener, rb_intern("doc_string"), 3, con_type, con, INT2FIX(current_line));
}
-
static void
raise_lexer_error(const char * at, int line)
{
@@ -341,6 +354,8 @@ static void lexer_init(lexer_state *lexer) {
lexer->content_start = 0;
lexer->content_end = 0;
lexer->content_len = 0;
+ lexer->docstring_content_type_start = 0;
+ lexer->docstring_content_type_end = 0;
lexer->mark = 0;
lexer->keyword_start = 0;
lexer->keyword_end = 0;
19 ragel/lexer.java.rl.erb
View
@@ -21,18 +21,27 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
}
}
- action start_pystring {
+ action start_docstring {
currentLine = lineNumber;
startCol = p - lastNewline;
}
- action begin_pystring_content {
+ action begin_docstring_content {
contentStart = p;
}
- action store_pystring_content {
+ action start_docstring_content_type {
+ docstringContentTypeStart = p;
+ }
+
+ action end_docstring_content_type {
+ docstringContentTypeEnd = p;
+ }
+
+ action store_docstring_content {
String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replaceAll("\\\\\"\\\\\"\\\\\"", "\"\"\""));
- listener.docString(con, currentLine);
+ String conType = substring(data, docstringContentTypeStart, docstringContentTypeEnd).trim();
+ listener.docString(conType, con, currentLine);
}
action store_feature_content {
@@ -164,6 +173,8 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
int contentStart = -1;
int currentLine = -1;
+ int docstringContentTypeStart = -1;
+ int docstringContentTypeEnd = -1;
int startCol = -1;
int nextKeywordStart = -1;
int keywordStart = -1;
17 ragel/lexer.js.rl.erb
View
@@ -9,21 +9,30 @@
this.start_col = p - this.last_newline - (this.keyword+':').length;
}
- action start_pystring {
+ action start_docstring {
this.current_line = this.line_number;
this.start_col = p - this.last_newline;
}
- action begin_pystring_content {
+ action begin_docstring_content {
this.content_start = p;
}
- action store_pystring_content {
+ action start_docstring_content_type {
+ this.docstring_content_type_start = p;
+ }
+
+ action end_docstring_content_type {
+ this.docstring_content_type_end = p;
+ }
+
+ action store_docstring_content {
var con = this.unindent(
this.start_col,
this.bytesToString(data.slice(this.content_start, this.next_keyword_start-1)).replace(/(\r?\n)?([\t ])*$/, '').replace(/ESCAPED_TRIPLE_QUOTE/mg, '"""')
);
- this.listener.doc_string(con, this.current_line);
+ var con_type = this.bytesToString(data.slice(this.docstring_content_type_start, this.docstring_content_type_end)).trim();
+ this.listener.doc_string(con_type, con, this.current_line);
}
action store_feature_content {
17 ragel/lexer.rb.rl.erb
View
@@ -12,20 +12,27 @@ module Gherkin
@start_col = p - @last_newline - "#{@keyword}:".length
}
- action start_pystring {
+ action start_docstring {
@current_line = @line_number
@start_col = p - @last_newline
}
- action begin_pystring_content {
+ action begin_docstring_content {
@content_start = p
}
- action store_pystring_content {
+ action start_docstring_content_type {
+ @docstring_content_type_start = p
+ }
+ action end_docstring_content_type {
+ @docstring_content_type_end = p
+ }
+
+ action store_docstring_content {
con = unindent(@start_col, utf8_pack(data[@content_start...@next_keyword_start-1]).sub(/(\r?\n)?([\t ])*\Z/, '').gsub(/\\"\\"\\"/, '"""'))
- @listener.doc_string(con, @current_line)
+ con_type = utf8_pack(data[@docstring_content_type_start...@docstring_content_type_end]).strip
+ @listener.doc_string(con_type, con, @current_line)
}
-
action store_feature_content {
p = store_keyword_content(:feature, data, p, eof)
}
8 ragel/lexer_common.rl.erb
View
@@ -40,11 +40,11 @@
RowBody = space* Cell** PIPE :>> (space* EOL+ space*) %store_row;
Row = StartRow :>> RowBody <: EndRow?;
- StartDocString = '"""' >start_pystring space* :>> EOL;
- EndDocString = (space* '"""') >next_keyword_start;
- DocString = space* StartDocString %begin_pystring_content (^EOL | EOL)* :>> EndDocString %store_pystring_content space* EOL+;
+ StartDocString = '"""' >start_docstring ^EOL* >start_docstring_content_type %end_docstring_content_type :>> EOL;
+ EndDocString = (space* '"""') >next_keyword_start;
+ DocString = space* StartDocString %begin_docstring_content (^EOL | EOL)* :>> EndDocString %store_docstring_content space* EOL+;
- Tokens = BOM? (space | EOL)* (Tags | Comment | FeatureHeading | BackgroundHeading | ScenarioHeading | ScenarioOutlineHeading | ExamplesHeading | Step | Row | DocString)* (space | EOL)* EOF;
+ Tokens = BOM? (space | EOL)* (Tags | Comment | FeatureHeading | BackgroundHeading | ScenarioHeading | ScenarioOutlineHeading | ExamplesHeading | Step | Row | DocString )* (space | EOL)* EOF;
main := Tokens %end_feature @!end_feature;
}%%
1  spec/gherkin/fixtures/complex.json
View
@@ -130,6 +130,7 @@
"keyword": "Given ",
"multiline_arg": {
"type": "doc_string",
+ "content_type": "text",
"value": "Makes Homer something something\nAnd something else",
"line": 777
}
40 spec/gherkin/shared/doc_string_group.rb
View
@@ -23,17 +23,17 @@ def ps(content)
"""
Then bar
EOS
- @listener.should_receive(:doc_string).with(" Hello\nGoodbye", 4)
+ @listener.should_receive(:doc_string).with('', " Hello\nGoodbye", 4)
scan(str)
end
it "should parse a simple doc_string" do
- @listener.should_receive(:doc_string).with("I am a doc_string", 1)
+ @listener.should_receive(:doc_string).with('', "I am a doc_string", 1)
scan ps("I am a doc_string")
end
it "should parse an empty doc_string" do
- @listener.should_receive(:doc_string).with("", 4)
+ @listener.should_receive(:doc_string).with('', '', 4)
scan("Feature: Hi\nScenario: Hi\nGiven a step\n\"\"\"\n\"\"\"")
end
@@ -45,25 +45,25 @@ def ps(content)
"""
EOS
- @listener.should_receive(:doc_string).with("\n\n", 1)
+ @listener.should_receive(:doc_string).with('', "\n\n", 1)
scan(doc_string)
end
it "should parse content separated by two newlines" do
scan ps("A\n\nB")
@listener.to_sexp.should == [
- [:doc_string, "A\n\nB", 1],
+ [:doc_string, '', "A\n\nB", 1],
[:eof]
]
end
it "should parse a multiline string" do
- @listener.should_receive(:doc_string).with("A\nB\nC\nD", 1)
+ @listener.should_receive(:doc_string).with('', "A\nB\nC\nD", 1)
scan ps("A\nB\nC\nD")
end
it "should ignore unescaped quotes inside the string delimeters" do
- @listener.should_receive(:doc_string).with("What does \"this\" mean?", 1)
+ @listener.should_receive(:doc_string).with('', "What does \"this\" mean?", 1)
scan ps('What does "this" mean?')
end
@@ -74,12 +74,12 @@ def ps(content)
Line two
"""
EOS
- @listener.should_receive(:doc_string).with(" Line one\nLine two", 1)
+ @listener.should_receive(:doc_string).with('', " Line one\nLine two", 1)
scan(str)
end
it "should preserve tabs within the content" do
- @listener.should_receive(:doc_string).with("I have\tsome tabs\nInside\t\tthe content", 1)
+ @listener.should_receive(:doc_string).with('', "I have\tsome tabs\nInside\t\tthe content", 1)
scan ps("I have\tsome tabs\nInside\t\tthe content")
end
@@ -98,7 +98,7 @@ def ps(content)
EOS
- @listener.should_receive(:doc_string).with(doc_string, 1)
+ @listener.should_receive(:doc_string).with('', doc_string, 1)
scan ps(doc_string)
end
@@ -108,7 +108,7 @@ def ps(content)
Line one
"""
EOS
- @listener.should_receive(:doc_string).with(" Line one", 1)
+ @listener.should_receive(:doc_string).with('', " Line one", 1)
scan(str)
end
@@ -120,12 +120,12 @@ def ps(content)
"""
EOS
- @listener.should_receive(:doc_string).with("DocString text\n\n",1)
+ @listener.should_receive(:doc_string).with('', "DocString text\n\n", 1)
scan(str)
end
it "should preserve CRLFs within doc_strings" do
- @listener.should_receive(:doc_string).with("Line one\r\nLine two\r\n", 1)
+ @listener.should_receive(:doc_string).with('', "Line one\r\nLine two\r\n", 1)
scan("\"\"\"\r\nLine one\r\nLine two\r\n\r\n\"\"\"")
end
@@ -135,7 +135,7 @@ def ps(content)
\\"\\"\\"
"""
EOS
- @listener.should_receive(:doc_string).with('"""', 1)
+ @listener.should_receive(:doc_string).with('', '"""', 1)
scan(str)
end
@@ -145,7 +145,17 @@ def ps(content)
\\" \\"\\"
"""
EOS
- @listener.should_receive(:doc_string).with('\" \"\"', 1)
+ @listener.should_receive(:doc_string).with('', '\" \"\"', 1)
+ scan(str)
+ end
+
+ it "should lex doc_string content_types" do
+str = <<EOS
+ """gherkin type
+ Feature: Doc String Types
+ """
+EOS
+ @listener.should_receive(:doc_string).with('gherkin type', 'Feature: Doc String Types', 1)
scan(str)
end
end
6 spec/gherkin/shared/lexer_group.rb
View
@@ -286,7 +286,7 @@ def scan(gherkin)
scan("Given I have a string\n\"\"\"\nhello\nworld\n\"\"\"")
@listener.to_sexp.should == [
[:step, "Given ", "I have a string", 1],
- [:doc_string, "hello\nworld", 2],
+ [:doc_string, '', "hello\nworld", 2],
[:eof]
]
end
@@ -497,7 +497,7 @@ def scan(gherkin)
[:step, "Then ", "I am happy", 37],
[:scenario, "Scenario", "Hammerzeit", "", 39],
[:step, "Given ", "All work and no play", 40],
- [:doc_string, "Makes Homer something something\nAnd something else", 41 ],
+ [:doc_string, '', "Makes Homer something something\nAnd something else", 41 ],
[:step, "Then ", "crazy", 45],
[:eof]
]
@@ -540,7 +540,7 @@ def scan(gherkin)
[:step, "Then ", "I am happy", 37],
[:scenario, "Scenario", "Hammerzeit", "", 39],
[:step, "Given ", "All work and no play", 40],
- [:doc_string, "Makes Homer something something\r\nAnd something else", 41],
+ [:doc_string, '', "Makes Homer something something\r\nAnd something else", 41],
[:step, "Then ", "crazy", 45],
[:eof]
]
2  tasks/cucumber.rake
View
@@ -1,4 +1,4 @@
-unless ENV['RUBY_CC_VERSION'] || defined?(JRUBY_VERSION)
+unless ENV['RUBY_CC_VERSION']
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:cucumber) do |t|
2  tasks/release.rake
View
@@ -45,6 +45,6 @@ namespace :release do
task :symlink_docs do
sh("ssh cukes.info 'cd /var/www/gherkin/api/ruby && mkdir #{GHERKIN_VERSION} && tar xzf api-#{GHERKIN_VERSION}.tgz -C #{GHERKIN_VERSION} && rm -f latest && ln -s #{GHERKIN_VERSION} latest'")
- sh("ssh cukes.info 'cd /var/www/gherkin/api/ruby && rm -f latest && ln -s #{GHERKIN_VERSION} latest'")
+ sh("ssh cukes.info 'cd /var/www/gherkin/api/java && rm -f latest && ln -s #{GHERKIN_VERSION} latest'")
end
end

No commit comments for this range

Something went wrong with that request. Please try again.