@@ -488,6 +488,26 @@ struct Foo {
488
488
}
489
489
"
490
490
rust-test-region-string rust-test-motion-string
491
+ rust-test-indent-motion-string
492
+ "
493
+ fn blank_line(arg:int) -> bool {
494
+
495
+ }
496
+
497
+ fn indenting_closing_brace() {
498
+ if(true) {
499
+ }
500
+ }
501
+
502
+ fn indenting_middle_of_line() {
503
+ if(true) {
504
+ push_me_out();
505
+ } else {
506
+ pull_me_back_in();
507
+ }
508
+ }
509
+ "
510
+
491
511
; ; Symbol -> (line column)
492
512
rust-test-positions-alist '((start-of-fn1 (2 0 ))
493
513
(start-of-fn1-middle-of-line (2 15 ))
@@ -502,7 +522,17 @@ struct Foo {
502
522
(middle-of-fn3 (16 4 ))
503
523
(middle-of-struct (21 10 ))
504
524
(before-start-of-struct (19 0 ))
505
- (after-end-of-struct (23 0 ))))
525
+ (after-end-of-struct (23 0 ))
526
+ (blank-line-indent-start (3 0 ))
527
+ (blank-line-indent-target (3 4 ))
528
+ (closing-brace-indent-start (8 1 ))
529
+ (closing-brace-indent-target (8 5 ))
530
+ (middle-push-indent-start (13 2 ))
531
+ (middle-push-indent-target (13 9 ))
532
+ (after-whitespace-indent-start (13 1 ))
533
+ (after-whitespace-indent-target (13 8 ))
534
+ (middle-pull-indent-start (15 19 ))
535
+ (middle-pull-indent-target (15 12 ))))
506
536
507
537
(defun rust-get-buffer-pos (pos-symbol )
508
538
" Get buffer position from POS-SYMBOL.
@@ -664,3 +694,38 @@ All positions are position symbols found in `rust-test-positions-alist'."
664
694
'middle-of-struct
665
695
'before-start-of-struct 'after-end-of-struct
666
696
#'mark-defun ))
697
+
698
+ (ert-deftest indent-line-blank-line-motion ()
699
+ (rust-test-motion
700
+ rust-test-indent-motion-string
701
+ 'blank-line-indent-start
702
+ 'blank-line-indent-target
703
+ #'indent-for-tab-command ))
704
+
705
+ (ert-deftest indent-line-closing-brace-motion ()
706
+ (rust-test-motion
707
+ rust-test-indent-motion-string
708
+ 'closing-brace-indent-start
709
+ 'closing-brace-indent-target
710
+ #'indent-for-tab-command ))
711
+
712
+ (ert-deftest indent-line-middle-push-motion ()
713
+ (rust-test-motion
714
+ rust-test-indent-motion-string
715
+ 'middle-push-indent-start
716
+ 'middle-push-indent-target
717
+ #'indent-for-tab-command ))
718
+
719
+ (ert-deftest indent-line-after-whitespace-motion ()
720
+ (rust-test-motion
721
+ rust-test-indent-motion-string
722
+ 'after-whitespace-indent-start
723
+ 'after-whitespace-indent-target
724
+ #'indent-for-tab-command ))
725
+
726
+ (ert-deftest indent-line-middle-pull-motion ()
727
+ (rust-test-motion
728
+ rust-test-indent-motion-string
729
+ 'middle-pull-indent-start
730
+ 'middle-pull-indent-target
731
+ #'indent-for-tab-command ))
0 commit comments