@@ -1094,6 +1094,25 @@ fn test4();")
1094
1094
(beginning-of-defun 2 )
1095
1095
(should (eq (point ) fn-1)))))
1096
1096
1097
+ (ert-deftest rust-beginning-of-defun-pub-scoped ()
1098
+ (let (fn-1-start fn-1-end fn-2-start fn-2-end)
1099
+ (with-temp-buffer
1100
+ (rust-mode )
1101
+ (setq fn-1-start (point ))
1102
+ (insert " pub(crate::mod1) fn test2() {}\n " )
1103
+ (setq fn-1-end (point ))
1104
+ (setq fn-2-start (point ))
1105
+ (insert " pub(self) fn test1() {}\n " )
1106
+ (setq fn-3-end (point ))
1107
+
1108
+ (goto-char (point-max ))
1109
+
1110
+ (beginning-of-defun )
1111
+ (should (eq (point ) fn-2-start))
1112
+
1113
+ (beginning-of-defun )
1114
+ (should (eq (point ) fn-1-start)))))
1115
+
1097
1116
(ert-deftest rust-end-of-defun-from-middle-of-fn ()
1098
1117
(rust-test-motion
1099
1118
rust-test-motion-string
@@ -1136,6 +1155,25 @@ fn test4();")
1136
1155
'between-fn1-fn2
1137
1156
#'end-of-defun -2 ))
1138
1157
1158
+ (ert-deftest rust-end-of-defun-pub-scoped ()
1159
+ (let (fn-1-start fn-1-end fn-2-start fn-2-end)
1160
+ (with-temp-buffer
1161
+ (rust-mode )
1162
+ (setq fn-1-start (point ))
1163
+ (insert " pub(crate::mod1) fn test2() {}\n " )
1164
+ (setq fn-1-end (point ))
1165
+ (setq fn-2-start (point ))
1166
+ (insert " pub(self) fn test1() {}\n " )
1167
+ (setq fn-2-end (point ))
1168
+
1169
+ (goto-char (point-min ))
1170
+
1171
+ (end-of-defun )
1172
+ (should (eq (point ) fn-1-end))
1173
+
1174
+ (end-of-defun )
1175
+ (should (eq (point ) fn-2-end)))))
1176
+
1139
1177
(ert-deftest rust-mark-defun-from-middle-of-fn ()
1140
1178
(rust-test-region
1141
1179
rust-test-region-string
0 commit comments