-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move valid_regexps tests * Update test/rules/valid_regexps_test.dart Co-authored-by: Albert Mañosa <[email protected]> --------- Co-authored-by: Albert Mañosa <[email protected]>
- Loading branch information
1 parent
ad42f65
commit d762056
Showing
3 changed files
with
51 additions
and
14 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
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,49 @@ | ||
// 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(ValidRegexpsTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class ValidRegexpsTest extends LintRuleTest { | ||
@override | ||
String get lintRule => 'valid_regexps'; | ||
|
||
test_emojis() async { | ||
// https://stackoverflow.com/questions/61151471/regexp-for-unicode-13-emojis | ||
await assertNoDiagnostics(r''' | ||
var e = RegExp( | ||
r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])', | ||
unicode: true); | ||
'''); | ||
} | ||
|
||
test_interpolation() async { | ||
await assertNoDiagnostics(r''' | ||
var r = ''; | ||
var s = RegExp('( $r'); | ||
'''); | ||
} | ||
|
||
test_invalid() async { | ||
await assertDiagnostics(r''' | ||
var s = RegExp('('); | ||
''', [ | ||
lint(15, 3), | ||
]); | ||
} | ||
|
||
test_valid() async { | ||
await assertNoDiagnostics(r''' | ||
var s = RegExp('[(]'); | ||
'''); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.