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

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

[nongnu] elpa/typescript-mode 710f5425a4 189/222: Add tests for typescri


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode 710f5425a4 189/222: Add tests for typescript-indent-list-items option
Date: Sun, 6 Feb 2022 16:59:31 -0500 (EST)

branch: elpa/typescript-mode
commit 710f5425a439a2cdde01681e95d907c1fa3729be
Author: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Commit: Ivan Sokolov <ivan-p-sokolov@ya.ru>

    Add tests for typescript-indent-list-items option
---
 test-files/list-items-indent-comma-first.ts | 10 ++++-----
 test-files/list-items-indent-default.ts     | 22 +++++++++++++++++++
 typescript-mode-general-tests.el            | 34 +++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/test-files/list-items-indent-comma-first.ts 
b/test-files/list-items-indent-comma-first.ts
index 565489ead4..2a7485c89c 100644
--- a/test-files/list-items-indent-comma-first.ts
+++ b/test-files/list-items-indent-comma-first.ts
@@ -15,8 +15,8 @@ const depth = { arr: [ 'one'
                      , b: 222
                      , c: 333 }
               , func_call: Object.assign
-                           ( {}
-                           , { x: 1
-                             , y: 2
-                             , z: 3 }
-                           , { i: 'i', j: 'j' } ) };
+              ( {}
+              , { x: 1
+                , y: 2
+                , z: 3 }
+              , { i: 'i', j: 'j' } ) };
diff --git a/test-files/list-items-indent-default.ts 
b/test-files/list-items-indent-default.ts
new file mode 100644
index 0000000000..290c8250dc
--- /dev/null
+++ b/test-files/list-items-indent-default.ts
@@ -0,0 +1,22 @@
+const arr =
+    [ 'one'
+      , 'two'
+      , 'three' ];
+
+const obj =
+    { a: 111
+      , b: 222
+      , c: 333 };
+
+const depth = { arr: [ 'one'
+                       , 'two'
+                       , 'three' ]
+                , obj: { a: 111
+                         , b: 222
+                         , c: 333 }
+                , func_call: Object.assign
+                ( {}
+                  , { x: 1
+                      , y: 2
+                      , z: 3 }
+                  , { i: 'i', j: 'j' } ) };
diff --git a/typescript-mode-general-tests.el b/typescript-mode-general-tests.el
index 6e3f098aa7..aa1f1f8c78 100644
--- a/typescript-mode-general-tests.el
+++ b/typescript-mode-general-tests.el
@@ -52,6 +52,40 @@
                             (typescript-test-get-doc))))
     (kill-buffer buffer)))
 
+(ert-deftest list-items-indent-default ()
+  (with-current-buffer (find-file "test-files/list-items-indent-default.ts")
+    (typescript-mode)
+    (let ((test-reference (typescript-test-get-doc)))
+      (typescript-test-indent-all)
+      (should (string= test-reference (typescript-test-get-doc))))
+    (kill-buffer)))
+
+(ert-deftest list-items-indent-default-not-comma-first ()
+  (with-current-buffer (find-file 
"test-files/list-items-indent-comma-first.ts")
+    (typescript-mode)
+    (let ((test-reference (typescript-test-get-doc)))
+      (typescript-test-indent-all)
+      (should (not (string= test-reference (typescript-test-get-doc)))))
+    (kill-buffer)))
+
+(ert-deftest list-items-indent-comma-first ()
+  (with-current-buffer (find-file 
"test-files/list-items-indent-comma-first.ts")
+    (typescript-mode)
+    (let ((test-reference (typescript-test-get-doc))
+          (typescript-indent-list-items nil))
+      (typescript-test-indent-all)
+      (should (string= test-reference (typescript-test-get-doc))))
+    (kill-buffer)))
+
+(ert-deftest list-items-indent-comma-first-not-default ()
+  (with-current-buffer (find-file "test-files/list-items-indent-default.ts")
+    (typescript-mode)
+    (let ((test-reference (typescript-test-get-doc))
+          (typescript-indent-list-items nil))
+      (typescript-test-indent-all)
+      (should (not (string= test-reference (typescript-test-get-doc)))))
+    (kill-buffer)))
+
 (defun get-all-matched-strings (to-match)
   (let (result)
     (dotimes (x (/ (length (match-data)) 2))



reply via email to

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