Sha256: e34647f0ad1aa666f8b2f1a8c4637eb27b719adc63d5537a770f9e2a310ea50d
Contents?: true
Size: 940 Bytes
Versions: 4
Compression:
Stored size: 940 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Rubocop::Cop::Lint::InvalidCharacterLiteral do subject(:cop) { described_class.new } # Is there a way to emit this warning without syntax error? # # $ ruby -w # p(? ) # -:1: warning: invalid character syntax; use ?\s # -:1: syntax error, unexpected '?', expecting ')' # p(? ) # ^ # # https://github.com/ruby/ruby/blob/v2_1_0/parse.y#L7276 # https://github.com/whitequark/parser/blob/v2.1.2/lib/parser/lexer.rl#L1660 context 'with a non-escaped whitespace character literal ' do let(:source) { 'p(? )' } it 'registers an offence' do pending 'Is there a way to emit this warning without syntax errors?' inspect_source(cop, source) expect(cop.offences.size).to eq(1) expect(cop.offences.first.message) .to eq('Invalid character literal; use ?\s') expect(cop.highlights).to eq([' ']) end end end
Version data entries
4 entries across 4 versions & 2 rubygems