Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: test/rules/whitespace_around_ops.dart

Issue 2159123003: New `whitespace_around_ops` lint (#249). (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/rules/whitespace_around_ops.dart
diff --git a/test/rules/whitespace_around_ops.dart b/test/rules/whitespace_around_ops.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c7346d6234d8578568e21f0838d48b6ba2decf86
--- /dev/null
+++ b/test/rules/whitespace_around_ops.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2016, 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.
+
+// test w/ `dart test/util/solo_test.dart whitespace_around_ops`
+
+
+// Define our own int so we don't need `int` in our mock SDK.
+class MyInt {
+ MyInt operator -() => this;
+ MyInt operator ~() => this;
+ MyInt operator ~/(MyInt other) => this;
+ MyInt operator /(MyInt other) => this;
+}
+
+void main() {
+ MyInt f, g;
+ print(f ~/ g);
+ print(f~/ g); //LINT
+ print(f ~/g); //LINT
+ print(f~/g); //LINT
+ print(f/ ~g); //LINT
+ print(f /~g); //LINT
+ print(f / ~g); //OK
+ f =- g; //LINT
+ f = -g; //OK
+}
« lib/src/rules/whitespace_around_ops.dart ('K') | « lib/src/rules/whitespace_around_ops.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698