Created
January 31, 2014 22:22
-
-
Save nedzadarek/8744476 to your computer and use it in GitHub Desktop.
Closing and opening brackets - tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You should have the same amount of `{` as `}` | |
# 2 | |
%Q{{hi}} | |
# => "{hi}" | |
# 4 | |
%Q{{{{42}}}} | |
# => "{{{42}}}" | |
# `{`: 2; `}`:3 | |
# too much of `}` | |
%Q{{hi}}} | |
#SyntaxError: unexpected '}', expecting $end | |
# however you can escape it: | |
%q{\{hi} | |
#=> "{hi" | |
# or closing bracket: | |
%q{hi\}} | |
# => "hi}" | |
# here, I closed it prematuely: | |
%Q{}hi} | |
# SyntaxError: unexpected tIDENTIFIER, expecting $end | |
# %Q{}hi} | |
# ^ | |
# here, any of closing brackets doesn't close "Q's" opening bracket | |
%Q{{}hi{}} | |
# => "{}hi{}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment