mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	add a test for getc with stateful conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									b661bfe319
								
							
						
					
					
						commit
						f905704727
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -223,6 +223,17 @@ EOT
 | 
			
		|||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_getc_stateful_conversion
 | 
			
		||||
    with_tmpdir {
 | 
			
		||||
      src = "\e$B\x23\x30\x23\x31\e(B".force_encoding("iso-2022-jp")
 | 
			
		||||
      generate_file('tmp', src)
 | 
			
		||||
      open("tmp", "r:iso-2022-jp:euc-jp") {|f|
 | 
			
		||||
        assert_equal("\xa3\xb0".force_encoding("euc-jp"), f.getc)
 | 
			
		||||
        assert_equal("\xa3\xb1".force_encoding("euc-jp"), f.getc)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_open_ascii
 | 
			
		||||
    with_tmpdir {
 | 
			
		||||
      src = "abc\n"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue