mirror of
				https://github.com/usememos/memos.git
				synced 2025-06-05 22:09:59 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			468 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			468 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package util
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
)
 | 
						|
 | 
						|
func TestValidateEmail(t *testing.T) {
 | 
						|
	tests := []struct {
 | 
						|
		email string
 | 
						|
		want  bool
 | 
						|
	}{
 | 
						|
		{
 | 
						|
			email: "t@gmail.com",
 | 
						|
			want:  true,
 | 
						|
		},
 | 
						|
		{
 | 
						|
			email: "@qq.com",
 | 
						|
			want:  false,
 | 
						|
		},
 | 
						|
		{
 | 
						|
			email: "1@gmail",
 | 
						|
			want:  true,
 | 
						|
		},
 | 
						|
	}
 | 
						|
	for _, test := range tests {
 | 
						|
		result := ValidateEmail(test.email)
 | 
						|
		if result != test.want {
 | 
						|
			t.Errorf("Validate Email %s: got result %v, want %v.", test.email, result, test.want)
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 |