emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
blob 6ee1b1fab87e846b20dec87dfc60f82b6a36ba3c 20559 bytes (raw)
name: testing/lisp/test-org-lint.el 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
 
;;; test-org-lint.el --- Tests for Org Lint          -*- lexical-binding: t; -*-

;; Copyright (C) 2016, 2019  Nicolas Goaziou

;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Code:

(require 'org-footnote)
(require 'org-lint)

(ert-deftest test-org-lint/add-checker ()
  "Test `org-lint-add-checker'."
  ;; Name should be a non-nil symbol.
  (should-error (org-lint-add-checker nil "Nil check" #'ignore))
  (should-error (org-lint-add-checker 2 "Odd check" #'ignore))
  ;; Check function should be valid.
  (should-error (org-lint-add-checker 'check "check" (gensym)))
  ;; Checkers must be named uniquely.
  (should
   (= 1
      (let ((org-lint--checkers nil))
        (org-lint-add-checker 'check "check" #'ignore)
        (length org-lint--checkers))))
  (should-not
   (= 2
      (let ((org-lint--checkers nil))
        (org-lint-add-checker 'check "check" #'ignore)
        (org-lint-add-checker 'check "other check" #'ignore)
        (length org-lint--checkers)))))

(ert-deftest test-org-lint/duplicate-custom-id ()
  "Test `org-lint-duplicate-custom-id' checker."
  (should
   (org-test-with-temp-text "
* H1
:PROPERTIES:
:CUSTOM_ID: foo
:END:

* H2
:PROPERTIES:
:CUSTOM_ID: foo
:END:"
     (org-lint '(duplicate-custom-id))))
  (should-not
   (org-test-with-temp-text "
* H1
:PROPERTIES:
:CUSTOM_ID: foo
:END:

* H2
:PROPERTIES:
:CUSTOM_ID: bar
:END:"
     (org-lint '(duplicate-custom-id)))))

(ert-deftest test-org-lint/duplicate-name ()
  "Test `org-lint-duplicate-name' checker."
  (should
   (org-test-with-temp-text "
#+name: foo
Paragraph1

#+name: foo
Paragraph 2"
     (org-lint '(duplicate-name))))
  (should-not
   (org-test-with-temp-text "
#+name: foo
Paragraph1

#+name: bar
Paragraph 2"
     (org-lint '(duplicate-name)))))

(ert-deftest test-org-lint/duplicate-target ()
  "Test `org-lint-duplicate-target' checker."
  (should
   (org-test-with-temp-text "<<foo>> <<foo>>"
     (org-lint '(duplicate-target))))
  (should-not
   (org-test-with-temp-text "<<foo>> <<bar>>"
     (org-lint '(duplicate-target)))))

(ert-deftest test-org-lint/duplicate-footnote-definition ()
  "Test `org-lint-duplicate-footnote-definition' checker."
  (should
   (org-test-with-temp-text "
\[fn:1] Definition 1

\[fn:1] Definition 2"
     (org-lint '(duplicate-footnote-definition))))
  (should-not
   (org-test-with-temp-text "
\[fn:1] Definition 1

\[fn:2] Definition 2"
     (org-lint '(duplicate-footnote-definition)))))

(ert-deftest test-org-lint/orphaned-affiliated-keywords ()
  "Test `org-lint-orphaned-affiliated-keywords' checker."
  (should
   (org-test-with-temp-text "#+name: foo"
     (org-lint '(orphaned-affiliated-keywords)))))

(ert-deftest test-org-lint/deprecated-export-blocks ()
  "Test `org-lint-deprecated-export-blocks' checker."
  (should
   (org-test-with-temp-text "
#+begin_latex
...
#+end_latex"
     (org-lint '(deprecated-export-blocks)))))

(ert-deftest test-org-lint/deprecated-header-syntax ()
  "Test `org-lint-deprecated-header-syntax' checker."
  (should
   (org-test-with-temp-text "#+property: cache yes"
     (org-lint '(deprecated-header-syntax))))
  (should
   (org-test-with-temp-text "
* H
:PROPERTIES:
:cache: yes
:END:"
     (org-lint '(deprecated-header-syntax)))))

(ert-deftest test-org-lint/missing-language-in-src-block ()
  "Test `org-lint-missing-language-in-src-block' checker."
  (should
   (org-test-with-temp-text "
#+begin_src
...
#+end_src"
     (org-lint '(missing-language-in-src-block)))))

(ert-deftest test-org-lint/missing-backend-in-export-block ()
  "Test `org-lint-missing-backend-in-export-block' checker."
  (should
   (org-test-with-temp-text "
#+begin_export
...
#+end_export"
     (org-lint '(missing-backend-in-export-block)))))

(ert-deftest test-org-lint/invalid-babel-call-block ()
  "Test `org-lint-invalid-babel-call-block' checker."
  (should
   (org-test-with-temp-text "#+call:"
     (org-lint '(invalid-babel-call-block))))
  (should
   (org-test-with-temp-text "#+call: foo() [:exports code]"
     (org-lint '(invalid-babel-call-block)))))

(ert-deftest test-org-lint/deprecated-category-setup ()
  "Test `org-lint-deprecated-category-setup' checker."
  (should
   (org-test-with-temp-text "#+category: foo\n#+category: bar"
     (org-lint '(deprecated-category-setup)))))

(ert-deftest test-org-lint/invalid-coderef-link ()
  "Test `org-lint-invalid-coderef-link' checker."
  (should
   (org-test-with-temp-text "[[(unknown)]]"
     (org-lint '(invalid-coderef-link))))
  (should-not
   (org-test-with-temp-text "[[(foo)]]
#+begin_src emacs-lisp -l \"; ref:%s\"
\(+ 1 1) ; ref:foo
#+end_src"
     (org-lint '(invalid-coderef-link)))))

(ert-deftest test-org-lint/invalid-custom-id-link ()
  "Test `org-lint-invalid-custom-id-link' checker."
  (should
   (org-test-with-temp-text "[[#unknown]]"
     (org-lint '(invalid-custom-id-link))))
  (should-not
   (org-test-with-temp-text "[[#foo]]
* H
:PROPERTIES:
:CUSTOM_ID: foo
:END:"
     (org-lint '(invalid-custom-id-link)))))

(ert-deftest test-org-lint/invalid-fuzzy-link ()
  "Test `org-lint-invalid-fuzzy-link' checker."
  (should
   (org-test-with-temp-text "[[*unknown]]"
     (org-lint '(invalid-fuzzy-link))))
  (should-not
   (org-test-with-temp-text "[[*foo]]\n* foo"
     (org-lint '(invalid-fuzzy-link))))
  (should
   (org-test-with-temp-text "[[unknown]]"
     (org-lint '(invalid-fuzzy-link))))
  (should-not
   (org-test-with-temp-text "[[foo]]\n#+name: foo\nParagraph"
     (org-lint '(invalid-fuzzy-link))))
  (should-not
   (org-test-with-temp-text "[[foo]]\n<<foo>>"
     (org-lint '(invalid-fuzzy-link)))))

(ert-deftest test-org-lint/special-property-in-properties-drawer ()
  "Test `org-lint-special-property-in-properties-drawer' checker."
  (should
   (org-test-with-temp-text "
* H
:PROPERTIES:
:TODO: foo
:END:"
     (org-lint '(special-property-in-properties-drawer)))))

(ert-deftest test-org-lint/obsolete-properties-drawer ()
  "Test `org-lint-obsolete-properties-drawer' checker."
  (should-not
   (org-test-with-temp-text "
* H
:PROPERTIES:
:SOMETHING: foo
:END:"
     (org-lint '(obsolete-properties-drawer))))
  (should-not
   (org-test-with-temp-text "
* H
SCHEDULED: <2012-03-29>
:PROPERTIES:
:SOMETHING: foo
:END:"
     (org-lint '(obsolete-properties-drawer))))
  (should-not
   (org-test-with-temp-text ":PROPERTIES:
:SOMETHING: foo
:END:"
     (org-lint '(obsolete-properties-drawer))))
  (should-not
   (org-test-with-temp-text "# Comment
:PROPERTIES:
:SOMETHING: foo
:END:"
     (org-lint '(obsolete-properties-drawer))))
  (should
   (org-test-with-temp-text "
* H
Paragraph
:PROPERTIES:
:SOMETHING: foo
:END:"
     (org-lint '(obsolete-properties-drawer))))
  (should
   (org-test-with-temp-text "
* H
:PROPERTIES:
This is not a node property
:END:"
     (org-lint '(obsolete-properties-drawer))))
  (should
   (org-test-with-temp-text "Paragraph
:PROPERTIES:
:FOO: bar
:END:"
     (org-lint '(obsolete-properties-drawer)))))

(ert-deftest test-org-lint/invalid-effort-property ()
  "Test `org-lint-invalid-effort-property' checker."
  (should
   (org-test-with-temp-text "* H\n:PROPERTIES:\n:EFFORT: something\n:END:"
     (org-lint '(invalid-effort-property))))
  (should-not
   (org-test-with-temp-text "* H\n:PROPERTIES:\n:EFFORT: 1:23\n:END:"
     (org-lint '(invalid-effort-property)))))

(ert-deftest test-org-lint/link-to-local-file ()
  "Test `org-lint-link-to-local-file' checker."
  (should
   (org-test-with-temp-text "[[file:/Idonotexist.org]]"
     (org-lint '(link-to-local-file)))))

(ert-deftest test-org-lint/non-existent-setupfile-parameter ()
  "Test `org-lint-non-existent-setupfile-parameter' checker."
  (should
   (org-test-with-temp-text "#+setupfile: Idonotexist.org"
     (org-lint '(non-existent-setupfile-parameter))))
  (should-not
   (org-test-with-temp-text "#+setupfile: https://I.do/not.exist.org"
     (org-lint '(non-existent-setupfile-parameter)))))

(ert-deftest test-org-lint/wrong-include-link-parameter ()
  "Test `org-lint-wrong-include-link-parameter' checker."
  (should
   (org-test-with-temp-text "#+include:"
     (org-lint '(wrong-include-link-parameter))))
  (should
   (org-test-with-temp-text "#+include: Idonotexist.org"
     (org-lint '(wrong-include-link-parameter))))
  (should
   (org-test-with-temp-text-in-file ""
     (let ((file (buffer-file-name)))
       (org-test-with-temp-text (format "#+include: \"%s::#foo\"" file)
	 (org-lint '(wrong-include-link-parameter))))))
  (should-not
   (org-test-with-temp-text-in-file "* foo"
     (let ((file (buffer-file-name)))
       (org-test-with-temp-text (format "#+include: \"%s::*foo\"" file)
	 (org-lint '(wrong-include-link-parameter)))))))

(ert-deftest test-org-lint/obsolete-include-markup ()
  "Test `org-lint-obsolete-include-markup' checker."
  (should
   (org-test-with-temp-text-in-file ""
     (let ((file (buffer-file-name)))
       (org-test-with-temp-text (format "#+include: \"%s\" html" file)
	 (org-lint '(obsolete-include-markup))))))
  (should-not
   (org-test-with-temp-text-in-file ""
     (let ((file (buffer-file-name)))
       (org-test-with-temp-text (format "#+include: \"%s\" export html" file)
	 (org-lint '(obsolete-include-markup)))))))

(ert-deftest test-org-lint/unknown-options-item ()
  "Test `org-lint-unknown-options-item' checker."
  (should
   (org-test-with-temp-text "#+options: foobarbaz:t"
     (org-lint '(unknown-options-item))))
  (should
   (org-test-with-temp-text "#+options: H:"
     (org-lint '(unknown-options-item)))))

(ert-deftest test-org-lint/invalid-macro-argument-and-template ()
  "Test `org-lint-invalid-macro-argument-and-template' checker."
  (should
   (org-test-with-temp-text "{{{undefined()}}}"
     (org-lint '(invalid-macro-argument-and-template))))
  (should
   (org-test-with-temp-text
       "#+macro: wrongsignature $1 $2\n{{{wrongsignature(1, 2, 3)}}}"
     (org-lint '(invalid-macro-argument-and-template))))
  (should
   (org-test-with-temp-text "#+macro:"
     (org-lint '(invalid-macro-argument-and-template))))
  (should
   (org-test-with-temp-text "#+macro: missingtemplate"
     (org-lint '(invalid-macro-argument-and-template))))
  (should
   (org-test-with-temp-text "#+macro: unusedplaceholders $1 $3"
     (org-lint '(invalid-macro-argument-and-template))))
  (should-not
   (org-test-with-temp-text
       "#+macro: valid $1 $2\n{{{valid(1, 2)}}}"
     (org-lint '(invalid-macro-argument-and-template))))
  (should
   (org-test-with-temp-text "{{{keyword}}}"
     (org-lint '(invalid-macro-argument-and-template))))
  (should
   (org-test-with-temp-text "{{{keyword(one, too many)}}}"
     (org-lint '(invalid-macro-argument-and-template)))))

(ert-deftest test-org-lint/undefined-footnote-reference ()
  "Test `org-lint-undefined-footnote-reference' checker."
  (should
   (org-test-with-temp-text "Text[fn:1]"
     (org-lint '(undefined-footnote-reference))))
  (should-not
   (org-test-with-temp-text "Text[fn:1]\n[fn:1] Definition"
     (org-lint '(undefined-footnote-reference))))
  (should-not
   (org-test-with-temp-text "Text[fn:1:inline reference]"
     (org-lint '(undefined-footnote-reference))))
  (should-not
   (org-test-with-temp-text "Text[fn:1:inline reference] [fn:1]"
     (org-lint '(undefined-footnote-reference))))
  (should-not
   (org-test-with-temp-text "Text[fn::anonymous reference]"
     (org-lint '(undefined-footnote-reference)))))

(ert-deftest test-org-lint/unreferenced-footnote-definition ()
  "Test `org-lint-unreferenced-footnote-definition' checker."
  (should
   (org-test-with-temp-text "[fn:1] Definition"
     (org-lint '(unreferenced-footnote-definition))))
  (should-not
   (org-test-with-temp-text "Text[fn:1]\n[fn:1] Definition"
     (org-lint '(unreferenced-footnote-definition)))))

(ert-deftest test-org-lint/colon-in-name ()
  "Test `org-lint-colon-in-name' checker."
  (should
   (org-test-with-temp-text "#+name: tab:name\n| a |"
     (org-lint '(colon-in-name))))
  (should-not
   (org-test-with-temp-text "#+name: name\n| a |"
     (org-lint '(colon-in-name)))))

(ert-deftest test-org-lint/misplaced-planning-info ()
  "Test `org-lint-misplaced-planning-info' checker."
  (should
   (org-test-with-temp-text "SCHEDULED: <2012-03-29 thu.>"
     (org-lint '(misplaced-planning-info))))
  (should
   (org-test-with-temp-text "
* H
Text
SCHEDULED: <2012-03-29 thu.>"
     (org-lint '(misplaced-planning-info))))
  (should-not
   (org-test-with-temp-text "
* H
SCHEDULED: <2012-03-29 thu.>"
     (org-lint '(misplaced-planning-info)))))

(ert-deftest test-org-lint/incomplete-drawer ()
  "Test `org-lint-incomplete-drawer' checker."
  (should
   (org-test-with-temp-text ":DRAWER:"
     (org-lint '(incomplete-drawer))))
  (should
   (org-test-with-temp-text ":DRAWER:\n:ODD:\n:END:"
     (org-lint '(incomplete-drawer))))
  (should-not
   (org-test-with-temp-text ":DRAWER:\n:END:"
     (org-lint '(incomplete-drawer)))))

(ert-deftest test-org-lint/indented-diary-sexp ()
  "Test `org-lint-indented-diary-sexp' checker."
  (should
   (org-test-with-temp-text "  %%(foo)"
     (org-lint '(indented-diary-sexp))))
  (should-not
   (org-test-with-temp-text "%%(foo)"
     (org-lint '(indented-diary-sexp)))))

(ert-deftest test-org-lint/invalid-block ()
  "Test `org-lint-invalid-block' checker."
  (should
   (org-test-with-temp-text "#+begin_foo"
     (org-lint '(invalid-block))))
  (should-not
   (org-test-with-temp-text "#+begin_foo\n#+end_foo"
     (org-lint '(invalid-block)))))

(ert-deftest test-org-lint/invalid-keyword-syntax ()
  "Test `org-lint-invalid-keyword-syntax' checker."
  (should
   (org-test-with-temp-text "#+keyword"
     (org-lint '(invalid-keyword-syntax))))
  (should-not
   (org-test-with-temp-text "#+keyword:"
     (org-lint '(invalid-keyword-syntax)))))

(ert-deftest test-org-lint/extraneous-element-in-footnote-section ()
  "Test `org-lint-extraneous-element-in-footnote-section' checker."
  (should
   (org-test-with-temp-text "* Footnotes\nI'm not a footnote definition"
     (let ((org-footnote-section "Footnotes"))
       (org-lint '(extraneous-element-in-footnote-section)))))
  (should-not
   (org-test-with-temp-text "* Footnotes\n[fn:1] I'm a footnote definition"
     (let ((org-footnote-section "Footnotes"))
       (org-lint '(extraneous-element-in-footnote-section))))))

(ert-deftest test-org-lint/quote-section ()
  "Test `org-lint-quote-section' checker."
  (should
   (org-test-with-temp-text "* QUOTE H"
     (org-lint '(quote-section))))
  (should
   (org-test-with-temp-text "* COMMENT QUOTE H"
     (org-lint '(quote-section)))))

(ert-deftest test-org-lint/file-application ()
  "Test `org-lint-file-application' checker."
  (should
   (org-test-with-temp-text "[[file+emacs:foo.org]]"
     (org-lint '(file-application)))))

(ert-deftest test-org-lint/percenc-encoding-link-escape ()
  "Test `org-lint-percent-encoding-link-escape' checker."
  (should
   (org-test-with-temp-text "[[A%20B]]"
     (org-lint '(percent-encoding-link-escape))))
  (should
   (org-test-with-temp-text "[[%5Bfoo%5D]]"
     (org-lint '(percent-encoding-link-escape))))
  (should
   (org-test-with-temp-text "[[A%2520B]]"
     (org-lint '(percent-encoding-link-escape))))
  (should-not
   (org-test-with-temp-text "[[A B]]"
     (org-lint '(percent-encoding-link-escape))))
  (should-not
   (org-test-with-temp-text "[[A%30B]]"
     (org-lint '(percent-encoding-link-escape))))
  (should-not
   (org-test-with-temp-text "[[A%20%30B]]"
     (org-lint '(percent-encoding-link-escape))))
  (should-not
   (org-test-with-temp-text "<file:A%20B>"
     (org-lint '(percent-encoding-link-escape))))
  (should-not
   (org-test-with-temp-text "[[A B%]]"
     (org-lint '(percent-encoding-link-escape)))))

(ert-deftest test-org-lint/wrong-header-argument ()
  "Test `org-lint-wrong-header-argument' checker."
  (should
   (org-test-with-temp-text "#+call: foo() barbaz yes"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "#+call: foo() :barbaz yes"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "call_foo[barbaz yes]()"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "call_foo[:barbaz yes]()"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "#+property: header-args barbaz yes"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "#+property: header-args :barbaz yes"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "
* H
:PROPERTIES:
:HEADER-ARGS: barbaz yes
:END:"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "
* H
:PROPERTIES:
:HEADER-ARGS: :barbaz yes
:END:"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "
#+header: :barbaz yes
#+begin_src emacs-lisp
\(+ 1 1)
#+end_src"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "src_emacs-lisp[barbaz yes]{}"
     (org-lint '(wrong-header-argument))))
  (should
   (org-test-with-temp-text "src_emacs-lisp[:barbaz yes]{}"
     (org-lint '(wrong-header-argument)))))

(ert-deftest test-org-lint/wrong-header-value ()
  "Test `org-lint-wrong-header-value' checker."
  (should
   (org-test-with-temp-text "
#+header: :cache maybe
#+begin_src emacs-lisp
\(+ 1 1)
#+end_src"
     (org-lint '(wrong-header-value))))
  (should
   (org-test-with-temp-text "
#+header: :exports both none
#+begin_src emacs-lisp
\(+ 1 1)
#+end_src"
     (org-lint '(wrong-header-value))))
  (should-not
   (org-test-with-temp-text "
#+header: :cache yes
#+begin_src emacs-lisp
\(+ 1 1)
#+end_src"
     (org-lint '(wrong-header-value)))))

(ert-deftest test-org/spurious-colons ()
  "Test `org-list-spurious-colons' checker."
  (should-not
   (org-test-with-temp-text "* H :tag:tag2:"
     (org-lint '(spurious-colons))))
  (should
   (org-test-with-temp-text "* H :tag::tag2:"
     (org-lint '(spurious-colons))))
  (should
   (org-test-with-temp-text "* H :tag::"
     (org-lint '(spurious-colons)))))

(ert-deftest test-org-lint/non-existent-bibliography ()
  "Test `org-lint-non-existent-bibliography' checker."
  (should
   (org-test-with-temp-text "#+bibliography: Idonotexist.bib"
     (org-lint '(non-existent-bibliography)))))

(ert-deftest test-org-lint/missing-print-bibliography ()
  "Test `org-lint-missing-print-bibliography' checker."
  (should
   (org-test-with-temp-text "[cite:@foo]"
     (org-lint '(missing-print-bibliography))))
  (should-not
   (org-test-with-temp-text "[cite:@foo]\n#+print_bibliography:"
     (org-lint '(missing-print-bibliography))))
  (should-not
   (org-test-with-temp-text ""
     (org-lint '(missing-print-bibliography)))))

(ert-deftest test-org-lint/invalid-cite-export-declaration ()
  "Test `org-lint-invalid-cite-export-declaration' checker."
  (should
   (org-test-with-temp-text "#+cite_export: "
     (org-lint '(invalid-cite-export-declaration))))
  (should
   (org-test-with-temp-text "#+cite_export: 2"
     (org-lint '(invalid-cite-export-declaration))))
  (should
   (org-test-with-temp-text "#+cite_export: basic bar baz qux"
     (org-lint '(invalid-cite-export-declaration))))
  (should
   (org-test-with-temp-text "#+cite_export: basic \"bar"
     (org-lint '(invalid-cite-export-declaration))))
  (should
   (org-test-with-temp-text "#+cite_export: unknown"
     (org-lint '(invalid-cite-export-declaration))))
  (should-not
   (org-test-with-temp-text "#+cite_export: basic"
     (org-lint '(invalid-cite-export-declaration)))))

(ert-deftest test-org-lint/incomplete-citation ()
  "Test `org-lint-incomplete-citation' checker."
  (should
   (org-test-with-temp-text "[cite:foo]"
     (org-lint '(incomplete-citation))))
  (should
   (org-test-with-temp-text "[cite:@foo"
     (org-lint '(incomplete-citation))))
  (should-not
   (org-test-with-temp-text "[cite:@foo]"
     (org-lint '(incomplete-citation)))))

(provide 'test-org-lint)
;;; test-org-lint.el ends here

debug log:

solving 6ee1b1fab8 ...
found 6ee1b1fab8 in https://git.savannah.gnu.org/cgit/emacs/org-mode.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).