emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/dart-mode 25a0b8a 128/192: Add tests for dart-format


From: ELPA Syncer
Subject: [nongnu] elpa/dart-mode 25a0b8a 128/192: Add tests for dart-format
Date: Sun, 29 Aug 2021 11:02:04 -0400 (EDT)

branch: elpa/dart-mode
commit 25a0b8ae14152fe90b7fd35f000f5903c3a827fd
Author: Brady Trainor <mail@bradyt.com>
Commit: Brady Trainor <mail@bradyt.com>

    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

[Prev in Thread] Current Thread [Next in Thread]