Skip to content

Commit ee39b20

Browse files
committed
Use a method just doing yield rather than 1.times in Binding PE tests
* That way, the profiling or splitting of Integer#times does not affect the result.
1 parent 01644d3 commit ee39b20

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/truffle/compiler/pe/core/binding_pe.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
# GNU General Public License version 2, or
77
# GNU Lesser General Public License version 2.1.
88

9+
module BindingFixtures
10+
def self.yielder
11+
yield
12+
end
13+
end
14+
915
# Kernel#binding
1016
example "x = 14; binding.local_variable_get(:x)", 14
1117

@@ -23,13 +29,13 @@
2329
example "b = binding.dup; b.local_variable_set(:x, 14); b.local_variable_get(:x)", 14
2430

2531
# get (2 levels)
26-
example "x = 14; y = nil; 1.times { y = binding.local_variable_get(:x) }; y", 14
32+
example "x = 14; y = nil; BindingFixtures.yielder { y = binding.local_variable_get(:x) }; y", 14
2733

2834
# set (2 levels)
29-
example "x = nil; 1.times { binding.local_variable_set(:x, 15) }; x", 15
35+
example "x = nil; BindingFixtures.yielder { binding.local_variable_set(:x, 15) }; x", 15
3036

3137
# get + set (2 levels)
32-
example "x = 14; y = nil; 1.times { binding.local_variable_set(:x, 15); y = binding.local_variable_get(:x) }; y", 15
38+
example "x = 14; y = nil; BindingFixtures.yielder { binding.local_variable_set(:x, 15); y = binding.local_variable_get(:x) }; y", 15
3339

3440
# defined
3541

0 commit comments

Comments
 (0)