~ubuntu-branches/ubuntu/jaunty/python-docutils/jaunty

« back to all changes in this revision

Viewing changes to tools/editors/emacs/tests/tests-basic.el

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;; Authors: Martin Blais <blais@furius.ca>
 
2
;; Date: $Date: 2005/04/01 23:19:41 $
 
3
;; Copyright: This module has been placed in the public domain.
 
4
;;
 
5
;; Regression tests for rst-adjust-section-title.
 
6
;;
 
7
;; Run this with::
 
8
;;
 
9
;;    emacs --script tests-adjust-section.el
 
10
;;
 
11
;; See test-runner.el for documentation on how the format of tests.
 
12
 
 
13
 
 
14
;; Import the module from the file in the parent directory directly.
 
15
(add-to-list 'load-path ".")
 
16
(load "tests-runner.el")
 
17
(add-to-list 'load-path "..")
 
18
(load "rst.el")
 
19
 
 
20
;; (setq debug-on-error t)
 
21
 
 
22
 
 
23
(setq rst-line-homogeneous-p-tests
 
24
  '(
 
25
;;------------------------------------------------------------------------------
 
26
(simple "Blablabla bla@" nil)
 
27
(true "-----------@" ?-)
 
28
(indented "   -----------@" ?-)
 
29
(letter "aaaa@aaa" ?a)
 
30
(true2 "uuuuuuuuuuuuuuuuu@" ?u)
 
31
(misleading "--=---------@" nil)
 
32
(notstrip " uuuuuuuuuuuuuuuuu@" ?u)
 
33
(notstrip2 " uuuuuuuuuuuuuuuuu @" ?u)
 
34
(position "-------@----" ?-)
 
35
(one-char "-@" nil)
 
36
))
 
37
 
 
38
(progn
 
39
  (regression-test-compare-expect-values
 
40
   "Tests for predicate for one char line."
 
41
   rst-line-homogeneous-p-tests 'rst-line-homogeneous-p nil))
 
42
 
 
43
(setq rst-line-homogeneous-nodent-p-tests
 
44
  '(
 
45
;;------------------------------------------------------------------------------
 
46
(simple "Blablabla bla@" nil)
 
47
(true "-----------@" ?-)
 
48
(indented "   -----------@" nil)
 
49
(letter "aaaa@aaa" ?a)
 
50
(true2 "uuuuuuuuuuuuuuuuu@" ?u)
 
51
(misleading "--=---------@" nil)
 
52
(notstrip " uuuuuuuuuuuuuuuuu@" nil)
 
53
(notstrip2 " uuuuuuuuuuuuuuuuu @" nil)
 
54
(position "-------@----" ?-)
 
55
(one-char "-@" nil)
 
56
))
 
57
 
 
58
(progn
 
59
  (regression-test-compare-expect-values
 
60
   "Tests for predicate for one char line."
 
61
   rst-line-homogeneous-nodent-p-tests 'rst-line-homogeneous-nodent-p nil))
 
62
 
 
63
 
 
64
 
 
65
 
 
66
(setq rst-normalize-cursor-position-tests
 
67
      '(
 
68
;;------------------------------------------------------------------------------
 
69
(under
 
70
"
 
71
 
 
72
Du bon vin tous les jours.
 
73
@
 
74
"
 
75
"
 
76
 
 
77
@Du bon vin tous les jours.
 
78
 
 
79
"
 
80
)
 
81
 
 
82
;;------------------------------------------------------------------------------
 
83
(over
 
84
"
 
85
@
 
86
Du bon vin tous les jours.
 
87
 
 
88
"
 
89
"
 
90
 
 
91
@Du bon vin tous les jours.
 
92
 
 
93
"
 
94
)
 
95
 
 
96
;;------------------------------------------------------------------------------
 
97
(underline
 
98
"
 
99
 
 
100
Du bon vin tous les jours.
 
101
------@-----
 
102
"
 
103
"
 
104
 
 
105
@Du bon vin tous les jours.
 
106
-----------
 
107
"
 
108
)
 
109
 
 
110
;;------------------------------------------------------------------------------
 
111
(overline
 
112
"
 
113
------@-----
 
114
Du bon vin tous les jours.
 
115
 
 
116
"
 
117
"
 
118
-----------
 
119
@Du bon vin tous les jours.
 
120
 
 
121
"
 
122
)
 
123
 
 
124
;;------------------------------------------------------------------------------
 
125
(both
 
126
"
 
127
@-----------
 
128
Du bon vin tous les jours.
 
129
-----------
 
130
 
 
131
"
 
132
"
 
133
-----------
 
134
@Du bon vin tous les jours.
 
135
-----------
 
136
 
 
137
"
 
138
)
 
139
 
 
140
;;------------------------------------------------------------------------------
 
141
(joint
 
142
"
 
143
Du bon vin tous les jours.
 
144
@-----------
 
145
Du bon vin tous les jours.
 
146
-----------
 
147
 
 
148
"
 
149
"
 
150
@Du bon vin tous les jours.
 
151
-----------
 
152
Du bon vin tous les jours.
 
153
-----------
 
154
 
 
155
"
 
156
)
 
157
 
 
158
;;------------------------------------------------------------------------------
 
159
(separator
 
160
"
 
161
 
 
162
@-----------
 
163
 
 
164
"
 
165
"
 
166
 
 
167
@-----------
 
168
 
 
169
"
 
170
)
 
171
 
 
172
;;------------------------------------------------------------------------------
 
173
(between
 
174
"
 
175
Line 1
 
176
@
 
177
Line 2
 
178
 
 
179
"
 
180
"
 
181
@Line 1
 
182
 
 
183
Line 2
 
184
 
 
185
"
 
186
)
 
187
 
 
188
;;------------------------------------------------------------------------------
 
189
(between-2
 
190
"
 
191
=====================================
 
192
   Project Idea: Panorama Stitcher
 
193
====================================
 
194
 
 
195
:Author: Martin Blais <blais@furius.ca>
 
196
@
 
197
Another Title
 
198
=============
 
199
"
 
200
"
 
201
=====================================
 
202
   Project Idea: Panorama Stitcher
 
203
====================================
 
204
 
 
205
@:Author: Martin Blais <blais@furius.ca>
 
206
 
 
207
Another Title
 
208
=============
 
209
"
 
210
)
 
211
 
 
212
))
 
213
 
 
214
 
 
215
(progn
 
216
  (regression-test-compare-expect-buffer
 
217
   "Test preparation of cursor position."
 
218
   rst-normalize-cursor-position-tests 'rst-normalize-cursor-position nil))
 
219
 
 
220
 
 
221
 
 
222
 
 
223
 
 
224
 
 
225
 
 
226
(setq rst-get-decoration-tests
 
227
      '(
 
228
;;------------------------------------------------------------------------------
 
229
(nodec-1
 
230
"
 
231
 
 
232
@Du bon vin tous les jours
 
233
 
 
234
"
 
235
(nil nil 0))
 
236
 
 
237
;;------------------------------------------------------------------------------
 
238
(nodec-2
 
239
"
 
240
 
 
241
@
 
242
Du bon vin tous les jours
 
243
 
 
244
"
 
245
(nil nil 0))
 
246
 
 
247
;;------------------------------------------------------------------------------
 
248
(nodec-indent
 
249
"
 
250
 
 
251
@  Du bon vin tous les jours
 
252
 
 
253
"
 
254
(nil nil 2))
 
255
 
 
256
;;------------------------------------------------------------------------------
 
257
(underline
 
258
"
 
259
 
 
260
@Du bon vin tous les jours
 
261
=========================
 
262
 
 
263
"
 
264
(?= simple 0))
 
265
 
 
266
;;------------------------------------------------------------------------------
 
267
(underline-incomplete
 
268
"
 
269
 
 
270
@Du bon vin tous les jours
 
271
====================
 
272
 
 
273
"
 
274
(?= simple 0))
 
275
 
 
276
;;------------------------------------------------------------------------------
 
277
(underline-indent
 
278
"
 
279
 
 
280
@     Du bon vin tous les jours
 
281
====================
 
282
 
 
283
"
 
284
(?= simple 5))
 
285
 
 
286
;;------------------------------------------------------------------------------
 
287
(underline-one-char
 
288
"
 
289
 
 
290
@Du bon vin tous les jours
 
291
-
 
292
"
 
293
(nil nil 0))
 
294
 
 
295
;;------------------------------------------------------------------------------
 
296
(underline-two-char
 
297
"
 
298
 
 
299
@Du bon vin tous les jours
 
300
--
 
301
"
 
302
(?- simple 0))
 
303
 
 
304
;;------------------------------------------------------------------------------
 
305
(over-and-under
 
306
"
 
307
~~~~~~~~~~~~~~~~~~~~~~~~~
 
308
@Du bon vin tous les jours
 
309
~~~~~~~~~~~~~~~~~~~~~~~~~
 
310
 
 
311
"
 
312
(?~ over-and-under 0))
 
313
 
 
314
;;------------------------------------------------------------------------------
 
315
(over-and-under-top
 
316
"~~~~~~~~~~~~~~~~~~~~~~~~~
 
317
@Du bon vin tous les jours
 
318
~~~~~~~~~~~~~~~~~~~~~~~~~
 
319
 
 
320
"
 
321
(?~ over-and-under 0))
 
322
 
 
323
;;------------------------------------------------------------------------------
 
324
(over-and-under-indent
 
325
"
 
326
~~~~~~~~~~~~~~~~~~~~~~~~~
 
327
@   Du bon vin tous les jours
 
328
~~~~~~~~~~~~~~~~~~~~~~~~~
 
329
 
 
330
"
 
331
(?~ over-and-under 3))
 
332
 
 
333
;;------------------------------------------------------------------------------
 
334
(over-and-under-incomplete
 
335
"
 
336
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
337
@Du bon vin tous les jours
 
338
~~~~~~~~~~~~~~~~~~~
 
339
 
 
340
"
 
341
(?~ over-and-under 0))
 
342
 
 
343
;;------------------------------------------------------------------------------
 
344
(over-and-under-different-chars
 
345
"
 
346
---------------------------
 
347
@Du bon vin tous les jours
 
348
~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
349
 
 
350
"
 
351
(?~ over-and-under 0))
 
352
 
 
353
 
 
354
;;------------------------------------------------------------------------------
 
355
(not-beginning
 
356
"
 
357
 
 
358
Du bon vin to@us les jours
 
359
=========================
 
360
 
 
361
"
 
362
(?= simple 0))
 
363
 
 
364
;;------------------------------------------------------------------------------
 
365
(over-over-and-under
 
366
"
 
367
@
 
368
=========================
 
369
Du bon vin tous les jours
 
370
=========================
 
371
"
 
372
(nil nil 0))
 
373
 
 
374
;;------------------------------------------------------------------------------
 
375
(joint-1
 
376
"
 
377
=========================
 
378
Du bon vin tous les jours
 
379
=========================
 
380
Du bon vin@
 
381
 
 
382
"
 
383
(nil nil 0))
 
384
 
 
385
;;------------------------------------------------------------------------------
 
386
(joint-2
 
387
"
 
388
=========================
 
389
Du bon vin tous les jours
 
390
=========================
 
391
Du bon vin@
 
392
----------
 
393
 
 
394
"
 
395
(45 simple 0))
 
396
 
 
397
;;------------------------------------------------------------------------------
 
398
(joint-3
 
399
"
 
400
=========================
 
401
Du bon vin tous les jours
 
402
=========================
 
403
----------
 
404
Du bon vin@
 
405
----------
 
406
 
 
407
"
 
408
(45 over-and-under 0))
 
409
 
 
410
;;------------------------------------------------------------------------------
 
411
(joint-4
 
412
"
 
413
=========================
 
414
Du bon vin tous les jours
 
415
=========================
 
416
--------------
 
417
  Du bon vin@
 
418
--------------
 
419
 
 
420
"
 
421
(45 over-and-under 2))
 
422
 
 
423
;;------------------------------------------------------------------------------
 
424
(indented-1
 
425
"
 
426
 
 
427
  Du bon vin tous les jours@
 
428
  =========================
 
429
 
 
430
"
 
431
(nil nil 2))
 
432
 
 
433
))
 
434
 
 
435
 
 
436
(progn
 
437
  (regression-test-compare-expect-values
 
438
   "Test getting the decoration."
 
439
   rst-get-decoration-tests 'rst-get-decoration nil))
 
440
 
 
441
 
 
442
 
 
443
 
 
444
 
 
445
 
 
446
 
 
447
 
 
448
 
 
449
 
 
450
 
 
451
 
 
452
 
 
453
 
 
454
(setq text-1
 
455
"===============================
 
456
   Project Idea: My Document
 
457
===============================
 
458
 
 
459
:Author: Martin Blais
 
460
 
 
461
Introduction
 
462
============
 
463
 
 
464
This is the introduction.
 
465
 
 
466
Notes
 
467
-----
 
468
 
 
469
Some notes.
 
470
 
 
471
Main Points
 
472
===========
 
473
 
 
474
Yep.
 
475
 
 
476
Super Point
 
477
-----------
 
478
 
 
479
~~~~~~~~~~~
 
480
@ Sub Point
 
481
~~~~~~~~~~~
 
482
 
 
483
Isn't this fabulous?
 
484
 
 
485
Conclusion
 
486
==========
 
487
 
 
488
That's it, really.
 
489
 
 
490
")
 
491
 
 
492
 
 
493
(setq text-2
 
494
"
 
495
 
 
496
Previous
 
497
--------
 
498
 
 
499
Current@
 
500
~~~~~~~
 
501
 
 
502
Next
 
503
++++
 
504
 
 
505
")
 
506
 
 
507
(setq text-3
 
508
"
 
509
 
 
510
Previous
 
511
--------
 
512
 
 
513
Current@
 
514
~~~~~~~
 
515
 
 
516
  Next
 
517
  ++++
 
518
 
 
519
")
 
520
 
 
521
;; ~~~~~~~~~~~~~~~~~~
 
522
;;  Buggy Decoration
 
523
;; ~~~~~~
 
524
;;
 
525
;; ~~~~~~~~~~~~
 
526
;;  Decoration
 
527
;;
 
528
;;
 
529
;; ==========
 
530
 
 
531
(setq rst-find-all-decorations-tests
 
532
      `(
 
533
 ;;------------------------------------------------------------------------------
 
534
        (basic-1 ,text-1
 
535
                 ((2 61 over-and-under 3)
 
536
                  (7 61 simple 0)
 
537
                  (12 45 simple 0)
 
538
                  (17 61 simple 0)
 
539
                  (22 45 simple 0)
 
540
                  (26 126 over-and-under 1)
 
541
                  (31 61 simple 0))
 
542
                 )
 
543
 
 
544
        (basic-2 ,text-2
 
545
                 ((3 45 simple 0)
 
546
                  (6 126 simple 0)
 
547
                  (9 43 simple 0))
 
548
                 )
 
549
 
 
550
        (basic-3 ,text-3
 
551
                 ((3 45 simple 0)
 
552
                  (6 126 simple 0))
 
553
                 )
 
554
 
 
555
        ))
 
556
 
 
557
 
 
558
(progn
 
559
  (regression-test-compare-expect-values
 
560
   "Test finding all the decorations in a file."
 
561
   rst-find-all-decorations-tests 'rst-find-all-decorations nil))
 
562
 
 
563
 
 
564
 
 
565
 
 
566
(setq rst-get-hierarchy-tests
 
567
      `(
 
568
 ;;------------------------------------------------------------------------------
 
569
        (basic-1 ,text-1
 
570
                 ((61 over-and-under 3)
 
571
                  (61 simple 0)
 
572
                  (45 simple 0)
 
573
                  (126 over-and-under 1))
 
574
                 )
 
575
        ))
 
576
 
 
577
(progn
 
578
  (regression-test-compare-expect-values
 
579
   "Test finding the hierarchy of sections in a file."
 
580
   rst-get-hierarchy-tests 'rst-get-hierarchy nil))
 
581
 
 
582
 
 
583
 
 
584
 
 
585
(setq rst-get-hierarchy-ignore-tests
 
586
      `(
 
587
 ;;------------------------------------------------------------------------------
 
588
        (basic-1 ,text-1
 
589
                 ((61 over-and-under 3)
 
590
                  (61 simple 0)
 
591
                  (45 simple 0))
 
592
                 )
 
593
        ))
 
594
 
 
595
(progn
 
596
  (regression-test-compare-expect-values
 
597
   "Test finding the hierarchy of sections in a file, ignoring lines."
 
598
   rst-get-hierarchy-ignore-tests
 
599
   (lambda () (rst-get-hierarchy nil (line-number-at-pos))) nil))
 
600
 
 
601
 
 
602
 
 
603
 
 
604
 
 
605
 
 
606
 
 
607
(setq rst-decoration-complete-p-tests
 
608
  '(
 
609
;;------------------------------------------------------------------------------
 
610
(nodec
 
611
"
 
612
 
 
613
@Vaudou
 
614
 
 
615
" nil ((?= simple 0)))
 
616
 
 
617
;;------------------------------------------------------------------------------
 
618
(complete-simple
 
619
"
 
620
@Vaudou
 
621
======
 
622
" t ((?= simple 0)))
 
623
 
 
624
;;------------------------------------------------------------------------------
 
625
(complete-over-and-under
 
626
"
 
627
======
 
628
@Vaudou
 
629
======
 
630
" t ((?= over-and-under 0)))
 
631
 
 
632
;;------------------------------------------------------------------------------
 
633
(complete-over-and-under-indent
 
634
"
 
635
==========
 
636
@  Vaudou
 
637
==========
 
638
" t ((?= over-and-under 2)))
 
639
 
 
640
;;------------------------------------------------------------------------------
 
641
(incomplete-simple-short
 
642
"
 
643
@Vaudou
 
644
=====
 
645
" nil ((?= simple 0)))
 
646
 
 
647
;;------------------------------------------------------------------------------
 
648
(incomplete-simple-long
 
649
"
 
650
@Vaudou
 
651
=======
 
652
" nil ((?= simple 0)))
 
653
 
 
654
;;------------------------------------------------------------------------------
 
655
(incomplete-simple-mixed
 
656
"
 
657
@Vaudou
 
658
===-==
 
659
" nil ((?= simple 0)))
 
660
 
 
661
;;------------------------------------------------------------------------------
 
662
(incomplete-over-and-under-1
 
663
"
 
664
======
 
665
@Vaudou
 
666
=====
 
667
" nil ((?= over-and-under 0)))
 
668
 
 
669
;;------------------------------------------------------------------------------
 
670
(incomplete-over-and-under-2
 
671
"
 
672
=====
 
673
@Vaudou
 
674
======
 
675
" nil ((?= over-and-under 0)))
 
676
 
 
677
;;------------------------------------------------------------------------------
 
678
(incomplete-over-and-under-mixed-1
 
679
"
 
680
======
 
681
@Vaudou
 
682
===-==
 
683
" nil ((?= over-and-under 0)))
 
684
 
 
685
;;------------------------------------------------------------------------------
 
686
(incomplete-over-and-under-mixed-2
 
687
"
 
688
===-==
 
689
@Vaudou
 
690
======
 
691
" nil ((?= over-and-under 0)))
 
692
 
 
693
;;------------------------------------------------------------------------------
 
694
(incomplete-over-only
 
695
"
 
696
======
 
697
@Vaudou
 
698
 
 
699
" nil ((?= over-and-under 0)))
 
700
 
 
701
;;------------------------------------------------------------------------------
 
702
(incomplete-mixed
 
703
"
 
704
======
 
705
@Vaudou
 
706
------
 
707
" nil ((?= over-and-under 0)))
 
708
 
 
709
;;------------------------------------------------------------------------------
 
710
(incomplete-over-and-under-1
 
711
"
 
712
==========
 
713
  @Vaudou
 
714
=========
 
715
" nil ((?= over-and-under 0)))
 
716
 
 
717
;;------------------------------------------------------------------------------
 
718
(incomplete-over-and-under-2
 
719
"
 
720
=========
 
721
  @Vaudou
 
722
==========
 
723
" nil ((?= over-and-under 0)))
 
724
 
 
725
;;------------------------------------------------------------------------------
 
726
(incomplete-over-and-under-mixed-1
 
727
"
 
728
==========
 
729
  @Vaudou
 
730
===-======
 
731
" nil ((?= over-and-under 0)))
 
732
 
 
733
;;------------------------------------------------------------------------------
 
734
(incomplete-over-and-under-mixed-2
 
735
"
 
736
===-======
 
737
  @Vaudou
 
738
==========
 
739
" nil ((?= over-and-under 0)))
 
740
 
 
741
;;------------------------------------------------------------------------------
 
742
(incomplete-over-only
 
743
"
 
744
==========
 
745
  @Vaudou
 
746
 
 
747
" nil ((?= over-and-under 0)))
 
748
 
 
749
;;------------------------------------------------------------------------------
 
750
(incomplete-mixed-2
 
751
"
 
752
==========
 
753
  @Vaudou
 
754
----------
 
755
" nil ((?= over-and-under 0)))
 
756
 
 
757
))
 
758
 
 
759
(progn
 
760
  (regression-test-compare-expect-values
 
761
   "Tests for completeness predicate."
 
762
   rst-decoration-complete-p-tests 'rst-decoration-complete-p nil))
 
763
 
 
764
 
 
765
 
 
766
 
 
767
 
 
768
 
 
769
 
 
770
 
 
771
 
 
772
 
 
773
 
 
774
 
 
775
 
 
776
(setq rst-get-decorations-around-tests
 
777
  '(
 
778
;;------------------------------------------------------------------------------
 
779
(simple
 
780
"
 
781
 
 
782
Previous
 
783
--------
 
784
 
 
785
@Current
 
786
 
 
787
Next
 
788
++++
 
789
 
 
790
" ((?- simple 0) (?+ simple 0)))
 
791
 
 
792
;;------------------------------------------------------------------------------
 
793
(simple-2
 
794
"
 
795
 
 
796
Previous
 
797
--------
 
798
 
 
799
Current@
 
800
~~~~~~~
 
801
 
 
802
Next
 
803
++++
 
804
 
 
805
" ((?- simple 0) (?+ simple 0)))
 
806
 
 
807
))
 
808
 
 
809
(progn
 
810
  (regression-test-compare-expect-values
 
811
   "Tests getting the decorations around a point."
 
812
   rst-get-decorations-around-tests 'rst-get-decorations-around nil))
 
813