aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/journey/route
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/journey/route')
-rw-r--r--actionpack/test/journey/route/definition/parser_test.rb58
-rw-r--r--actionpack/test/journey/route/definition/scanner_test.rb74
2 files changed, 66 insertions, 66 deletions
diff --git a/actionpack/test/journey/route/definition/parser_test.rb b/actionpack/test/journey/route/definition/parser_test.rb
index d7d7172a40..8e00d8ab89 100644
--- a/actionpack/test/journey/route/definition/parser_test.rb
+++ b/actionpack/test/journey/route/definition/parser_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit'
+require "abstract_unit"
module ActionDispatch
module Journey
@@ -9,88 +9,88 @@ module ActionDispatch
end
def test_slash
- assert_equal :SLASH, @parser.parse('/').type
- assert_round_trip '/'
+ assert_equal :SLASH, @parser.parse("/").type
+ assert_round_trip "/"
end
def test_segment
- assert_round_trip '/foo'
+ assert_round_trip "/foo"
end
def test_segments
- assert_round_trip '/foo/bar'
+ assert_round_trip "/foo/bar"
end
def test_segment_symbol
- assert_round_trip '/foo/:id'
+ assert_round_trip "/foo/:id"
end
def test_symbol
- assert_round_trip '/:foo'
+ assert_round_trip "/:foo"
end
def test_group
- assert_round_trip '(/:foo)'
+ assert_round_trip "(/:foo)"
end
def test_groups
- assert_round_trip '(/:foo)(/:bar)'
+ assert_round_trip "(/:foo)(/:bar)"
end
def test_nested_groups
- assert_round_trip '(/:foo(/:bar))'
+ assert_round_trip "(/:foo(/:bar))"
end
def test_dot_symbol
- assert_round_trip('.:format')
+ assert_round_trip(".:format")
end
def test_dot_literal
- assert_round_trip('.xml')
+ assert_round_trip(".xml")
end
def test_segment_dot
- assert_round_trip('/foo.:bar')
+ assert_round_trip("/foo.:bar")
end
def test_segment_group_dot
- assert_round_trip('/foo(.:bar)')
+ assert_round_trip("/foo(.:bar)")
end
def test_segment_group
- assert_round_trip('/foo(/:action)')
+ assert_round_trip("/foo(/:action)")
end
def test_segment_groups
- assert_round_trip('/foo(/:action)(/:bar)')
+ assert_round_trip("/foo(/:action)(/:bar)")
end
def test_segment_nested_groups
- assert_round_trip('/foo(/:action(/:bar))')
+ assert_round_trip("/foo(/:action(/:bar))")
end
def test_group_followed_by_path
- assert_round_trip('/foo(/:action)/:bar')
+ assert_round_trip("/foo(/:action)/:bar")
end
def test_star
- assert_round_trip('*foo')
- assert_round_trip('/*foo')
- assert_round_trip('/bar/*foo')
- assert_round_trip('/bar/(*foo)')
+ assert_round_trip("*foo")
+ assert_round_trip("/*foo")
+ assert_round_trip("/bar/*foo")
+ assert_round_trip("/bar/(*foo)")
end
def test_or
- assert_round_trip('a|b')
- assert_round_trip('a|b|c')
- assert_round_trip('(a|b)|c')
- assert_round_trip('a|(b|c)')
- assert_round_trip('*a|(b|c)')
- assert_round_trip('*a|:b|c')
+ assert_round_trip("a|b")
+ assert_round_trip("a|b|c")
+ assert_round_trip("(a|b)|c")
+ assert_round_trip("a|(b|c)")
+ assert_round_trip("*a|(b|c)")
+ assert_round_trip("*a|:b|c")
end
def test_arbitrary
- assert_round_trip('/bar/*foo#')
+ assert_round_trip("/bar/*foo#")
end
def test_literal_dot_paren
diff --git a/actionpack/test/journey/route/definition/scanner_test.rb b/actionpack/test/journey/route/definition/scanner_test.rb
index 7a510f1e07..82a50cf539 100644
--- a/actionpack/test/journey/route/definition/scanner_test.rb
+++ b/actionpack/test/journey/route/definition/scanner_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit'
+require "abstract_unit"
module ActionDispatch
module Journey
@@ -11,44 +11,44 @@ module ActionDispatch
# /page/:id(/:action)(.:format)
def test_tokens
[
- ['/', [[:SLASH, '/']]],
- ['*omg', [[:STAR, '*omg']]],
- ['/page', [[:SLASH, '/'], [:LITERAL, 'page']]],
- ['/page!', [[:SLASH, '/'], [:LITERAL, 'page!']]],
- ['/page$', [[:SLASH, '/'], [:LITERAL, 'page$']]],
- ['/page&', [[:SLASH, '/'], [:LITERAL, 'page&']]],
- ["/page'", [[:SLASH, '/'], [:LITERAL, "page'"]]],
- ['/page*', [[:SLASH, '/'], [:LITERAL, 'page*']]],
- ['/page+', [[:SLASH, '/'], [:LITERAL, 'page+']]],
- ['/page,', [[:SLASH, '/'], [:LITERAL, 'page,']]],
- ['/page;', [[:SLASH, '/'], [:LITERAL, 'page;']]],
- ['/page=', [[:SLASH, '/'], [:LITERAL, 'page=']]],
- ['/page@', [[:SLASH, '/'], [:LITERAL, 'page@']]],
- ['/page\:', [[:SLASH, '/'], [:LITERAL, 'page:']]],
- ['/page\(', [[:SLASH, '/'], [:LITERAL, 'page(']]],
- ['/page\)', [[:SLASH, '/'], [:LITERAL, 'page)']]],
- ['/~page', [[:SLASH, '/'], [:LITERAL, '~page']]],
- ['/pa-ge', [[:SLASH, '/'], [:LITERAL, 'pa-ge']]],
- ['/:page', [[:SLASH, '/'], [:SYMBOL, ':page']]],
- ['/(:page)', [
- [:SLASH, '/'],
- [:LPAREN, '('],
- [:SYMBOL, ':page'],
- [:RPAREN, ')'],
+ ["/", [[:SLASH, "/"]]],
+ ["*omg", [[:STAR, "*omg"]]],
+ ["/page", [[:SLASH, "/"], [:LITERAL, "page"]]],
+ ["/page!", [[:SLASH, "/"], [:LITERAL, "page!"]]],
+ ["/page$", [[:SLASH, "/"], [:LITERAL, "page$"]]],
+ ["/page&", [[:SLASH, "/"], [:LITERAL, "page&"]]],
+ ["/page'", [[:SLASH, "/"], [:LITERAL, "page'"]]],
+ ["/page*", [[:SLASH, "/"], [:LITERAL, "page*"]]],
+ ["/page+", [[:SLASH, "/"], [:LITERAL, "page+"]]],
+ ["/page,", [[:SLASH, "/"], [:LITERAL, "page,"]]],
+ ["/page;", [[:SLASH, "/"], [:LITERAL, "page;"]]],
+ ["/page=", [[:SLASH, "/"], [:LITERAL, "page="]]],
+ ["/page@", [[:SLASH, "/"], [:LITERAL, "page@"]]],
+ ['/page\:', [[:SLASH, "/"], [:LITERAL, "page:"]]],
+ ['/page\(', [[:SLASH, "/"], [:LITERAL, "page("]]],
+ ['/page\)', [[:SLASH, "/"], [:LITERAL, "page)"]]],
+ ["/~page", [[:SLASH, "/"], [:LITERAL, "~page"]]],
+ ["/pa-ge", [[:SLASH, "/"], [:LITERAL, "pa-ge"]]],
+ ["/:page", [[:SLASH, "/"], [:SYMBOL, ":page"]]],
+ ["/(:page)", [
+ [:SLASH, "/"],
+ [:LPAREN, "("],
+ [:SYMBOL, ":page"],
+ [:RPAREN, ")"],
]],
- ['(/:action)', [
- [:LPAREN, '('],
- [:SLASH, '/'],
- [:SYMBOL, ':action'],
- [:RPAREN, ')'],
+ ["(/:action)", [
+ [:LPAREN, "("],
+ [:SLASH, "/"],
+ [:SYMBOL, ":action"],
+ [:RPAREN, ")"],
]],
- ['(())', [[:LPAREN, '('],
- [:LPAREN, '('], [:RPAREN, ')'], [:RPAREN, ')']]],
- ['(.:format)', [
- [:LPAREN, '('],
- [:DOT, '.'],
- [:SYMBOL, ':format'],
- [:RPAREN, ')'],
+ ["(())", [[:LPAREN, "("],
+ [:LPAREN, "("], [:RPAREN, ")"], [:RPAREN, ")"]]],
+ ["(.:format)", [
+ [:LPAREN, "("],
+ [:DOT, "."],
+ [:SYMBOL, ":format"],
+ [:RPAREN, ")"],
]],
].each do |str, expected|
@scanner.scan_setup str