Skip to content

Commit

Permalink
Merge pull request #337 from Shopify/at-add-type-tests
Browse files Browse the repository at this point in the history
Add a few missing test for Type builder interface
  • Loading branch information
Morriar authored Aug 5, 2024
2 parents 47ffe5a + ab84076 commit 90eb9f4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/rbi/type_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ def test_build_type_class_of
assert_equal("T.class_of(String)", type.to_rbi)
end

def test_build_type_class_of_generic
type = Type.class_of(Type.simple("String"), Type.simple("Integer"))
assert_equal("T.class_of(String)[Integer]", type.to_rbi)
end

def test_buid_type_t_class
type = Type.t_class(Type.simple("String"))
assert_equal("T::Class[String]", type.to_rbi)
end

def test_build_type_self_type
type = Type.self_type
assert_equal("T.self_type", type.to_rbi)
Expand All @@ -387,6 +397,11 @@ def test_build_type_untyped
assert_equal("T.untyped", type.to_rbi)
end

def test_buid_type_noreturn
type = Type.noreturn
assert_equal("T.noreturn", type.to_rbi)
end

def test_types_comparison
type1 = Type.simple("String")
type2 = Type.simple("String")
Expand Down

0 comments on commit 90eb9f4

Please sign in to comment.