• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

casbin / lua-casbin / 9877390634 / 2
88%
master: 88%

Build:
DEFAULT BRANCH: master
Ran 10 Jul 2024 03:49PM UTC
Files 27
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Jul 2024 03:48PM UTC coverage: 87.549% (+0.3%) from 87.276%
9877390634.2

push

github

web-flow
fix: split function accounting for quotes (#158)

* fix #157: split function accounting for quotes

Added Util.splitCSVLine() function that splits a CSV-formatted string into an array of tokens, accounting for quotes (single and double) and escape characters.

* fix CI warning

Warning: "src/util/Util.lua:263:24: (W311) value assigned to variable sep is unused"

* update split function

- renamed from splitCSVLine to splitEnhanced, since it's not compliant to RFC 4180 and it could be  deceiving;
- added optional parameters;
- now throws error if quotes are not closed;

* update Util.splitEnhanced()

- fixed its behaviour to comply with Casbin documentation (see the note at https://casbin.org/docs/policy-storage#loading-policy-from-a-csv-file and issue 886 at casbin/casbin):
  "If your file contains commas and double quotes, you should enclose the field in double quotes and double any embedded double quotes."

Therefore I removed the extra behaviour related to single quotes ' and escape character \ and refactored the function.

* added example with double quotes

* Unit test for Util.splitEnhanced()

* fixed basic with regex example

* Update basic_policy_with_regex.csv

typo

* Unit test for regexMatch with {N,M} quantifier

* more unit tests for Util.splitEnhanced

- check if the last field is a quoted field
- throwing error when there are extra characters after the double quote that closes the quoted field.

* Update Util.lua

- support for quotes in last field;
- throws an exception if there are other characters after the double quote that closes the quoted field.

* changed "sep" parameter name to "delim"

(uniform to Util.split() )

* changed "line" parameter name to "str"

(uniform to Util.split() )

1997 of 2281 relevant lines covered (87.55%)

194.99 hits per line

Source Files on job 9877390634.2
  • Tree
  • List 27
  • Changed 19
  • Source Changed 0
  • Coverage Changed 13
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 9877390634
  • f40b2eab on github
  • Prev Job for on master (#5793618921.5)
  • Next Job for on master (#11976548761.5)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc