mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Fixed formatted substring expansion [Bug #16767]
This commit is contained in:
		
							parent
							
								
									1711258144
								
							
						
					
					
						commit
						2f1895fa15
					
				
					 2 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -331,7 +331,9 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
 | 
			
		|||
			s += len; \
 | 
			
		||||
			if (i > 0) case_conv(s, i, flags); \
 | 
			
		||||
			if (precision > i) {\
 | 
			
		||||
				s += i; \
 | 
			
		||||
				NEEDS(precision); \
 | 
			
		||||
				s -= i; \
 | 
			
		||||
				memmove(s + precision - i, s, i);\
 | 
			
		||||
				memset(s, padding ? padding : ' ', precision - i); \
 | 
			
		||||
				s += precision;	\
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -893,6 +893,13 @@ class TestTime < Test::Unit::TestCase
 | 
			
		|||
    assert_equal(8192, Time.now.strftime('%8192z').size)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_strftime_wide_precision
 | 
			
		||||
    t2000 = get_t2000
 | 
			
		||||
    s = t2000.strftime("%28c")
 | 
			
		||||
    assert_equal(28, s.size)
 | 
			
		||||
    assert_equal(t2000.strftime("%c"), s.strip)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_strfimte_zoneoffset
 | 
			
		||||
    t2000 = get_t2000
 | 
			
		||||
    t = t2000.getlocal("+09:00:00")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue