Sha256: d4ec5ab3c6f952d535d9850a640bc85618bbee9085376c497f92ba40c9f3b116
Contents?: true
Size: 1.31 KB
Versions: 4
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true # rubocop:disable Lint/UselessAssignment require 'test_helper' class TestNode < Minitest::Test # These tests are somewhat fragile. It would be better to allocate lots # of memory after a GC run to make sure that potentially freed memory # isn't valid by accident. def test_drop_parent_reference doc = QiitaMarker.render_doc('Hi *there*') text = doc.first_child.last_child.first_child doc = nil GC.start # Test that doc has not been freed. assert_equal 'there', text.string_content end def test_drop_child_reference doc = QiitaMarker.render_doc('Hi *there*') text = doc.first_child.last_child.first_child text = nil GC.start # Test that the cached child object is still valid. text = doc.first_child.last_child.first_child assert_equal 'there', text.string_content end def test_remove_parent doc = QiitaMarker.render_doc('Hi *there*') para = doc.first_child para.delete doc = nil para = nil # TODO: Test that the `para` node was actually freed after unlinking. end def test_add_parent doc = Node.new(:document) hrule = Node.new(:hrule) doc.append_child(hrule) # If the hrule node was erroneously freed, this would result in a double # free. end end # rubocop:enable Lint/UselessAssignment
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
qiita_marker-0.23.2.3 | test/test_gc.rb |
qiita_marker-0.23.2.2 | test/test_gc.rb |
qiita_marker-0.23.2.1 | test/test_gc.rb |
qiita_marker-0.23.2.0 | test/test_gc.rb |