Last active
December 16, 2015 10:09
-
-
Save tomoyamkung/5417856 to your computer and use it in GitHub Desktop.
[Ruby]文字列削除の動作確認スニペット
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
# encoding: utf-8 | |
class StringDelete | |
def delete(str, del) | |
str.delete(del) | |
end | |
end | |
if __FILE__ == $0 | |
require 'test/unit' | |
class StringDeleteTest < Test::Unit::TestCase | |
def setup | |
@obj = StringDelete.new | |
end | |
def test_delete_hankaku | |
str = 'abced' | |
del = 'bce' | |
assert_equal('ad', @obj.delete(str, del)) | |
end | |
def test_delete_zenkaku | |
str = 'あいうえお' | |
del = 'いうえ' | |
assert_equal('あお', @obj.delete(str, del)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment