-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move use_full_hex_values_for_flutter_colors tests (dart-lang/linter#4527
- Loading branch information
Showing
3 changed files
with
112 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
test/rules/use_full_hex_values_for_flutter_colors_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import '../rule_test_support.dart'; | ||
|
||
main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(UseFullHexValuesForFlutterColorsTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class UseFullHexValuesForFlutterColorsTest extends LintRuleTest { | ||
@override | ||
String get lintRule => 'use_full_hex_values_for_flutter_colors'; | ||
|
||
test_dynamicArgument() async { | ||
await assertNoDiagnostics(r''' | ||
library dart.ui; | ||
class Color { | ||
Color(int v); | ||
} | ||
void f(dynamic a) { | ||
Color(a); | ||
} | ||
'''); | ||
} | ||
|
||
test_eightDigitHex_lower() async { | ||
await assertNoDiagnostics(r''' | ||
library dart.ui; | ||
class Color { | ||
Color(int v); | ||
} | ||
void f() { | ||
Color(0x00000000); | ||
} | ||
'''); | ||
} | ||
|
||
test_eightDigitHex_upper() async { | ||
await assertNoDiagnostics(r''' | ||
library dart.ui; | ||
class Color { | ||
Color(int v); | ||
} | ||
void f() { | ||
Color(0X00000000); | ||
} | ||
'''); | ||
} | ||
|
||
test_nonHex() async { | ||
await assertDiagnostics(r''' | ||
library dart.ui; | ||
class Color { | ||
Color(int v); | ||
} | ||
void f() { | ||
Color(1); | ||
} | ||
''', [ | ||
lint(70, 1), | ||
]); | ||
} | ||
|
||
test_sixDigitHex_lower() async { | ||
await assertDiagnostics(r''' | ||
library dart.ui; | ||
class Color { | ||
Color(int v); | ||
} | ||
void f() { | ||
Color(0x000000); | ||
} | ||
''', [ | ||
lint(70, 8), | ||
]); | ||
} | ||
|
||
test_sixDigitHex_upper() async { | ||
await assertDiagnostics(r''' | ||
library dart.ui; | ||
class Color { | ||
Color(int v); | ||
} | ||
void f() { | ||
Color(0X000000); | ||
} | ||
''', [ | ||
lint(70, 8), | ||
]); | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
test_data/rules/use_full_hex_values_for_flutter_colors.dart
This file was deleted.
Oops, something went wrong.