Files
news.gitea.happylizard.me/bin/gems/facets-3.1.0/test/standard/test_cloneable.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

61 lines
903 B
Ruby

require 'facets/cloneable'
test_case Cloneable do
foo = Class.new do
include Cloneable
def initialize
@bar=[]
end
def bar_id
@bar.object_id
end
end
method :dup do
test do
a = foo.new
b = a.dup
a.bar_id.refute == b.bar_id
end
test "tainted" do
a = foo.new
a.taint
b = a.dup
b.assert.tainted?
end
test "frozen" do
a = foo.new
a.freeze
b = a.dup
b.refute.frozen?
end
end
method :clone do
test do
a = foo.new
b = a.clone
assert(a.bar_id != b.bar_id, "should not be equal")
end
test "tainted" do
a = foo.new
a.taint
b = a.clone
assert b.tainted?, "b should be tainted"
end
test "frozen" do
a = foo.new
a.freeze
b = a.clone
assert b.frozen?, "b should be frozen"
end
end
end