<commit_before>cc = require '../lib/coffeecup'

describe 'CoffeeScript helper (function)', ->
  describe "coffeescript -> alert 'hi'",  ->
    it "should render <script>var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) {  for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }  function ctor() { this.constructor = child; }  ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype;  return child; };var __indexOf = Array.prototype.indexOf || function(item) {  for (var i = 0, l = this.length; i < l; i++) {    if (this[i] === item) return i;  } return -1; };(function () {\n  return alert('hi');\n}).call(this);</script>", ->
      h = -> coffeescript -> alert 'hi'
      #cc.render(h).should.equal "<script>var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) {  for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }  function ctor() { this.constructor = child; }  ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype;  return child; };var __indexOf = Array.prototype.indexOf || function(item) {  for (var i = 0, l = this.length; i < l; i++) {    if (this[i] === item) return i;  } return -1; };(function () { return alert('hi'); }).call(this);</script>"

describe 'CoffeeScript helper (string)', ->
  describe 'coffeescript "alert \'hi\'\"',  ->
    it 'should render <script type="text/coffeescript">alert \'hi\'</script>', ->
      h = -> coffeescript "alert 'hi'"
      cc.render(h).should.equal '<script type="text/coffeescript">alert \'hi\'</script>'

describe 'CoffeeScript helper (object)', ->
  describe "coffeescript src: 'script.coffee'",  ->
    it 'should render <script src="script.coffee" type="text/coffeescript"></script>', ->
      h = -> coffeescript src: 'script.coffee'
      cc.render(h).should.equal '<script src="script.coffee" type="text/coffeescript"></script>'


<commit_msg>comment cs helper function<commit_after>cc = require '../lib/coffeecup'

describe 'CoffeeScript helper (function)', ->
  describe "coffeescript -> alert 'hi'",  ->
    coffeescript_helper = """
      var __slice = Array.prototype.slice;
      var __hasProp = Object.prototype.hasOwnProperty;
      var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
      var __extends = function(child, parent) {
        for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
        function ctor() { this.constructor = child; }
        ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype;
        return child; };
      var __indexOf = Array.prototype.indexOf || function(item) {
        for (var i = 0, l = this.length; i < l; i++) {
          if (this[i] === item) return i;
        } return -1; };
    """.replace /\n/g, ''
    it "should render <script>#{coffeescript_helper}(function () {\n return alert('hi');\n }).call(this);</script>", ->
      h = -> coffeescript -> alert 'hi'
      #cc.render(h).should.equal "<script>#{coffeescript_helper}(function () {\n            return alert('hi');\n}).call(this);</script>"


describe 'CoffeeScript helper (string)', ->
  describe 'coffeescript "alert \'hi\'\"',  ->
    it 'should render <script type="text/coffeescript">alert \'hi\'</script>', ->
      h = -> coffeescript "alert 'hi'"
      cc.render(h).should.equal '<script type="text/coffeescript">alert \'hi\'</script>'

describe 'CoffeeScript helper (object)', ->
  describe "coffeescript src: 'script.coffee'",  ->
    it 'should render <script src="script.coffee" type="text/coffeescript"></script>', ->
      h = -> coffeescript src: 'script.coffee'
      cc.render(h).should.equal '<script src="script.coffee" type="text/coffeescript"></script>'



{'fraction_non_alphanumeric': 0.18085106382978725, 'fraction_numerical': 0.0014506769825918763, 'mean_word_length': 3.8104651162790697, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 55, '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': '902966', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1288, 'n_words': 331}