Null tests
This commit is contained in:
		
							parent
							
								
									f6fcf11dd0
								
							
						
					
					
						commit
						6a6b8b785a
					
				
							
								
								
									
										24
									
								
								tests/null_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								tests/null_test.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
package tests
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/localhots/bocadillo/mysql"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestNull(t *testing.T) {
 | 
			
		||||
	tbl := suite.createTable(mysql.ColumnTypeTiny, "", attrUnsigned|attrAllowNull)
 | 
			
		||||
	defer tbl.drop(t)
 | 
			
		||||
 | 
			
		||||
	uint8p := func(v uint8) *uint8 { return &v }
 | 
			
		||||
	for _, v := range []*uint8{uint8p(0), uint8p(1), nil} {
 | 
			
		||||
		strv := "NULL"
 | 
			
		||||
		if v != nil {
 | 
			
		||||
			strv = fmt.Sprint(*v)
 | 
			
		||||
		}
 | 
			
		||||
		t.Run(strv, func(t *testing.T) {
 | 
			
		||||
			suite.insertAndCompare(t, tbl, v)
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user