anusii / rdflib

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

RDFLib: complete the terminal/combinator parsers for turtle grammar and have them all tested #14

Closed tian3rd closed 1 year ago

tian3rd commented 1 year ago

The next step is to integrate the parsers into the more flexible GrammarDefinition classes, and interpret them into triples, prefix namespaces, and finally save all the information in the Graph. Will create another issue for this next step.

tian3rd commented 1 year ago

Update:

Have half of the rules tested in the test files. Will finish the rest rules and test cases today.

tian3rd commented 1 year ago

Update:

Have all the grammar rules tested, and refactored in the test folder. Check https://github.com/anusii/rdflib/tree/main/test/parser/single_grammar for more details.

Have finished the two tasks in closing criteria.

gjwgit commented 1 year ago

Thanks @tian3rd. How do I run the test suite?

tian3rd commented 1 year ago

Thanks @tian3rd. How do I run the test suite?

Hi @gjwgit you can test it with dart test in the project root folder.

Or if you just want to test one single file, dart test test/parser/single_grammar/\[4\]prefixID_test.dart for example

Right now, for quickly verifying the issues, I still use print in the dart test files so I can see the output in the command line.

tian3rd commented 1 year ago

Found a way to test the code coverage for the tests (https://pub.dev/packages/test#collecting-code-coverage):

## Run Dart tests and output them at directory `./coverage`:
dart run test --coverage=./coverage

## Activate package `coverage` (if needed):
dart pub global activate coverage

## Format collected coverage to LCOV (only for directory "lib")
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o ./coverage/lcov.info -i ./coverage

## Generate LCOV report:
genhtml -o ./coverage/report ./coverage/lcov.info

## Open the HTML coverage report:
open ./coverage/report/index.html
tian3rd commented 1 year ago

Since the petitparser package is mainly used for the parsing, there's few customized functions or methods to be tested, so this coverage report only offers limited view of code coverage. But I plan to write tests for the Graph, Triple and other classes, so there will be more customized functions to give more details in the report.

Current coverage report:

Image

gjwgit commented 1 year ago
$ dart test

[...]

00:03 +725: All tests passed!                                                                                                                                              
$ dart run test --coverage=./coverage

[...]

00:32 +725: All tests passed!

... so we can close this now? Thanks.

tian3rd commented 1 year ago

Yes, it can be closed @gjwgit