<commit_before><commit_msg>Write specs for Walrus.Utils#trim<commit_after>Walrus = require '../bin/walrus'
should = require 'should'

describe 'Walrus.Utils', ->

  it 'should be defined', -> should.exist Walrus.Utils

  describe '#trim', ->

    it 'should be defined', -> should.exist Walrus.Utils.trim

    it 'should trim leading whitespace', ->
      Walrus.Utils.trim( '   foo' ).should.equal 'foo'

    it 'should trim trailing whitespace', ->
      Walrus.Utils.trim( 'foo   ' ).should.equal 'foo'

    it 'should trim leading and trailing whitespace', ->
      Walrus.Utils.trim( '  foo  ' ).should.equal 'foo'

    it 'should leave internal whitespace alone', ->
      Walrus.Utils.trim( 'foo   bar' ).should.equal 'foo   bar'

    it 'should trim newlines', ->
      Walrus.Utils.trim( """

      foo

      """ ).should.equal 'foo'
{'fraction_non_alphanumeric': 0.14709371293001186, 'fraction_numerical': 0.0, 'mean_word_length': 2.8018018018018016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '4403501', 'n_tokens_mistral': 270, 'n_tokens_neox': 255, 'n_words': 74}