Permalink
Browse files

test_square refactor

  • Loading branch information...
1 parent 8d1fe49 commit 21aaa8fe941d4bafd1fcc42135545429dc77ebb6 @tenderlove committed Dec 16, 2009
Showing with 3 additions and 5 deletions.
  1. +3 −5 test/test_string.rb
View
@@ -12,12 +12,10 @@ def test_square
str = "foo"
sstr = Stree::String.new(str)
- if str.respond_to?(:getbyte)
- 0.upto(str.bytesize) do |i|
+ 0.upto(str.bytesize) do |i|
+ if str.respond_to?(:getbyte)
assert_equal str.getbyte(i), sstr[i], "failed on #{i}"
- end
- else
- 0.upto(str.bytesize) do |i|
+ else
assert_equal str[i], sstr[i], "failed on #{i}"
end
end

0 comments on commit 21aaa8f

Please sign in to comment.