Update tests helper to check time
This commit is contained in:
		
							parent
							
								
									2ae0653af2
								
							
						
					
					
						commit
						0790ff6937
					
				| @ -27,7 +27,7 @@ func AssertEqual(t *testing.T, got, expect interface{}) { | ||||
| 			if curTime, ok := got.(time.Time); ok { | ||||
| 				format := "2006-01-02T15:04:05Z07:00" | ||||
| 
 | ||||
| 				if curTime.Round(time.Second).Format(format) != expect.(time.Time).Round(time.Second).Format(format) && curTime.Truncate(time.Second).Format(format) != expect.(time.Time).Truncate(time.Second).Format(format) { | ||||
| 				if curTime.Round(time.Second).UTC().Format(format) != expect.(time.Time).Round(time.Second).UTC().Format(format) && curTime.Truncate(time.Second).UTC().Format(format) != expect.(time.Time).Truncate(time.Second).UTC().Format(format) { | ||||
| 					t.Errorf("%v: expect: %v, got %v after time round", utils.FileWithLineNum(), expect.(time.Time), curTime) | ||||
| 				} | ||||
| 			} else if fmt.Sprint(got) != fmt.Sprint(expect) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jinzhu
						Jinzhu