From 7dd020078ab9d84a58c71cc9d2a363dff71f0de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 14 Oct 2023 14:09:56 +0200 Subject: Add test for object equivalence. --- tests/unit/util/object.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/util/object.scm b/tests/unit/util/object.scm index 4f3aeb4f..6db9890c 100644 --- a/tests/unit/util/object.scm +++ b/tests/unit/util/object.scm @@ -79,4 +79,12 @@ (define-type (f4 printer: (lambda (r p) (display "something" p)))) (test-equal "something" (with-output-to-string (lambda () (write (f4))))) +(test-group "Object equivalence" + (let ((o1 (f3 f3-x: 10 f3-y: "string")) + (o2 (f3 f3-x: 10 f3-y: "string"))) + (test-eq "An object is itself" o1 o1) + (test-assert "Two identical objects are different objects" + (not (eq?? o1 o2))) + (test-equal "Two identical objects are equal" o1 o2))) + '((hnh util object)) -- cgit v1.2.3