Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some failing test cases from toml-test #87

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

arp242
Copy link
Contributor

@arp242 arp242 commented Oct 1, 2023

These are a few issues I found investigating failing test cases from toml-test, most are fairly simple low-handing fruit. There's still a few others that fail, but this already improves things.

Instead of sending 8 different pull requests it seemed easier to batch them in one; see the commit messages for more detailed explanations on the issues.

make check will now all run all the tests (unittest + stdex tests + toml-test), and will skip toml-test tests known to fail. Can also add GitHub action for this if you want.

toml.c Outdated
int v = ('0' <= ch && ch <= '9')
? ch - '0'
: (('A' <= ch && ch <= 'F') ? ch - 'A' + 10 : -1);
int v = -1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe easier to do a ch=toupper(ch) and keep the original code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe; I changed it!

arp242 added 8 commits October 8, 2023 04:17
The ABNF has:

	HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"

But ABNF is case-insensitive by default, so \u007f should be identical
to \u007F.
TOML spec says:

	Any Unicode character may be escaped with the `\xHH`, `\uHHHH`,
	or `\UHHHHHHHH` forms. The escape codes must be Unicode scalar
	values.

Scalar value is defined by Unicode as:

	Any Unicode code point except high-surrogate and low-surrogate
	code points. In other words, the ranges of integers 0 to D7FF
	and E000 to 10FFFF inclusive. (See definition D76 in Section
	3.9, Unicode Encoding Forms.)

Whether it makes sense is another thing, but these values should be
allowed.
Use \uXXXX escape sequences, instead of literal control characters.
e.g. day "0", hour "25", etc.

Makes a number of toml-test tests pass.
Only lower-case is allowed, and without any underscores. Previously it
would accept e.g.:

	INF
	i_nf
Previously it would accept these as valid:

	1e_23
	1_e2
	1.2_e2
The following would be accepted as valid:

	0x       0b 0    o
	-0b110   -0xff   0o77
	+0b110   +0xff   +0o77
	0b_1     0x_1    0o_1
Explicitly list the toml-test files we know to fail, so it's easier to
test for regressions and the like on changes. Can also add GitHub
actions if you want.

The stdex/float6 test was already failing on master.

"make check" will run all the tests (closes cktan#83).

Also remove the https://github.com/cktan/toml-spec-tests, based on
@iarna/toml. These are no longer maintained, and toml-lang/toml-test
contains everything that's in there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants