Updated to return bool false only for zero
This commit is contained in:
		
							джерело
							
								
									770890fb15
								
							
						
					
					
						коміт
						ed6dd5ade6
					
				@ -61,4 +61,5 @@ func TestToBool(t *testing.T) {
 | 
			
		||||
	assert.Equal(t, ToBool("T"), true)
 | 
			
		||||
	assert.Equal(t, ToBool(1), true)
 | 
			
		||||
	assert.Equal(t, ToBool(true), true)
 | 
			
		||||
	assert.Equal(t, ToBool(-1), true)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								caste.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								caste.go
									
									
									
									
									
								
							@ -41,7 +41,7 @@ func ToBoolE(i interface{}) (bool, error) {
 | 
			
		||||
	case nil:
 | 
			
		||||
		return false, nil
 | 
			
		||||
	case int:
 | 
			
		||||
		if i.(int) > 0 {
 | 
			
		||||
		if i.(int) != 0 {
 | 
			
		||||
			return true, nil
 | 
			
		||||
		}
 | 
			
		||||
		return false, nil
 | 
			
		||||
 | 
			
		||||
		Завантаження…
	
		Посилання в новій задачі
	
	Block a user