1 # frozen_string_literal: false
2 require_relative 'helper'
5 class TestHashCreate < TestCase
7 trap_probe(probe, 'Hash.new') { |_,rbfile,saw|
8 saw = saw.map(&:split).find_all { |num, file, line|
9 file == rbfile && num == '0'
11 assert_operator saw.length, :>, 0
16 trap_probe(probe, '{}') { |_,rbfile,saw|
17 saw = saw.map(&:split).find_all { |num, file, line|
18 file == rbfile && num == '0'
20 assert_operator saw.length, :>, 0
24 def test_hash_lit_elements
25 trap_probe(probe, '{ :foo => :bar }') { |_,rbfile,orig|
26 saw = orig.map(&:split).find_all { |num, file, line|
27 file == rbfile && num == '2'
29 assert_operator saw.length, :>, 0, orig
33 def test_hash_lit_elements_string
34 trap_probe(probe, '{ :foo => :bar, :bar => "baz" }') { |_,rbfile,saw|
35 saw = saw.map(&:split).find_all { |num, file, line|
36 file == rbfile && num == '4'
38 assert_operator saw.length, :>, 0
45 ruby$target:::hash-create
48 printf("%d %s %d\\n", arg0, copyinstr(arg1), arg2);
53 end if defined?(DTrace::TestCase)