Skip to content
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

When first field is missing, whole pattern fails to match #72

Open
yaauie opened this issue Apr 9, 2020 · 0 comments
Open

When first field is missing, whole pattern fails to match #72

yaauie opened this issue Apr 9, 2020 · 0 comments

Comments

@yaauie
Copy link
Contributor

yaauie commented Apr 9, 2020

When the first field in a pattern is missing from an input (e.g., the input begins with the delimiter that is meant to follow the first field), the entire input is captured to the last field in the pattern:

pattern: %{f1};%{f2};%{f3};%{f4}
input: ;;3;4
expect: {"f1":"", "f2":"", "f3":"3", "f4":"4"}
actual: {"f1":"", "f2":"", "f3":"", "f4":";;3;4"}

Below is an additonal test-case to add to the compatibility suite:

diff --git a/spec/fixtures/dissect_tests.json b/spec/fixtures/dissect_tests.json
index 1549946..403c95b 100644
--- a/spec/fixtures/dissect_tests.json
+++ b/spec/fixtures/dissect_tests.json
@@ -132,6 +132,18 @@
     },
     "skip": false
   },
+  {
+    "name": "missing field at beginning",
+    "tok": "%{f1};%{f2};%{f3};%{f4}",
+    "msg": ";;3;4",
+    "expected": {
+      "f1": "",
+      "f2": "",
+      "f3": "3",
+      "f4": "4"
+    },
+    "skip": false
+  },
   {
     "name": "ignore right padding",
     "tok": "%{id} %{function-\u003e} %{server}",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant