<commit_before>'use strict';

var jade = require('../');
var assert = require('assert');
var fs = require('fs');

var perfTest = fs.readFileSync(__dirname + '/fixtures/perf.jade', 'utf8')

describe('jade', function(){

  describe('.properties', function(){
    it('should have exports', function(){
      assert.equal('object', typeof jade.selfClosing, 'exports.selfClosing missing');
      assert.equal('object', typeof jade.doctypes, 'exports.doctypes missing');
      assert.equal('function', typeof jade.filters, 'exports.filters missing');
      assert.equal('object', typeof jade.utils, 'exports.utils missing');
      assert.equal('function', typeof jade.Compiler, 'exports.Compiler missing');
    });
  });

  describe('.compile()', function(){
    it('should support doctypes', function(){
      assert.equal('<?xml version="1.0" encoding="utf-8" ?>', jade.render('doctype xml'));
      assert.equal('<!DOCTYPE html>', jade.render('doctype html'));
      assert.equal('<!DOCTYPE foo bar baz>', jade.render('doctype foo bar baz'));
      assert.equal('<!DOCTYPE html>', jade.render('doctype html'));
      assert.equal('<!DOCTYPE html>', jade.render('doctype', { doctype:'html' }));
      assert.equal('<!DOCTYPE html>', jade.render('doctype html', { doctype:'xml' }));
      assert.equal('<html></html>', jade.render('html'));
      assert.equal('<!DOCTYPE html><html></html>', jade.render('html', { doctype:'html' }));
      assert.equal('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN>', jade.render('doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN'));
    });

    it('should support Buffers', function(){
      assert.equal('<p>foo</p>', jade.render(new Buffer('p foo')));
    });

    it('should support line endings', function(){
      var str = [
          'p',
          'div',
          'img'
      ].join('\r\n');

      var html = [
          '<p></p>',
          '<div></div>',
          '<img/>'
      ].join('');

      assert.equal(html, jade.render(str));

      var str = [
          'p',
          'div',
          'img'
      ].join('\r');

      var html = [
          '<p></p>',
          '<div></div>',
          '<img/>'
      ].join('');

      assert.equal(html, jade.render(str));

      var str = [
          'p',
          'div',
          'img'
      ].join('\r\n');

      var html = [
          '<p></p>',
          '<div></div>',
          '<img>'
      ].join('');

      assert.equal(html, jade.render(str, { doctype:'html' }));
    });

    it('should support single quotes', function(){
      assert.equal("<p>'foo'</p>", jade.render("p 'foo'"));
      assert.equal("<p>'foo'</p>", jade.render("p\n  | 'foo'"));
      assert.equal('<a href="/foo"></a>', jade.render("- var path = 'foo';\na(href='/' + path)"));
    });

    it('should support block-expansion', function(){
      assert.equal("<li><a>foo</a></li><li><a>bar</a></li><li><a>baz</a></li>", jade.render("li: a foo\nli: a bar\nli: a baz"));
      assert.equal("<li class=\"first\"><a>foo</a></li><li><a>bar</a></li><li><a>baz</a></li>", jade.render("li.first: a foo\nli: a bar\nli: a baz"));
      assert.equal('<div class="foo"><div class="bar">baz</div></div>', jade.render(".foo: .bar baz"));
    });

    it('should support tags', function(){
      var str = [
          'p',
          'div',
          'img'
      ].join('\n');

      var html = [
          '<p></p>',
          '<div></div>',
          '<img/>'
      ].join('');

      assert.equal(html, jade.render(str), 'Test basic tags');
      assert.equal('<fb:foo-bar></fb:foo-bar>', jade.render('fb:foo-bar'), 'Test hyphens');
      assert.equal('<div class="something"></div>', jade.render('div.something'), 'Test classes');
      assert.equal('<div id="something"></div>', jade.render('div#something'), 'Test ids');<commit_msg>New line tests check \n<commit_after>'use strict';

var jade = require('../');
var assert = require('assert');
var fs = require('fs');

var perfTest = fs.readFileSync(__dirname + '/fixtures/perf.jade', 'utf8')

describe('jade', function(){

  describe('.properties', function(){
    it('should have exports', function(){
      assert.equal('object', typeof jade.selfClosing, 'exports.selfClosing missing');
      assert.equal('object', typeof jade.doctypes, 'exports.doctypes missing');
      assert.equal('function', typeof jade.filters, 'exports.filters missing');
      assert.equal('object', typeof jade.utils, 'exports.utils missing');
      assert.equal('function', typeof jade.Compiler, 'exports.Compiler missing');
    });
  });

  describe('.compile()', function(){
    it('should support doctypes', function(){
      assert.equal('<?xml version="1.0" encoding="utf-8" ?>', jade.render('doctype xml'));
      assert.equal('<!DOCTYPE html>', jade.render('doctype html'));
      assert.equal('<!DOCTYPE foo bar baz>', jade.render('doctype foo bar baz'));
      assert.equal('<!DOCTYPE html>', jade.render('doctype html'));
      assert.equal('<!DOCTYPE html>', jade.render('doctype', { doctype:'html' }));
      assert.equal('<!DOCTYPE html>', jade.render('doctype html', { doctype:'xml' }));
      assert.equal('<html></html>', jade.render('html'));
      assert.equal('<!DOCTYPE html><html></html>', jade.render('html', { doctype:'html' }));
      assert.equal('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN>', jade.render('doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN'));
    });

    it('should support Buffers', function(){
      assert.equal('<p>foo</p>', jade.render(new Buffer('p foo')));
    });

    it('should support line endings', function(){
      var src = [
          'p',
          'div',
          'img'
      ];

      var html = [
          '<p></p>',
          '<div></div>',
          '<img/>'
      ].join('');

      assert.equal(html, jade.render(src.join('\n')));
      assert.equal(html, jade.render(src.join('\r')));
      assert.equal(html, jade.render(src.join('\r\n')));

      html = [
          '<p></p>',
          '<div></div>',
          '<img>'
      ].join('');

      assert.equal(html, jade.render(src.join('\n'), { doctype:'html' }));
      assert.equal(html, jade.render(src.join('\r'), { doctype:'html' }));
      assert.equal(html, jade.render(src.join('\r\n'), { doctype:'html' }));
    });

    it('should support single quotes', function(){
      assert.equal("<p>'foo'</p>", jade.render("p 'foo'"));
      assert.equal("<p>'foo'</p>", jade.render("p\n  | 'foo'"));
      assert.equal('<a href="/foo"></a>', jade.render("- var path = 'foo';\na(href='/' + path)"));
    });

    it('should support block-expansion', function(){
      assert.equal("<li><a>foo</a></li><li><a>bar</a></li><li><a>baz</a></li>", jade.render("li: a foo\nli: a bar\nli: a baz"));
      assert.equal("<li class=\"first\"><a>foo</a></li><li><a>bar</a></li><li><a>baz</a></li>", jade.render("li.first: a foo\nli: a bar\nli: a baz"));
      assert.equal('<div class="foo"><div class="bar">baz</div></div>', jade.render(".foo: .bar baz"));
    });

    it('should support tags', function(){
      var str = [
          'p',
          'div',
          'img'
      ].join('\n');

      var html = [
          '<p></p>',
          '<div></div>',
          '<img/>'
      ].join('');

      assert.equal(html, jade.render(str), 'Test basic tags');
      assert.equal('<fb:foo-bar></fb:foo-bar>', jade.render('fb:foo-bar'), 'Test hyphens');
      assert.equal('<div class="something"></div>', jade.render('div.something'), 'Test classes');
      assert.equal('<div id="something"></div>', jade.render('div#something'), 'Test ids');
{'fraction_non_alphanumeric': 0.24258013454689356, 'fraction_numerical': 0.002638174383326738, 'mean_word_length': 2.938701298701299, 'pattern_counts': {'":': 0, '<': 146, '<?xml version=': 2, '>': 146, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '6093313', 'n_tokens_mistral': 2517, 'n_tokens_neox': 2498, 'n_words': 473}