Commit graph

9 commits

Author SHA1 Message Date
da408b9e67 This fixes the file parsing (again)
Unfortunately, our latest fix to file parsing did not solve all issues.
So we have to fix it _again_.

The problem was the `std::str::Lines` iterator, which apparently fails
this:

    assert_eq!(1, "".lines().count());

as an empty line seems not to be a line.

Because of that, when reading a file with an empty line at its bottom
got stripped off that line.

This patch removes the use of the `lines()` iterator and uses
`split("\n")` instead. This only works on Unix operating systems, but as
we only target unix operating systems with imag, this is not considered
an issue right now.

This patch also adds extensive tests on multiple levels in the
`libimagstore` implementation:

* On the parsing level, for the function which implements the parsing
* On the filesystem abstraction levels
* On the `Store` levels

to make sure that everything is parsed correctly.
2018-03-10 14:53:15 +01:00
ee5a17790f Fix multi-line reading
Reading entries with multiple entries caused all lines to be read as one
line.

This bug is fixed with this patch.
2018-03-02 21:48:17 +01:00
9fb5f453fe Rewrite entry parsing algorithm
Rewrite without regex crate.

The regex approach was broken. If the following _content_ was provided
in the entry:

    foo

    ---

    bar

The regex approach parsed the header until the "---" in the content.
This is, of course, not the way to do that.

Now, the parsing is implemented by hand. Should be faster as well,
though I don't care about this.

This fixes a severe bug.
2018-02-20 21:06:36 +01:00
d5a9e4930d Update dates in license header
And add missing header in one file
2018-02-07 02:48:53 +01:00
77f93e77f0 Fix syntax 2017-11-18 12:28:20 +01:00
5d76e7bafa Use ? operator instead of try!() macro 2017-10-31 15:03:30 +01:00
2df99524e7 libimagstore: rewrite error handling code 2017-09-03 21:33:54 +02:00
43ca0b43b1 Move "Header" trait for toml::Value to store module 2017-08-28 12:22:13 +02:00
59a3662ac4 Reorganize code in subdirs 2017-08-27 15:12:09 +02:00
Renamed from libimagstore/src/util.rs (Browse further)