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

casbin / lua-casbin / 9877390634
88%

Build:
DEFAULT BRANCH: master
Ran 10 Jul 2024 03:49PM UTC
Jobs 5
Files 27
Run time 1min
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.631% (+0.2%) from 87.406%
9877390634

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() )

2012 of 2296 relevant lines covered (87.63%)

991.25 hits per line

Jobs
ID Job ID Ran Files Coverage
1 9877390634.1 10 Jul 2024 03:49PM UTC 27
87.55
GitHub Action Run
2 9877390634.2 10 Jul 2024 03:49PM UTC 27
87.55
GitHub Action Run
3 9877390634.3 10 Jul 2024 03:49PM UTC 27
87.63
GitHub Action Run
4 9877390634.4 10 Jul 2024 03:49PM UTC 27
87.51
GitHub Action Run
5 9877390634.5 10 Jul 2024 03:50PM UTC 27
87.63
GitHub Action Run
Source Files on build 9877390634
  • Tree
  • List 27
  • Changed 19
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • f40b2eab on github
  • Prev Build on master (#5793618921)
  • Next Build on master (#11976548761)
  • 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

© 2025 Coveralls, Inc