|
218 | 218 | ;; testing inserting parens and the automatic-parens prefs
|
219 | 219 | ;;
|
220 | 220 |
|
221 |
| -(define (type-something to-type [control-down #f]) |
| 221 | +(define (type-something to-type |
| 222 | + #:control-down [control-down #f] |
| 223 | + #:stop-colorer? [stop-colorer? #f]) |
222 | 224 | (define f (new frame:basic% [label ""]))
|
223 | 225 | (define t (new racket:text%))
|
224 | 226 | (define ec (new canvas:basic%
|
225 | 227 | [parent (send f get-area-container)]
|
226 | 228 | [editor t]))
|
| 229 | + (when stop-colorer? (send t stop-colorer)) |
227 | 230 | (send t on-char (new key-event% [key-code to-type] [control-down control-down]))
|
228 | 231 | (send t get-text))
|
229 | 232 |
|
|
235 | 238 | (check-equal? (type-something #\() "(")
|
236 | 239 | (check-equal? (type-something #\[) "[")
|
237 | 240 | (check-equal? (type-something #\") "\"")
|
| 241 | + (check-equal? (type-something #\( #:stop-colorer? #t) "(") |
| 242 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[") |
| 243 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"") |
238 | 244 |
|
239 | 245 | (preferences:set 'framework:automatic-parens #t)
|
240 | 246 | (check-equal? (type-something #\() "()")
|
241 | 247 | (check-equal? (type-something #\[) "[]")
|
242 | 248 | (check-equal? (type-something #\") "\"\"")
|
| 249 | + (check-equal? (type-something #\( #:stop-colorer? #t) "()") |
| 250 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[]") |
| 251 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"\"") |
243 | 252 |
|
244 | 253 | (preferences:set 'framework:fixup-parens #f)
|
245 | 254 | (preferences:set 'framework:fixup-open-parens #t)
|
246 | 255 |
|
247 | 256 | (preferences:set 'framework:automatic-parens #f)
|
248 | 257 | (check-equal? (type-something #\() "(")
|
249 | 258 | (check-equal? (type-something #\[) "(")
|
250 |
| - (check-equal? (type-something #\[ #t) "[") |
| 259 | + (check-equal? (type-something #\[ #:control-down #t) "[") |
251 | 260 | (check-equal? (type-something #\") "\"")
|
| 261 | + (check-equal? (type-something #\( #:stop-colorer? #t) "(") |
| 262 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[") ;; if the colorer is off, no auto parens |
| 263 | + (check-equal? (type-something #\[ #:stop-colorer? #t #:control-down #t) "[") |
| 264 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"") |
252 | 265 | (preferences:set 'framework:automatic-parens #t)
|
253 | 266 | (check-equal? (type-something #\() "()")
|
254 | 267 | (check-equal? (type-something #\[) "()")
|
255 |
| - (check-equal? (type-something #\[ #t) "[]") |
| 268 | + (check-equal? (type-something #\[ #:control-down #t) "[]") |
256 | 269 | (check-equal? (type-something #\") "\"\"")
|
| 270 | + (check-equal? (type-something #\( #:stop-colorer? #t) "()") |
| 271 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[]") ;; if the colorer is off, no auto parens |
| 272 | + (check-equal? (type-something #\[ #:stop-colorer? #t #:control-down #t) "[]") |
| 273 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"\"") |
257 | 274 |
|
258 | 275 | (preferences:set 'framework:fixup-parens #t)
|
259 | 276 | (preferences:set 'framework:fixup-open-parens #f)
|
|
262 | 279 | (check-equal? (type-something #\() "(")
|
263 | 280 | (check-equal? (type-something #\[) "[")
|
264 | 281 | (check-equal? (type-something #\") "\"")
|
| 282 | + (check-equal? (type-something #\( #:stop-colorer? #t) "(") |
| 283 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[") |
| 284 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"") |
265 | 285 | (preferences:set 'framework:automatic-parens #t)
|
266 |
| - (check-equal? (type-something #\() "()") |
267 |
| - (check-equal? (type-something #\[) "[]") |
268 |
| - (check-equal? (type-something #\") "\"\"") |
| 286 | + (check-equal? (type-something #\( #:stop-colorer? #t) "()") |
| 287 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[]") |
| 288 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"\"") |
269 | 289 |
|
270 | 290 | (preferences:set 'framework:fixup-parens #t)
|
271 | 291 | (preferences:set 'framework:fixup-open-parens #t)
|
|
274 | 294 | (check-equal? (type-something #\() "(")
|
275 | 295 | (check-equal? (type-something #\[) "(")
|
276 | 296 | (check-equal? (type-something #\") "\"")
|
| 297 | + (check-equal? (type-something #\( #:stop-colorer? #t) "(") |
| 298 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[") ;; if the colorer is off, no auto parens |
| 299 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"") |
277 | 300 | (preferences:set 'framework:automatic-parens #t)
|
278 | 301 | (check-equal? (type-something #\() "()")
|
279 | 302 | (check-equal? (type-something #\[) "()")
|
280 |
| - (check-equal? (type-something #\") "\"\"")) |
| 303 | + (check-equal? (type-something #\") "\"\"") |
| 304 | + (check-equal? (type-something #\( #:stop-colorer? #t) "()") |
| 305 | + (check-equal? (type-something #\[ #:stop-colorer? #t) "[]") ;; if the colorer is off, no auto parens |
| 306 | + (check-equal? (type-something #\" #:stop-colorer? #t) "\"\"")) |
281 | 307 |
|
282 | 308 |
|
283 | 309 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
0 commit comments