Giter Site home page Giter Site logo

Comments (3)

ingydotnet avatar ingydotnet commented on June 5, 2024

As I mentioned in the #20 review, in-json was not meant to be a raw expected result string (that would be called out-json), but rather a loaded JSON input that would be compared either in memory or by a reserialization into any mature/trusted format.

That said, I support the change if it helps people use the data in other useful ways and does not break any existing testing.

from yaml-test-suite.

perlpunk avatar perlpunk commented on June 5, 2024
  • Why should this change break any existing testing? I will let the test matrix run before merging it to master
  • if we generate in.json half-automatically, a canonical format will guarantee that we only get diffs for real changes

from yaml-test-suite.

eemeli avatar eemeli commented on June 5, 2024

With the changes brought in by PR #20, the in.json files representing streams with multiple documents can no longer be easily parsed in a JS environment. In fact jq might be one of the only tools that can parse their format without complaint.

As is, the files are pretty close to line-delimited JSON, for which tools do exist. Therefore, would it be possible to add a step that would use something like jq -c in their generation?

I encountered this problem while updating the tests of my JS YAML library, which can in fact read the in.json format, but complains about it:

import fs from 'fs'
import YAML from 'yaml'
const src = fs.readFileSync('./U9NS/in.json', 'utf8')
const doc = YAML.parseDocuments(src)[0]

doc.errors
// [ [YAMLSyntaxError: Document is not valid YAML (bad indentation?)] ]

doc.contents[0].toJSON()
// { time: '20:03:20',
//   player: 'Sammy Sosa',
//   action: 'strike (miss)' }

doc.contents[1].toJSON()
// { time: '20:03:47',
//   player: 'Sammy Sosa',
//   action: 'grand slam' }

from yaml-test-suite.

Related Issues (20)

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.