File: escape_paren_1_8_spec.rb

package info (click to toggle)
ruby-mail 2.6.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,256 kB
  • ctags: 1,327
  • sloc: ruby: 44,678; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 771 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'

describe "Ruby 1.8 Extensions" do
  
  describe "string ascii detection" do
    it "should say it is US-ASCII only if it is" do
      expect("abc").to be_ascii_only
    end
    
    it "should not say it is US-ASCII only if it isn't" do
      expect("かきくけこ").not_to be_ascii_only
    end
    
    it "should not say it is US-ASCII only if it is a mix" do
      expect("abcかきくけこ123").not_to be_ascii_only
    end
    
    it "should handle edge cases" do
      ["\x00", "\x01", "\x40", "\x7f", "\x73"].each do |str|
        expect(str).to be_ascii_only
      end

      ["\x81", "\x99", "\xFF"].each do |str|
        expect(str).not_to be_ascii_only
      end

    end
  end
end