👮 string literals should be single-quoted

This commit is contained in:
Andy Meneely
2016-03-17 23:49:04 -04:00
parent 65a0fdfd47
commit 0cbcc0c683
14 changed files with 34 additions and 34 deletions
+9 -9
View File
@@ -24,40 +24,40 @@ describe Squib::Args::Typographer do
expect(t.process(%{"foo"})).to eq(%{\u201Cfoo\u201D})
end
it "quotes in the middle of the string" do
it 'quotes in the middle of the string' do
expect(t.process(%{hello "foo" world})).to eq(%{hello \u201Cfoo\u201D world})
end
it "single left quotes at the beginning" do
it 'single left quotes at the beginning' do
expect(t.process(%{'foo})).to eq(%{\u2018foo})
end
it "single right quotes at the end" do
it 'single right quotes at the end' do
expect(t.process(%{foo'})).to eq(%{foo\u2019})
end
it "single quotes in the middle" do
it 'single quotes in the middle' do
expect(t.process(%{a 'foo' bar})).to eq(%{a \u2018foo\u2019 bar})
end
it "handles apostraphes" do
it 'handles apostraphes' do
expect(t.process(%{can't})).to eq(%{can\u2019t})
end
it "single quotes inside double quotes" do
it 'single quotes inside double quotes' do
expect(t.process(%{"'I can't do that', he said"})).to eq(%{\u201C\u2018I can\u2019t do that\u2019, he said\u201D})
end
it "replaces the straightforward ones" do
it 'replaces the straightforward ones' do
expect(t.process(%{``hi...'' -- ---})).to eq(%{\u201Chi\u2026\u201D \u2013 \u2014})
end
it "does nothing on lone quotes" do
it 'does nothing on lone quotes' do
expect(t.process(%{"})).to eq(%{"})
expect(t.process(%{'})).to eq(%{'})
end
it "ignores stuff in <tags>" do
it 'ignores stuff in <tags>' do
expect(t.process(%{<span weight="bold">"can't"</span>})).to eq(%{<span weight="bold">\u201Ccan\u2019t\u201D</span>})
end
+1 -1
View File
@@ -5,7 +5,7 @@ describe Squib.logger do
Squib.logger = nil
oldstdout = $stdout
$stdout = StringIO.new
Squib::logger.warn "Test warn"
Squib::logger.warn 'Test warn'
expect($stdout.string).to match /WARN: Test warn/
$stdout = oldstdout
end
+1 -1
View File
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'squib'
require 'pp'
describe "Squib samples" do
describe 'Squib samples' do
Dir["#{samples_dir}/**/*.rb"].each do |sample|
it "executes #{sample} with no errors", slow: true do
+1 -1
View File
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'squib'
require 'pp'
describe "Squib samples" do
describe 'Squib samples' do
around(:each) do |example|
Dir.chdir(samples_dir) do
+8 -8
View File
@@ -14,14 +14,14 @@ class Sanity
def images
images = []
exp_pngs = Dir[@@EXPECTED_DIR + "/**/*.png"]
exp_pngs = Dir[@@EXPECTED_DIR + '/**/*.png']
bar = ProgressBar.create(title: 'Diffing images', total: exp_pngs.size)
exp_pngs.each do |exp_png|
row = []
actual_png = @@OUTPUT_DIR + File.basename(exp_png)
row << "file:///" + exp_png
row << "file:///" + actual_png # actual
row << "file:///" + diff_image(exp_png, actual_png)
row << 'file:///' + exp_png
row << 'file:///' + actual_png # actual
row << 'file:///' + diff_image(exp_png, actual_png)
images << row
bar.increment
end
@@ -30,11 +30,11 @@ class Sanity
end
def run
puts "Building sanity test..."
puts 'Building sanity test...'
sanity_template = File.read(@@SANITY_ERB)
process_erb(sanity_template)
Launchy.open("file:///" + @@SANITY_HTML)
puts "Done."
Launchy.open('file:///' + @@SANITY_HTML)
puts 'Done.'
end
private
@@ -51,7 +51,7 @@ class Sanity
end
end
out = Cairo::ImageSurface.new(new_data.pack('c*'), exp.format, exp.width, exp.height, exp.stride)
out_file = @@DIFF_DIR + exp_file[exp_file.rindex("/")..-1]
out_file = @@DIFF_DIR + exp_file[exp_file.rindex('/')..-1]
out.write_to_png(out_file)
out_file
end
+1 -1
View File
@@ -101,7 +101,7 @@ def mock_cairo(strio)
allow(pango).to receive(:extents).and_return([Pango::Rectangle.new(0, 0, 0, 0)] * 2)
allow(pango).to receive(:iter).and_return(iter)
allow(pango).to receive(:alignment).and_return(Pango::Layout::Alignment::LEFT)
allow(pango).to receive(:text).and_return("foo")
allow(pango).to receive(:text).and_return('foo')
allow(pango).to receive(:context).and_return(pango_cxt)
allow(pango_cxt).to receive(:font_options=)
allow(iter).to receive(:next_char!).and_return(false)