Sha256: 708bef2c70f99fd95c434e7aef3c19de9ad004a2822e07cc780720e13c060e3c
Contents?: true
Size: 937 Bytes
Versions: 7
Compression:
Stored size: 937 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 offense' do pending 'Is there a way to emit this warning without syntax errors?' inspect_source(cop, source) expect(cop.offenses.size).to eq(1) expect(cop.offenses.first.message) .to eq('Invalid character literal; use ?\s') expect(cop.highlights).to eq([' ']) end end end
Version data entries
7 entries across 7 versions & 2 rubygems