Don't blow up if empty string/nil passed to alias methods

This commit is contained in:
Arfon Smith
2015-08-10 22:07:28 +01:00
parent a5f7355e16
commit 851c93a1f7
2 changed files with 7 additions and 0 deletions

View File

@@ -275,6 +275,11 @@ class TestLanguage < Minitest::Test
assert_equal Language['Rust'], Language.find_by_alias('rust,no_run')
end
def test_doesnt_blow_up_with_blank_lookup
assert_equal nil, Language.find_by_alias('')
assert_equal nil, Language.find_by_name(nil)
end
def test_name
assert_equal 'Perl', Language['Perl'].name
assert_equal 'Python', Language['Python'].name