Coder Social home page Coder Social logo

toml-glib's People

Contributors

elegaanz avatar ryonakano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

toml-glib's Issues

Unable to access nested tables

This example is directly from the toml.io page:

[dog."tater.man"]
type.name = "pug"

But trying to access them with doc["dog"]["tater.man"]["type"]["name"].as<string> () fails with:

[ERROR] Nothing at `dog`.

Here's a simple example for your tests which outputs the error in the log.

diff --git a/tests/toml-glib.vala b/tests/toml-glib.vala
index a5e0491..2c6b8b6 100644
--- a/tests/toml-glib.vala
+++ b/tests/toml-glib.vala
@@ -36,12 +36,16 @@ date-of-birth = 1975-05-07T08:34:45
 
 [hello]
 description = "Something really cool"
+
+[dog."tater.man"]
+type.name = "pug"
 """).parse ();
             var test = Toml.Serialization.deserialize<SerializationTester> (doc);
             assert_true (doc["name"].as<string> () == test.name);
             assert_true (doc["age"].as<int> () == test.age);
             assert_true (doc["date-of-birth"].as<DateTime> () == test.date_of_birth);
             assert_true (doc["hello"]["description"].as<string> () == test.hello.description);
+            assert_true (doc["dog"]["tater.man"]["type"]["name"].as<string> () == "pug");
         } catch (Error err) {
             print ("ERROR: %s\n", err.message);
             Test.fail ();
…
# Start of toml-glib tests
ok 1 /toml-glib/parser
ok 2 /toml-glib/serialize
ERROR: Nothing at `dog`.
not ok 3 /toml-glib/deserialize
# Start of lexer tests
…

Bonus issue:
You're not using your environment variable G_TEST_SRCDIR inside your tests so the tests /toml-glib/parser/file and /toml-glib/parser/whole-spec fail with

[ERROR] Failed to open file ?test.toml?: No such file or directory
not ok 12 /toml-glib/parser/file
[ERROR] Failed to open file ?all.toml?: No such file or directory
not ok 13 /toml-glib/parser/whole-spec

Bonus issue:
With the above file issue fixed I expect all.toml to fail or throw errors because it contains invalid configurations but it doesn't.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.