Skip to content

Build CommonMark test bed #1159

Closed
Closed

Description

@joshbruce

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);
}

Activity

  1. self-assigned this
    on Mar 24, 2018
  2. joshbruce commented on Mar 24, 2018

    @joshbruce
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions