File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11require_relative '../../spec_helper'
22require_relative '../enumerable/shared/enumeratorized'
3- require_relative 'fixtures/common'
43
54describe "ENV.each_key" do
65
2524 enum . to_a . should == ENV . keys
2625 end
2726
28- it "returns keys in the locale encoding" do
29- ENV . each_key do |key |
30- key . encoding . should == ENVSpecs . encoding
27+ platform_is_not :windows do
28+ it "returns keys in the locale encoding" do
29+ ENV . each_key do |key |
30+ key . encoding . should == Encoding . find ( 'locale' )
31+ end
32+ end
33+ end
34+
35+ # https://bugs.ruby-lang.org/issues/20958
36+ platform_is :windows do
37+ ruby_version_is "" ..."4.1" do
38+ it "returns keys in the locale encoding" do
39+ ENV . each_key do |key |
40+ key . encoding . should == Encoding . find ( 'locale' )
41+ end
42+ end
43+ end
44+
45+ ruby_version_is "4.1" do
46+ it "returns the keys in UTF-8" do
47+ ENV . each_key do |key |
48+ key . encoding . should == Encoding ::UTF_8
49+ end
50+ end
3151 end
3252 end
3353
Original file line number Diff line number Diff line change 11module ENVSpecs
22 def self . encoding
3- locale = Encoding . find ( 'locale' )
4- if ruby_version_is '3' and platform_is :windows
5- locale = Encoding ::UTF_8
6- end
7- locale
3+ return Encoding ::UTF_8 if platform_is :windows
4+
5+ Encoding . find ( 'locale' )
86 end
97end
Original file line number Diff line number Diff line change 11require_relative '../../spec_helper'
2- require_relative 'fixtures/common'
32
43describe "ENV.keys" do
54
65 it "returns an array of the keys" do
76 ENV . keys . should == ENV . to_hash . keys
87 end
98
10- it "returns the keys in the locale encoding" do
11- ENV . keys . each do |key |
12- key . encoding . should == ENVSpecs . encoding
9+ platform_is_not :windows do
10+ it "returns the keys in the locale encoding" do
11+ ENV . keys . each do |key |
12+ key . encoding . should == Encoding . find ( 'locale' )
13+ end
14+ end
15+ end
16+
17+ # https://bugs.ruby-lang.org/issues/20958
18+ platform_is :windows do
19+ ruby_version_is "" ..."4.1" do
20+ it "returns the keys in the locale encoding" do
21+ ENV . keys . each do |key |
22+ key . encoding . should == Encoding . find ( 'locale' )
23+ end
24+ end
25+ end
26+
27+ ruby_version_is "4.1" do
28+ it "returns the keys in UTF-8" do
29+ ENV . keys . each do |key |
30+ key . encoding . should == Encoding ::UTF_8
31+ end
32+ end
1333 end
1434 end
1535end
You can’t perform that action at this time.
0 commit comments