{"size": 650, "ext": "js", "max_stars_repo_path": "test/js/haml/parser.test.js", "max_stars_repo_name": "thorn0/plugin-ruby", "max_stars_repo_stars_event_min_datetime": "2020-05-18T05:52:44.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-20T01:24:42.000Z", "max_issues_repo_path": "test/js/haml/parser.test.js", "max_issues_repo_name": "thorn0/plugin-ruby", "max_issues_repo_issues_event_min_datetime": "2021-02-23T07:07:18.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T11:08:38.000Z", "max_forks_repo_path": "test/js/haml/parser.test.js", "max_forks_repo_name": "thorn0/plugin-ruby", "max_forks_repo_forks_event_min_datetime": "2020-07-24T16:48:15.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-24T16:48:15.000Z"}
{"max_stars_count": 2, "max_issues_count": 63, "max_forks_count": 1, "avg_line_length": 19.696969697, "max_line_length": 62, "alphanum_fraction": 0.5323076923}
const {
  parse,
  hasPragma,
  locStart,
  locEnd
} = require("../../../src/haml/parser");

describe("parser", () => {
  test("parse", () => {
    expect(parse("= foo").type).toEqual("root");
  });

  test("parse failure", () => {
    expect(() => parse(`%div("invalid ": 1)`)).toThrowError();
  });

  test("hasPragma", () => {
    const withPragma = "-# @prettier";
    const withoutPragma = "-# foo";

    expect(hasPragma(withPragma)).toBe(true);
    expect(hasPragma(withoutPragma)).toBe(false);
  });

  test("locStart", () => {
    expect(locStart({})).toEqual(0);
  });

  test("locEnd", () => {
    expect(locEnd({})).toEqual(0);
  });
});
