Comments (3)
Example: https://github.com/newsdev/archieml-js/blob/inline-comments/test/parse-documents-test.js
This vows test checks for *.aml
files in /test/test-documents/
, parses them and compares the output to the corresponding json
file.
https://github.com/newsdev/archieml-js/tree/inline-comments/test/test-documents
from archieml-js.
sorry for mixing this into the inline-comments branch, btw
from archieml-js.
Hi @gka - I'm realizing now that the README was missing a step for the existing test suite: there are a series of shared tests available to all parsers in the newsdev/archieml.org repository, but since they're included as a submodule, you have to run git submodule update --init
in order to download them, and then nodeunit
to run them:
$ git submodule update --init
Submodule 'test/archieml.org' (https://github.com/newsdev/archieml.org) registered for path 'test/archieml.org'
Cloning into 'test/archieml.org'...
remote: Counting objects: 480, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 480 (delta 0), reused 0 (delta 0), pack-reused 477
Receiving objects: 100% (480/480), 331.45 KiB | 0 bytes/s, done.
Resolving deltas: 100% (171/171), done.
Checking connectivity... done.
Submodule path 'test/archieml.org': checked out 'b2e516d590097f18c693d775edcbc1ebbef6111b'
$ nodeunit
loader
✔ loaderTests
shared
✔ sharedTests
OK: 170 assertions (95ms)
That shared test model obviously has some disadvantages though, since it requires A) git submodules, and B) the way that the source AML and expected JSON output are included in the same file is unfamiliar to everyone but me at 2 a.m.:
Example test
test: [array] creates an empty array at array
result: {"array": []}
[array]
The shared.js
test runner strips out the first two lines, then checks that the rest of the document gets parsed as {"array": []}
: https://github.com/newsdev/archieml-js/blob/inline-comments/test/shared.js#L49-L56
I kind of liked how that kept the source and expected output within the same file (just for ease of editing), but maybe it's worth splitting them into separate files like you had if that's a more familiar pattern to others?
We can also get rid of the submodule and check the tests directly into the app so it's more straightforward to run + edit, but if so we should find another way to keep the tests in sync?
from archieml-js.
Related Issues (20)
- Only one line in a multi-line string can be escaped; multiple should be possible
- Since commit a89c313... objects no longer "close" as they used to
- Is there a json to AML method? HOT 1
- Document crashes JS parser (but works in Ruby) HOT 3
- Support JSON-LD HOT 2
- Freeforms shouldn't require trailing newlines to pick up last line of text
- Support for numbers
- Exclude unnecessary files from production installs
- Sandbox doesn't escape output
- Converting JSON to ArchieML HOT 1
- Google autoformatting tends to break arrays of strings
- Cut npm release of v0.5.0? HOT 1
- 'Using with Google Documents' instructions, error
- Add SECURITY.md
- Multi-line values are created when they shouldn't be HOT 3
- In-line JSON parsing HOT 1
- Arrays should override strings that already exist at a key HOT 1
- Nested array string values don't overwrite nested key/value pairs created by scoped arrays HOT 3
- Make inline comments configurable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from archieml-js.