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

Build CommonMark test bed #1159

Closed
joshbruce opened this issue Mar 24, 2018 · 1 comment
Closed

Build CommonMark test bed #1159

joshbruce opened this issue Mar 24, 2018 · 1 comment

Comments

@joshbruce
Copy link
Member

joshbruce commented Mar 24, 2018

Marked version: 0.3.18

Markdown flavor: CommonMark

Proposal type: other

What pain point are you perceiving?

Our current test bed does not reflect the specifications in their entirety. Creating one test at a time is not a viable way forward (see #1124 & #1129).

Other resources:

http://spec.commonmark.org/0.28/spec.json
Feder1co5oave@ec2e873
https://github.com/Feder1co5oave/marktex/blob/0e2b3eea3ec8013377e6fc4ea3d72624ad1c40c2/test/index.js

What solution are you suggesting?

Use the spec JSON to generate test files. Thinking the following makes the most sense for readability and whatnot.

Template:

// [flavor short name]_[section].js
it('should pass [flavor short name] example [example number]', function() {
  var result = marked([spec markdown]);
  var expected = [spec html];

  expected(result).toBe(expected);
}

Live example:

// cm_list_items.js
it('should pass cm example 230', function () {
  var result = marked(0. ok\n);
  var expected = '<ol start=\"0\">\n<li>ok</li>\n</ol>\n';

  expected(result).toBe(expected);
}

it('should pass cm example 234', function () {
  var result = marked('  10.  foo\n\n           bar\n');
  var expected = '<ol start=\"10\">\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n</li>\n</ol>\n';

  expected(result).toBe(expected);
}
@joshbruce
Copy link
Member Author

Why one complete test case per example?

Allows for marking individual examples as "not gonna do it" or "this one doesn't work" - just comment out the test and make a note re status.

@joshbruce joshbruce mentioned this issue Mar 24, 2018
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant