mirror of
				https://github.com/mgechev/revive.git
				synced 2025-10-30 23:37:49 +02:00 
			
		
		
		
	chore: improve time-date decimal tests (#1378)
We want to ensure that the decimal literal are also detected in functions, and not just at the package level. This is a safeguard against future changes.
This commit is contained in:
		
							
								
								
									
										9
									
								
								testdata/time_date_decimal_literal.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								testdata/time_date_decimal_literal.go
									
									
									
									
										vendored
									
									
								
							| @@ -71,6 +71,15 @@ var ( | ||||
| 		time.UTC) | ||||
| ) | ||||
|  | ||||
| // here we are checking that we also detect non-decimal notation in methods/functions/lambdas | ||||
| func _() { | ||||
| 	_ = time.Date(2023, 01, 2, 3, 4, 5, 6, time.UTC) // MATCH /use decimal digits for time.Date month argument: octal notation with leading zero found: use 1 instead of 01/ | ||||
|  | ||||
| 	_ = func() time.Time { | ||||
| 		return time.Date(2023, 01, 2, 3, 4, 5, 6, time.UTC) // MATCH /use decimal digits for time.Date month argument: octal notation with leading zero found: use 1 instead of 01/ | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // these should never match | ||||
| var ( | ||||
| 	_ = time.Date(2023, 1, 2, 3, 4, 5, 1234567, time.UTC) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user