Skip to content

Commit

Permalink
A struct equality test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegeek committed Oct 17, 2024
1 parent 24399d6 commit 1ad2b8b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/struct.test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ class Person < Literal::Struct
prop :name, String
end

class Student < Person
prop :final_grade, Integer
end

test do
person = Person.new(name: "Joel")
expect(person.name) == "Joel"
Expand Down Expand Up @@ -34,6 +38,13 @@ class Person < Literal::Struct
expect(a) != b
end

test do
a = Person.new(name: "Joel")
b = Student.new(name: "Joel", final_grade: 90)

expect(a) != b
end

# Marshal doesn't work with anonymous classes
class ::RootStruct < Literal::Struct
prop :name, String
Expand Down

0 comments on commit 1ad2b8b

Please sign in to comment.