mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Update to ruby/spec@c6e9285
This commit is contained in:
		
							parent
							
								
									22e2a6a999
								
							
						
					
					
						commit
						750f807575
					
				
					 4 changed files with 19 additions and 22 deletions
				
			
		|  | @ -1,9 +1,3 @@ | |||
| begin | ||||
|   require 'syck' | ||||
| rescue LoadError | ||||
|   # do nothing | ||||
| end | ||||
| 
 | ||||
| require 'yaml' | ||||
| 
 | ||||
| $test_file = tmp("yaml_test_file") | ||||
|  |  | |||
|  | @ -1,8 +1,10 @@ | |||
| require_relative '../../spec_helper' | ||||
| require_relative 'shared/load' | ||||
| 
 | ||||
| ruby_version_is ""..."3.1" do | ||||
|   describe "YAML.load" do | ||||
|     it_behaves_like :yaml_load, :load | ||||
| describe "YAML.load" do | ||||
|   it_behaves_like :yaml_load_safe, :load | ||||
| 
 | ||||
|   guard -> { Psych::VERSION < "4.0.0" } do | ||||
|     it_behaves_like :yaml_load_unsafe, :load | ||||
|   end | ||||
| end | ||||
|  |  | |||
|  | @ -1,16 +1,14 @@ | |||
| require_relative '../fixtures/common' | ||||
| require_relative '../fixtures/strings' | ||||
| 
 | ||||
| describe :yaml_load, shared: true do | ||||
|   after :each do | ||||
|     rm_r $test_file | ||||
|   end | ||||
| 
 | ||||
| describe :yaml_load_safe, shared: true do | ||||
|   it "returns a document from current io stream when io provided" do | ||||
|     File.open($test_file, 'w') do |io| | ||||
|       YAML.dump( ['badger', 'elephant', 'tiger'], io ) | ||||
|     end | ||||
|     File.open($test_file) { |yf| YAML.send(@method,  yf ) }.should == ['badger', 'elephant', 'tiger'] | ||||
|   ensure | ||||
|     rm_r $test_file | ||||
|   end | ||||
| 
 | ||||
|   it "loads strings" do | ||||
|  | @ -90,6 +88,14 @@ describe :yaml_load, shared: true do | |||
|     YAML.send(@method, block_seq).should == [[["one", "two", "three"]]] | ||||
|   end | ||||
| 
 | ||||
|   it "loads a symbol key that contains spaces" do | ||||
|     string = ":user name: This is the user name." | ||||
|     expected = { :"user name" => "This is the user name."} | ||||
|     YAML.send(@method, string).should == expected | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| describe :yaml_load_unsafe, shared: true do | ||||
|   it "works on complex keys" do | ||||
|     require 'date' | ||||
|     expected = { | ||||
|  | @ -101,12 +107,6 @@ describe :yaml_load, shared: true do | |||
|     YAML.send(@method, $complex_key_1).should == expected | ||||
|   end | ||||
| 
 | ||||
|   it "loads a symbol key that contains spaces" do | ||||
|     string = ":user name: This is the user name." | ||||
|     expected = { :"user name" => "This is the user name."} | ||||
|     YAML.send(@method, string).should == expected | ||||
|   end | ||||
| 
 | ||||
|   describe "with iso8601 timestamp" do | ||||
|     it "computes the microseconds" do | ||||
|       [ [YAML.send(@method, "2011-03-22t23:32:11.2233+01:00"),   223300], | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| require_relative '../../spec_helper' | ||||
| require_relative 'shared/load' | ||||
| 
 | ||||
| ruby_version_is "3.1" do | ||||
| guard -> { Psych::VERSION >= "4.0.0" } do | ||||
|   describe "YAML.unsafe_load" do | ||||
|     it_behaves_like :yaml_load, :unsafe_load | ||||
|     it_behaves_like :yaml_load_safe, :unsafe_load | ||||
|     it_behaves_like :yaml_load_unsafe, :unsafe_load | ||||
|   end | ||||
| end | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Benoit Daloze
						Benoit Daloze