From 498bad91059651ced6f26079c2b59d88de1a3505 Mon Sep 17 00:00:00 2001 From: Konstantin Shabanov Date: Wed, 18 Jul 2012 23:07:24 +0400 Subject: [PATCH] Remove trailing whitespaces --- examples/chat.rb | 10 ++++---- lib/sinatra/base.rb | 2 +- test/compile_test.rb | 48 +++++++++++++++++------------------ test/contest.rb | 6 ++--- test/helpers_test.rb | 14 +++++----- test/liquid_test.rb | 2 +- test/mapped_error_test.rb | 4 +-- test/markaby_test.rb | 4 +-- test/rabl_test.rb | 10 ++++---- test/radius_test.rb | 2 +- test/route_added_hook_test.rb | 4 +-- test/scss_test.rb | 4 +-- test/sinatra_test.rb | 2 +- test/slim_test.rb | 16 ++++++------ test/templates_test.rb | 2 +- test/yajl_test.rb | 2 +- 16 files changed, 66 insertions(+), 66 deletions(-) diff --git a/examples/chat.rb b/examples/chat.rb index e0575f3c..736165bd 100755 --- a/examples/chat.rb +++ b/examples/chat.rb @@ -25,11 +25,11 @@ __END__ @@ layout - - Super Simple Chat with Sinatra + + Super Simple Chat with Sinatra - - + + <%= yield %> @@ -58,4 +58,4 @@ __END__
-
\ No newline at end of file + diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index a10ae118..33648b28 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -1348,7 +1348,7 @@ module Sinatra enc = "(?:#{enc}|#{encoded('+')})" if char == " " enc end - + def escaped(char, enc = URI.escape(char)) [Regexp.escape(enc), URI.escape(char, /./)] end diff --git a/test/compile_test.rb b/test/compile_test.rb index 5c72d82d..2344d3aa 100644 --- a/test/compile_test.rb +++ b/test/compile_test.rb @@ -2,7 +2,7 @@ require File.expand_path('../helper', __FILE__) class CompileTest < Test::Unit::TestCase - + def self.converts pattern, expected_regexp it "generates #{expected_regexp.source} from #{pattern}" do compiled, _ = compiled pattern @@ -14,7 +14,7 @@ class CompileTest < Test::Unit::TestCase compiled, keys = compiled pattern match = compiled.match(example) fail %Q{"#{example}" does not parse on pattern "#{pattern}".} unless match - + # Aggregate e.g. multiple splat values into one array. # params = keys.zip(match.captures).reduce({}) do |hash, mapping| @@ -26,7 +26,7 @@ class CompileTest < Test::Unit::TestCase end hash end - + assert_equal(expected_params, params) end end @@ -42,13 +42,13 @@ class CompileTest < Test::Unit::TestCase compiled, keys = app.send(:compile, pattern) [compiled, keys] end - + converts "/", %r{\A/\z} parses "/", "/", {} - + converts "/foo", %r{\A/foo\z} parses "/foo", "/foo", {} - + converts "/:foo", %r{\A/([^/?#]+)\z} parses "/:foo", "/foo", "foo" => "foo" parses "/:foo", "/foo.bar", "foo" => "foo.bar" @@ -57,33 +57,33 @@ class CompileTest < Test::Unit::TestCase fails "/:foo", "/foo/bar" fails "/:foo", "/" fails "/:foo", "/foo/" - + converts "/föö", %r{\A/f%C3%B6%C3%B6\z} parses "/föö", "/f%C3%B6%C3%B6", {} - + converts "/:foo/:bar", %r{\A/([^/?#]+)/([^/?#]+)\z} parses "/:foo/:bar", "/foo/bar", "foo" => "foo", "bar" => "bar" - + converts "/hello/:person", %r{\A/hello/([^/?#]+)\z} parses "/hello/:person", "/hello/Frank", "person" => "Frank" - + converts "/?:foo?/?:bar?", %r{\A/?([^/?#]+)?/?([^/?#]+)?\z} parses "/?:foo?/?:bar?", "/hello/world", "foo" => "hello", "bar" => "world" parses "/?:foo?/?:bar?", "/hello", "foo" => "hello", "bar" => nil parses "/?:foo?/?:bar?", "/", "foo" => nil, "bar" => nil parses "/?:foo?/?:bar?", "", "foo" => nil, "bar" => nil - + converts "/*", %r{\A/(.*?)\z} parses "/*", "/", "splat" => "" parses "/*", "/foo", "splat" => "foo" parses "/*", "/foo/bar", "splat" => "foo/bar" - + converts "/:foo/*", %r{\A/([^/?#]+)/(.*?)\z} parses "/:foo/*", "/foo/bar/baz", "foo" => "foo", "splat" => "bar/baz" - + converts "/:foo/:bar", %r{\A/([^/?#]+)/([^/?#]+)\z} parses "/:foo/:bar", "/user@example.com/name", "foo" => "user@example.com", "bar" => "name" - + converts "/test$/", %r{\A/test(?:\$|%24)/\z} parses "/test$/", "/test$/", {} @@ -91,45 +91,45 @@ class CompileTest < Test::Unit::TestCase parses "/te+st/", "/te+st/", {} fails "/te+st/", "/test/" fails "/te+st/", "/teeest/" - + converts "/test(bar)/", %r{\A/test(?:\(|%28)bar(?:\)|%29)/\z} parses "/test(bar)/", "/test(bar)/", {} - + converts "/path with spaces", %r{\A/path(?:%20|(?:\+|%2B))with(?:%20|(?:\+|%2B))spaces\z} parses "/path with spaces", "/path%20with%20spaces", {} parses "/path with spaces", "/path%2Bwith%2Bspaces", {} parses "/path with spaces", "/path+with+spaces", {} - + converts "/foo&bar", %r{\A/foo(?:&|%26)bar\z} parses "/foo&bar", "/foo&bar", {} - + converts "/:foo/*", %r{\A/([^/?#]+)/(.*?)\z} parses "/:foo/*", "/hello%20world/how%20are%20you", "foo" => "hello%20world", "splat" => "how%20are%20you" - + converts "/*/foo/*/*", %r{\A/(.*?)/foo/(.*?)/(.*?)\z} parses "/*/foo/*/*", "/bar/foo/bling/baz/boom", "splat" => ["bar", "bling", "baz/boom"] fails "/*/foo/*/*", "/bar/foo/baz" - + converts "/test.bar", %r{\A/test(?:\.|%2E)bar\z} parses "/test.bar", "/test.bar", {} fails "/test.bar", "/test0bar" - + converts "/:file.:ext", %r{\A/([^\.%2E/?#]+)(?:\.|%2E)([^\.%2E/?#]+)\z} parses "/:file.:ext", "/pony.jpg", "file" => "pony", "ext" => "jpg" parses "/:file.:ext", "/pony%2Ejpg", "file" => "pony", "ext" => "jpg" fails "/:file.:ext", "/.jpg" - + converts "/:name.?:format?", %r{\A/([^\.%2E/?#]+)(?:\.|%2E)?([^\.%2E/?#]+)?\z} parses "/:name.?:format?", "/foo", "name" => "foo", "format" => nil parses "/:name.?:format?", "/foo.bar", "name" => "foo", "format" => "bar" parses "/:name.?:format?", "/foo%2Ebar", "name" => "foo", "format" => "bar" fails "/:name.?:format?", "/.bar" - + converts "/:user@?:host?", %r{\A/([^@%40/?#]+)(?:@|%40)?([^@%40/?#]+)?\z} parses "/:user@?:host?", "/foo@bar", "user" => "foo", "host" => "bar" parses "/:user@?:host?", "/foo.foo@bar", "user" => "foo.foo", "host" => "bar" parses "/:user@?:host?", "/foo@bar.bar", "user" => "foo", "host" => "bar.bar" - + # From https://gist.github.com/2154980#gistcomment-169469. # # converts "/:name(.:format)?", %r{\A/([^\.%2E/?#]+)(?:\(|%28)(?:\.|%2E)([^\.%2E/?#]+)(?:\)|%29)?\z} diff --git a/test/contest.rb b/test/contest.rb index ab09d6e9..32ab84e9 100644 --- a/test/contest.rb +++ b/test/contest.rb @@ -1,15 +1,15 @@ # Copyright (c) 2009 Damian Janowski and Michel Martens for Citrusbyte -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/test/helpers_test.rb b/test/helpers_test.rb index 53d6980b..09ba8d5c 100644 --- a/test/helpers_test.rb +++ b/test/helpers_test.rb @@ -586,21 +586,21 @@ class HelpersTest < Test::Unit::TestCase end end end - + it 'sets the Content-Type response header' do attachment_app('test.xml') get '/attachment' assert_equal 'application/xml;charset=utf-8', response['Content-Type'] assert_equal '', body - end - + end + it 'sets the Content-Type response header without extname' do attachment_app('test') get '/attachment' assert_equal 'text/html;charset=utf-8', response['Content-Type'] - assert_equal '', body + assert_equal '', body end - + it 'sets the Content-Type response header with extname' do mock_app do get('/attachment') do @@ -612,9 +612,9 @@ class HelpersTest < Test::Unit::TestCase get '/attachment' assert_equal 'application/atom+xml', response['Content-Type'] - assert_equal '', body + assert_equal '', body end - + end describe 'send_file' do diff --git a/test/liquid_test.rb b/test/liquid_test.rb index 9d341ca1..4988dbd8 100644 --- a/test/liquid_test.rb +++ b/test/liquid_test.rb @@ -44,7 +44,7 @@ class LiquidTest < Test::Unit::TestCase mock_app { get('/') { liquid :no_such_template } } assert_raise(Errno::ENOENT) { get('/') } end - + it "allows passing locals" do liquid_app { liquid '{{ value }}', :locals => { :value => 'foo' } diff --git a/test/mapped_error_test.rb b/test/mapped_error_test.rb index c02082be..e07ebde8 100644 --- a/test/mapped_error_test.rb +++ b/test/mapped_error_test.rb @@ -211,7 +211,7 @@ class MappedErrorTest < Test::Unit::TestCase assert_equal 500, status end - it "allows a stack of exception_handlers" do + it "allows a stack of exception_handlers" do mock_app do set :raise_errors, false error(FirstError) { 'First!' } @@ -223,7 +223,7 @@ class MappedErrorTest < Test::Unit::TestCase assert_equal 'Second!', body end - it "allows an exception handler to pass control to the next exception handler" do + it "allows an exception handler to pass control to the next exception handler" do mock_app do set :raise_errors, false error(500, FirstError) { 'First!' } diff --git a/test/markaby_test.rb b/test/markaby_test.rb index 546fb3c5..946f6846 100644 --- a/test/markaby_test.rb +++ b/test/markaby_test.rb @@ -55,7 +55,7 @@ class MarkabyTest < Test::Unit::TestCase assert_equal "

THIS. IS. SPARTA

", body end - it 'renders inline markaby blocks with file layouts' do + it 'renders inline markaby blocks with file layouts' do markaby_app { markaby(:layout => :layout2) { text "Hello World" } } assert ok? assert_equal "

Markaby Layout!

Hello World

", body @@ -65,7 +65,7 @@ class MarkabyTest < Test::Unit::TestCase mock_app { get('/') { markaby :no_such_template } } assert_raise(Errno::ENOENT) { get('/') } end - + it "allows passing locals" do markaby_app { markaby 'text value', :locals => { :value => 'foo' } diff --git a/test/rabl_test.rb b/test/rabl_test.rb index 9b75ebf6..98d087d7 100644 --- a/test/rabl_test.rb +++ b/test/rabl_test.rb @@ -34,7 +34,7 @@ class RablTest < Test::Unit::TestCase assert ok? assert_equal '{"openstruct":{"bar":"baz"}}', body end - + it "renders with file layouts" do rabl_app { @foo = OpenStruct.new(:bar => 'baz') @@ -43,14 +43,14 @@ class RablTest < Test::Unit::TestCase assert ok? assert_equal '{"qux":{"openstruct":{"bar":"baz"}}}', body end - + it "raises error if template not found" do mock_app { get('/') { rabl :no_such_template } } assert_raise(Errno::ENOENT) { get('/') } end - + it "passes rabl options to the rabl engine" do mock_app do get('/') do @@ -65,7 +65,7 @@ class RablTest < Test::Unit::TestCase assert ok? assert_body 'baz' end - + it "passes default rabl options to the rabl engine" do mock_app do set :rabl, :format => 'xml' @@ -81,7 +81,7 @@ class RablTest < Test::Unit::TestCase assert ok? assert_body 'baz' end - + end rescue LoadError diff --git a/test/radius_test.rb b/test/radius_test.rb index 2c098e6e..90f8712e 100644 --- a/test/radius_test.rb +++ b/test/radius_test.rb @@ -44,7 +44,7 @@ class RadiusTest < Test::Unit::TestCase mock_app { get('/') { radius :no_such_template } } assert_raise(Errno::ENOENT) { get('/') } end - + it "allows passing locals" do radius_app { radius '', :locals => { :value => 'foo' } diff --git a/test/route_added_hook_test.rb b/test/route_added_hook_test.rb index b2a22e88..d6ef3410 100644 --- a/test/route_added_hook_test.rb +++ b/test/route_added_hook_test.rb @@ -47,13 +47,13 @@ class RouteAddedHookTest < Test::Unit::TestCase assert_equal [["GET", "/"], ["HEAD", "/"]], RouteAddedTest.routes end - + it "should pass route blocks as an argument" do mock_app(Class.new(Sinatra::Base)) do register RouteAddedTest get('/') {} end - assert_kind_of Proc, RouteAddedTest.procs.first + assert_kind_of Proc, RouteAddedTest.procs.first end end diff --git a/test/scss_test.rb b/test/scss_test.rb index e5d6857f..aa43930f 100644 --- a/test/scss_test.rb +++ b/test/scss_test.rb @@ -75,9 +75,9 @@ class ScssTest < Test::Unit::TestCase mock_app do set :scss, {:style => :compact} # default scss style is :nested get('/') { - scss("#scss {\n background-color: white;\n color: black;\n}") + scss("#scss {\n background-color: white;\n color: black;\n}") } - end + end get '/' assert ok? assert_equal "#scss { background-color: white; color: black; }\n", body diff --git a/test/sinatra_test.rb b/test/sinatra_test.rb index 459a37c4..9a76c974 100644 --- a/test/sinatra_test.rb +++ b/test/sinatra_test.rb @@ -5,7 +5,7 @@ class SinatraTest < Test::Unit::TestCase app = Sinatra.new { get('/') { 'Hello World' } } assert_same Sinatra::Base, app.superclass end - + it "responds to #template_cache" do assert_kind_of Tilt::Cache, Sinatra::Base.new!.template_cache end diff --git a/test/slim_test.rb b/test/slim_test.rb index e13e357c..59057047 100644 --- a/test/slim_test.rb +++ b/test/slim_test.rb @@ -17,13 +17,13 @@ class SlimTest < Test::Unit::TestCase assert ok? assert_equal "

Hiya

", body end - + it 'renders .slim files in views path' do slim_app { slim :hello } assert ok? assert_equal "

Hello From Slim

", body end - + it "renders with inline layouts" do mock_app do layout { %(h1\n | THIS. IS. \n == yield.upcase ) } @@ -33,27 +33,27 @@ class SlimTest < Test::Unit::TestCase assert ok? assert_equal "

THIS. IS. SPARTA

", body end - + it "renders with file layouts" do slim_app { slim('| Hello World', :layout => :layout2) } assert ok? assert_equal "

Slim Layout!

Hello World

", body end - + it "raises error if template not found" do mock_app { get('/') { slim(:no_such_template) } } assert_raise(Errno::ENOENT) { get('/') } end - + HTML4_DOCTYPE = "" - + it "passes slim options to the slim engine" do mock_app { get('/') { slim("x foo='bar'", :attr_wrapper => "'") }} get '/' assert ok? assert_body "" end - + it "passes default slim options to the slim engine" do mock_app do set :slim, :attr_wrapper => "'" @@ -63,7 +63,7 @@ class SlimTest < Test::Unit::TestCase assert ok? assert_body "" end - + it "merges the default slim options with the overrides and passes them to the slim engine" do mock_app do set :slim, :attr_wrapper => "'" diff --git a/test/templates_test.rb b/test/templates_test.rb index 5874862d..e426d326 100644 --- a/test/templates_test.rb +++ b/test/templates_test.rb @@ -288,7 +288,7 @@ __END__ @@ foo this is foo -@@ bar +@@ bar There's a space after 'bar'! @@ foo bar diff --git a/test/yajl_test.rb b/test/yajl_test.rb index e10f764a..69a7d145 100644 --- a/test/yajl_test.rb +++ b/test/yajl_test.rb @@ -50,7 +50,7 @@ class YajlTest < Test::Unit::TestCase it 'decorates the json with a callback' do yajl_app do yajl( - 'json = { :foo => "bar" }', + 'json = { :foo => "bar" }', { :callback => 'baz' } ) end