mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

Without it, String#undent would fail on unindented strings, e.g.: "foo".undent NoMethodError: undefined method `length' for nil:NilClass` Closes Homebrew/homebrew#28873. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
22 lines
384 B
Ruby
22 lines
384 B
Ruby
require 'testing_env'
|
|
require 'extend/string'
|
|
|
|
class StringTest < Test::Unit::TestCase
|
|
def test_undent
|
|
undented = <<-EOS.undent
|
|
hi
|
|
....my friend over
|
|
there
|
|
EOS
|
|
assert undented == "hi\nmy friend over\nthere\n"
|
|
end
|
|
|
|
def test_undent_not_indented
|
|
undented = <<-EOS.undent
|
|
hi
|
|
I'm not indented
|
|
EOS
|
|
assert undented == "hi\nI'm not indented\n"
|
|
end
|
|
end
|