anusii / rdflib

A pure Dart package for working with RDF (resource description framework).
https://pub.dev/packages/rdflib
GNU General Public License v3.0
13 stars 3 forks source link

RDFLib: Create test files for terminal and combinator parsers using `petitparser` #11

Closed tian3rd closed 1 year ago

tian3rd commented 1 year ago

petitparser package provides readily made terminal parsers such as letter(), digit(), string() that can be used to parse simple snippets. To take a step further, we can also combine parsers together to get more complicated functions such as chaining parsers, specifying the repeated time a pattern should occur in a string, etc.

For starters, refer to #625 for the tasks of parsing IRIREF and PN_CHARS_U, and use combinator parsers to parse different strings.

tian3rd commented 1 year ago

Closing criteria:

tian3rd commented 1 year ago

A better way to test different grammar rules is to write separate test cases in test files under the test folder in the package. Refer to the test package to get started: https://pub.dev/packages/test

tian3rd commented 1 year ago

Tests are here: https://github.com/anusii/rdflib/blob/main/test/naive_parser_test.dart All test cases are passed. (Have also set up GitHub actions to run the tests in the test folder: https://github.com/anusii/rdflib/issues/12, and can check the status of tests here: https://github.com/anusii/rdflib/actions/runs/3571656282/jobs/6003731947)

tian3rd commented 1 year ago

Closing criteria is met.

I plan to finish the rest of the tests for the grammar (all of the turtle rules) by the end of this week.