public Feature Parse(TextReader featureFileReader) { var fileContent = featureFileReader.ReadToEnd(); var parser = new PicklesParser(); var listener = new I18nLexer(parser); listener.scan(fileContent); return parser.GetFeature(); }
public void shouldScanUtf8FeatureInFileProperly() { var listener = new Mock<Listener>(); var lexer = new I18nLexer(listener.Object); String feature = FixJava.readResource("NGherkin.Tests.utf8.feature", Assembly.GetExecutingAssembly()); lexer.scan(feature); listener.Verify(x => x.feature("Feature", "ÆØÅ", "", 1)); listener.Verify(x => x.step("When ", "I pøsh <x> onto the stack", 5)); }
public static void Main(string[] args) { try { java.io.Writer output = new TextWriterAdapter(Console.Out); Parser parser = new Parser(new PrettyFormatter(output, true)); Lexer lexer = new I18nLexer(parser); string source = File.OpenText(args[0]).ReadToEnd(); lexer.scan(source); } catch(Exception e) { Console.Error.WriteLine(e.Message); System.Environment.Exit(1); } }
public void shouldScanUtf8FeatureInSourceProperly() { var listener = new Mock<Listener>(); Lexer lexer = new I18nLexer(listener.Object); String feature = "Feature: ÆØÅ\n" + "\n" + " Scenario Outline:\n" + " Given I have an empty stack\n" + " When I pøsh <x> onto the stack"; lexer.scan(feature); listener.Verify(x => x.feature("Feature", "ÆØÅ", "", 1)); listener.Verify(x => x.step("When ", "I pøsh <x> onto the stack", 5)); }
public void shouldScanMultiLineFeature() { var listener = new Mock<Listener>(); Lexer lexer = new I18nLexer(listener.Object); String feature = "" + " Feature: Hello\n" + " Big \n" + " World \n" + " Scenario Outline:\n" + " Given I have an empty stack\n" + " When I pøsh <x> onto the stack"; lexer.scan(feature); listener.Verify(x => x.feature("Feature", "Hello", " Big \r\n World", 1)); listener.Verify(x => x.step("Given ", "I have an empty stack", 5)); listener.Verify(x => x.step("When ", "I pøsh <x> onto the stack", 6)); }