<commit_before>var testCase = require('nodeunit').testCase,
  swig = require('../../index');

exports.parent = testCase({
  setUp: function (callback) {
    swig.init({
      allowErrors: true
    });
    callback();
  },

  'basic': function (test) {
    swig.compile('{% block foo %}hi{% endblock %}', { filename: 'parent' });
    var tpl = swig.compile('{% extends "parent" %}{% block foo %}{% if true %}{% parent %}{% else %}nope{% endif %}{% endblock %}');
    test.strictEqual(tpl(), 'hi');
    test.done();
  },

  'multiple block parents': function (test) {
    swig.compile('{% block foo %}hi{% endblock %}{% block bar %}bye{% endblock %}', { filename: 'parent' });
    var tpl = swig.compile('{% extends "parent" %}{% block foo %}{% parent %}{% endblock %}{% block bar %}{% parent %}{% endblock %}');
    test.strictEqual(tpl(), 'hibye');
    test.done();
  }
});<commit_msg>convert parent test to mocha<commit_after>var swig = require('../../index');

describe('Tag: parent', function () {
  beforeEach(function () {
    swig.init({ allowErrors: true });
  });

  it('prints the contents from the parent template block of the same name', function () {
    swig.compile('{% block foo %}hi{% endblock %}', { filename: 'parent' });
    swig.compile('{% extends "parent" %}{% block foo %}{% if true %}{% parent %}{% else %}nope{% endif %}{% endblock %}')()
      .should.equal('hi');
  });

  it('references the correct block', function () {
    swig.compile('{% block foo %}hi{% endblock %}{% block bar %}bye{% endblock %}', { filename: 'parent' });
    swig.compile('{% extends "parent" %}{% block foo %}{% parent %}{% endblock %}{% block bar %}{% parent %}{% endblock %}')()
      .should.equal('hibye');
  });

});
{'fraction_non_alphanumeric': 0.23420289855072463, 'fraction_numerical': 0.0, 'mean_word_length': 3.781163434903047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2191037', 'n_tokens_mistral': 586, 'n_tokens_neox': 553, 'n_words': 148}