Sha256: 96e80b2f11e03a921a05421842634620d7b5e19589244f9fd0992a8b9c2e1450

Contents?: true

Size: 663 Bytes

Versions: 3

Compression:

Stored size: 663 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe CharacterLiteral do
        let(:cop) { CharacterLiteral.new }

        it 'registers an offence for character literals' do
          inspect_source(cop, ['x = ?x'])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for literals like \n' do
          inspect_source(cop, ['x = ?\n'])
          expect(cop.offences.size).to eq(1)
        end

        it 'accepts literals like ?\C-\M-d' do
          inspect_source(cop, ['x = ?\C-\M-d'])
          expect(cop.offences).to be_empty
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rubocop-0.9.1 spec/rubocop/cops/style/character_literal_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/cops/style/character_literal_spec.rb
rubocop-0.9.0 spec/rubocop/cops/style/character_literal_spec.rb