Mercurial > hg > xemacs-beta
comparison tests/automated/syntax-tests.el @ 460:223736d75acb r21-2-45
Import from CVS: tag r21-2-45
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:43:24 +0200 |
parents | 74fd4e045ea6 |
children | ea6a06f7bf2c |
comparison
equal
deleted
inserted
replaced
459:9d4fd877b885 | 460:223736d75acb |
---|---|
98 ;; BOB W NW -!- | 98 ;; BOB W NW -!- |
99 (test-backward-word "W " 2) | 99 (test-backward-word "W " 2) |
100 (test-backward-word "WO " 3) | 100 (test-backward-word "WO " 3) |
101 (test-backward-word "W !" 3) | 101 (test-backward-word "W !" 3) |
102 (test-backward-word "WO !" 4)) | 102 (test-backward-word "WO !" 4)) |
103 | |
104 ;; Works like test-forward-word, except for the following: | |
105 ;; after <string> is inserted, the syntax-table <apply-syntax> | |
106 ;; is applied to position <apply-pos>. | |
107 ;; <apply-pos> can be in the form (start . end), or can be a | |
108 ;; character position. | |
109 (defun test-syntax-table (string apply-pos apply-syntax stop) | |
110 (goto-char (point-max)) | |
111 (unless (consp apply-pos) | |
112 (setq apply-pos `(,apply-pos . ,(+ 1 apply-pos)))) | |
113 (let ((point (point))) | |
114 (insert string) | |
115 (put-text-property (+ point (car apply-pos)) (+ point (cdr apply-pos)) | |
116 'syntax-table apply-syntax) | |
117 (goto-char point) | |
118 (forward-word 1) | |
119 (Assert (eq (point) (+ point stop))))) | |
120 | |
121 ;; test syntax-table extents | |
122 (with-temp-buffer | |
123 ;; Apply punctuation to word | |
124 (test-syntax-table "WO" 1 `(,(syntax-string-to-code ".")) 1) | |
125 ;; Apply word to punctuation | |
126 (test-syntax-table "W." 1 `(,(syntax-string-to-code "w")) 2)) | |
127 | |
128 ;; Test forward-comment at buffer boundaries | |
129 (with-temp-buffer | |
130 (c-mode) | |
131 (insert "// comment\n") | |
132 (forward-comment -2) | |
133 (Assert (eq (point) (point-min))) | |
134 | |
135 (let ((point (point))) | |
136 (insert "/* comment */") | |
137 (goto-char point) | |
138 (forward-comment 2) | |
139 (Assert (eq (point) (point-max))) | |
140 | |
141 ;; this last used to crash | |
142 (parse-partial-sexp point (point-max)))) |