Sha256: d53d01491fc0411f5efac619cc3850ba3c4f74bb22e4d033b18ca20f4767bf1d

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

// Copyright 2012 Twitter, Inc
// http://www.apache.org/licenses/LICENSE-2.0

var TwitterCldr = require('../../../../lib/assets/javascripts/twitter_cldr/en.js');

describe("Literal", function() {
  describe("#to_set", function() {
    it("should set an array of tokens", function() {
      literal = new TwitterCldr.Literal ("a");
      expect(literal.to_set().to_array(true)).toEqual([97]);
    });
    it("should return escaped characters with no special meaning as codepoints", function() {
      literal = new TwitterCldr.Literal ("\\a");
      expect(literal.to_set().to_array(true)).toEqual([97]);
    });
    it("should convert special regex switches to their range equivalents", function() {
      literal = new TwitterCldr.Literal ("\\d"); // digit
      expect(literal.to_set()).toEqualRangeSet(new TwitterCldr.RangeSet([new TwitterCldr.Range(48,57)]));
    });
    it("should convert negated special regex switches to their range equivalents", function() {
      literal = new TwitterCldr.Literal ("\\D"); // NOT digit
      expect(literal.to_set()).toEqualRangeSet(new TwitterCldr.RangeSet([
        new TwitterCldr.Range(0, 1),
        new TwitterCldr.Range(8, 47),
        new TwitterCldr.Range(58, 55295),
        new TwitterCldr.Range(57344, 65535),//1114111),
      ]));
    });
  });
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr_js-2.4.0 spec/js/parsers/unicode_regex/literal.spec.js