ZHaskell / JSONTestSuite

A comprehensive test suite for RFC 8259 compliant JSON parsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON Parsing Test Suite

A comprehensive test suite for RFC 8259 compliant JSON parsers

This repository was created as an appendix to the article Parsing JSON is a Minefield 💣.

/parsers/

This directory contains several parsers and tiny wrappers to turn the parsers into JSON validators, by returning a specific value.

  • 0 the parser did accept the content
  • 1 the parser did reject the content
  • >1 the process did crash
  • timeout happens after 5 seconds

/test_parsing/

The name of these files tell if their contents should be accepted or rejected.

  • y_ content must be accepted by parsers
  • n_ content must be rejected by parsers
  • i_ parsers are free to accept or reject content

/test_transform/

These files contain weird structures and characters that parsers may understand differently, eg:

  • huge numbers
  • dictionaries with similar keys
  • NULL characters
  • escaped invalid strings

These files were used to produce results/transform.html.

/run_tests.py

Run all parsers with all files:

$ python3 run_tests.py

Run all parsers with a specific file:

$ python3 run_tests.py file.json

Run specific parsers with all files:

$ echo '["Python 2.7.10", "Python 3.5.2"]' > python_only.json
$ python3 run_tests.py --filter=python_only.json

The script writes logs in results/logs.txt.

The script then reads logs.txt and generates results/parsing.html.

/results/

Some implementations are not installed on my machine, this repo is supposed to test Haskell implementations.

JSON Parsing Tests

About

A comprehensive test suite for RFC 8259 compliant JSON parsers

License:MIT License


Languages

Language:HTML 51.7%Language:C++ 17.0%Language:Swift 15.1%Language:Objective-C 7.5%Language:C 6.8%Language:Lua 0.8%Language:Python 0.5%Language:Java 0.2%Language:Rich Text Format 0.1%Language:Elixir 0.1%Language:Shell 0.1%Language:Perl 0.0%Language:Rust 0.0%Language:Ruby 0.0%Language:Haskell 0.0%Language:C# 0.0%Language:CSS 0.0%Language:PHP 0.0%Language:Go 0.0%Language:Pascal 0.0%Language:Smalltalk 0.0%Language:OCaml 0.0%Language:Crystal 0.0%Language:R 0.0%Language:JavaScript 0.0%Language:Nim 0.0%Language:QMake 0.0%