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

Unified Diff: test/command_line_test.dart

Issue 2333373003: Add a command-line option to set the exit code on a formatting change. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « lib/src/formatter_options.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/command_line_test.dart
diff --git a/test/command_line_test.dart b/test/command_line_test.dart
index 425143d01d4f1adc865756f7fdc4522beb594d9b..e1058598a8ccb4dad7c98a195d30156cc37ea0b3 100644
--- a/test/command_line_test.dart
+++ b/test/command_line_test.dart
@@ -210,6 +210,29 @@ void main() {
});
});
+ group("--set-exit-if-changed", () {
+ test("gives exit code 0 if there are no changes", () {
+ d.dir("code", [d.file("a.dart", formattedSource)]).create();
+
+ var process = runFormatterOnDir(["--set-exit-if-changed"]);
+ process.shouldExit(0);
+ });
+
+ test("gives exit code 1 if there are changes", () {
+ d.dir("code", [d.file("a.dart", unformattedSource)]).create();
+
+ var process = runFormatterOnDir(["--set-exit-if-changed"]);
+ process.shouldExit(1);
+ });
+
+ test("gives exit code 1 if there are changes even in dry run", () {
+ d.dir("code", [d.file("a.dart", unformattedSource)]).create();
+
+ var process = runFormatterOnDir(["--set-exit-if-changed", "--dry-run"]);
+ process.shouldExit(1);
+ });
+ });
+
group("with no paths", () {
test("errors on --overwrite", () {
var process = runFormatter(["--overwrite"]);
« no previous file with comments | « lib/src/formatter_options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698