New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gherkin Loader special chars in values #3676

Closed
gimler opened this Issue Nov 2, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@gimler
Contributor

gimler commented Nov 2, 2016

What are you trying to achieve?

I must use " in my value. But the Gherkin Loader doesn't allow this.

What do you get instead?

php codecept run tests/unit/Codeception/Test/GherkinTest.php 
Codeception PHP Testing Framework v2.2.4
Powered by PHPUnit 5.6.2 by Sebastian Bergmann and contributors.

Unit Tests (7) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
✔ GherkinTest: Load gherkin (0.01s)
✔ GherkinTest: Load with contexts (0.01s)
✔ GherkinTest: Similar steps (0.00s)
✔ GherkinTest: Tags (0.00s)
✔ GherkinTest: Matching patterns (0.00s)
✔ GherkinTest: Roles (0.00s)
✖ GherkinTest: Matching escaped patterns (0.00s)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Time: 89 ms, Memory: 8.00MB

There was 1 failure:

---------
1) GherkinTest: Matching escaped patterns
 Test  tests/unit/Codeception/Test/GherkinTest.php:testMatchingEscapedPatterns
Failed asserting that 'use password "fref\"fr"' matches PCRE pattern "/^use password (?|\"([^"]*?)\"|(\d+))$/".
#1  /home/gfranke/Codeception/tests/unit/Codeception/Test/GherkinTest.php:132
#2  GherkinTest->testMatchingEscapedPatterns
#3  /home/gfranke/Codeception/codecept:33

FAILURES!
Tests: 7, Assertions: 14, Failures: 1.
diff --git a/tests/unit/Codeception/Test/GherkinTest.php b/tests/unit/Codeception/Test/GherkinTest.php
index 6c19092..f7a545e 100644
--- a/tests/unit/Codeception/Test/GherkinTest.php
+++ b/tests/unit/Codeception/Test/GherkinTest.php
@@ -125,6 +125,13 @@ public function testMatchingPatterns()
         $this->assertRegExp($regex, 'there should be 1000 cows');
     }
 
+    public function testMatchingEscapedPatterns()
+    {
+        $pattern = 'use password ":pass"';
+        $regex = $this->loader->makePlaceholderPattern($pattern);
+        $this->assertRegExp($regex, 'use password "fref\"fr"');
+    }
+
     /**
      * @Issue #3051
      */

Details

  • Codeception version: 2.2.6
  • PHP Version: 7.0.9
  • Operating System: linux
  • Installation type: Composer
@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Nov 2, 2016

Member

Thanks for the test!

Member

DavertMik commented Nov 2, 2016

Thanks for the test!

DavertMik added a commit that referenced this issue Nov 30, 2016

@DavertMik DavertMik closed this in #3792 Dec 2, 2016

DavertMik added a commit that referenced this issue Dec 2, 2016

Better matching for escaped strings in gherkin patterns (#3792)
* fixed #3676, better matching for escaped strings in gherkin patterns

* fixed pattern, and added few more comments to it

* fixed Gherkin test regex test

chris1312 added a commit to chris1312/Codeception that referenced this issue Jun 16, 2017

Better matching for escaped strings in gherkin patterns (#3792)
* fixed #3676, better matching for escaped strings in gherkin patterns

* fixed pattern, and added few more comments to it

* fixed Gherkin test regex test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment