branch: elpa/dart-mode
commit 25a0b8ae14152fe90b7fd35f000f5903c3a827fd
Author: Brady Trainor <[email protected]>
Commit: Brady Trainor <[email protected]>

    Add tests for dart-format
    
    Tests are rudimentary.
    
    Open file test/idempotent.dart, format with C-c C-o, and we find that
    dart-format is not idempotent. After third call dart-format is
    idempotent, in this case.
    
    Open test/breaks.dart, and C-c C-o changes code, not just whitespace.
---
 test/breaks.dart     | 18 ++++++++++++++++++
 test/idempotent.dart | 12 ++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/test/breaks.dart b/test/breaks.dart
new file mode 100644
index 0000000..3fc7a12
--- /dev/null
+++ b/test/breaks.dart
@@ -0,0 +1,18 @@
+class _LoginPageState extends State<LoginPage> {
+  Widget build(BuildContext context) {
+    return new Scaffold(
+      body: new SafeArea(
+        child: new ListView(
+          padding: const EdgeInsets.symmetric(horizontal: 24.0),
+          children: <Widget>[
+            new Column(
+            ),
+            const SizedBox(height: 120.0),
+            TextField(
+              decoration: InputDecoration(
+                filled: true,
+              ),
+            ),
+    ])));
+  }
+}
\ No newline at end of file
diff --git a/test/idempotent.dart b/test/idempotent.dart
new file mode 100644
index 0000000..22fd62c
--- /dev/null
+++ b/test/idempotent.dart
@@ -0,0 +1,12 @@
+class DartFormatter {
+  DartFormatter(
+      {this.lineEnding, int pageWidth, int indent, Iterable<StyleFix> fixes})
+      : pageWidth = pageWidth ?? 80,
+        indent = indent ?? 0 {}
+
+  String format(String source, {uri}) {
+    return formatSource(
+            new SourceCode(source, uri: uri, isCompilationUnit: true))
+        .text;
+  }
+}
\ No newline at end of file

Reply via email to