Coverage for core\test_leoColorizer.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# -*- coding: utf-8 -*-
2#@+leo-ver=5-thin
3#@+node:ekr.20210905151702.1: * @file ../unittests/core/test_leoColorizer.py
4#@@first
5"""Tests of leoColorizer.py"""
7import textwrap
8from leo.core import leoGlobals as g
9from leo.core.leoTest2 import LeoUnitTest
10import leo.core.leoColorizer as leoColorizer
12#@+others
13#@+node:ekr.20210905151702.2: ** class TestColorizer(LeoUnitTest)
14class TestColorizer(LeoUnitTest):
15 """Test cases for leoColorizer.py"""
16 #@+others
17 #@+node:ekr.20210905161336.1: *3* TestColorizer.color
18 def color(self, language_name, text):
19 """Run the test by colorizing a node with the given text."""
20 c = self.c
21 c.p.b = text.replace('> >', '>>').replace('< <', '<<')
22 c.recolor_now()
23 #@+node:ekr.20210905170507.2: *3* TestColorizer.test__comment_after_language_plain
24 def test__comment_after_language_plain(self):
25 text = textwrap.dedent("""\
26 @comment # /* */
28 This is plain text.
30 # This is a comment.
32 More plain text.
34 /* A block comment
35 continues */
37 More plain text.
38 """)
39 self.color('plain', text)
40 #@+node:ekr.20210905170507.3: *3* TestColorizer.test_bc_scanLanguageDirectives
41 def test_bc_scanLanguageDirectives(self):
42 c = self.c
43 c.target_language = 'python' # Set the default.
44 wrapper = c.frame.body.wrapper
45 widget = c.frame.body.widget
46 x = leoColorizer.JEditColorizer(c, widget, wrapper)
47 child = c.rootPosition().insertAsLastChild()
48 grand = child.insertAsLastChild()
49 language_table = (
50 ('python', '@language rest\n@language python\n', ''),
51 ('rest', '@language rest', ''),
52 ('python', '@language rest\n@language python\n', ''),
53 )
54 for i, data in enumerate(language_table):
55 language, child_s, grand_s = data
56 child.b = child_s
57 grand.b = grand_s
58 got = x.scanLanguageDirectives(grand)
59 self.assertEqual(got, language, msg=f"i: {i} {language}")
60 #@+node:ekr.20210905170507.4: *3* TestColorizer.test_bc_useSyntaxColoring
61 def test_bc_useSyntaxColoring(self):
62 c = self.c
63 wrapper = c.frame.body.wrapper
64 widget = c.frame.body.widget
65 x = leoColorizer.JEditColorizer(c, widget, wrapper)
66 child = c.rootPosition().insertAsLastChild()
67 grand = child.insertAsLastChild()
68 language_table = [
69 (True, '', ''),
70 # Ambiguous parent.
71 (True, '@color \n@nocolor\n', ''),
72 (True, '@nocolor \n@color\n', ''),
73 # Unambiguous parent.
74 (True, '@nocolor-node', ''), # Does not apply to descendants.
75 (False, '@nocolor', ''),
76 (False, '@killcolor', ''),
77 #
78 # Note: the following tests don't matter because
79 # jedit.recolor ignores the self.enabled flag.
80 # As a result, *all* color directives, including @nocolor-node,
81 # Apply from the directive to the next color directive.
82 #
83 # Unambiguous child.
84 (False, '', '@killcolor\n'),
85 (True, '', '@color\n'),
86 # @nocolor-node rules node.
87 (False, '', '@nocolor-node\n'),
88 (False, '', '@color\n@nocolor-node\n'),
89 # Ambiguous node: defer to ancestors.
90 (True, '', '@color\n@nocolor'),
91 (True, '', '@nocolor\n@color'),
92 ]
93 language = 'python'
94 for i, data in enumerate(language_table):
95 expected, child_s, grand_s = data
96 child.b = child_s
97 grand.b = grand_s
98 got = x.useSyntaxColoring(grand)
99 self.assertEqual(got, expected, msg=f"i: {i} {language}")
100 #@+node:ekr.20210905170507.5: *3* TestColorizer.test_colorizer_Actionscript
101 def test_colorizer_Actionscript(self):
102 text = textwrap.dedent("""\
103 break
104 call, continue
105 delete, do
106 else
107 false, for, function
108 goto
109 if, in
110 new, null
111 return
112 true, typeof
113 undefined
114 var, void, while, with
115 #include
116 catch, constructor
117 prototype
118 this, try
119 _parent, _root, __proto__
120 // Jeeze hasn't anyone ever heard of namespaces??
121 ASnative, abs, acos, appendChild, asfunction, asin, atan, atan2, attachMovie, attachSound, attributes
122 BACKSPACE
123 CAPSLOCK, CONTROL, ceil, charAt, charCodeAt, childNodes, chr, cloneNode, close, concat, connect, cos, createElement, createTextNode
124 DELETEKEY, DOWN, docTypeDecl, duplicateMovieClip
125 END, ENTER, ESCAPE, enterFrame, entry, equal, eval, evaluate, exp
126 firstChild, floor, fromCharCode, fscommand, getAscii
127 getBeginIndex, getBounds, getBytesLoaded, getBytesTotal, getCaretIndex, getCode, getDate, getDay, getEndIndex, getFocus, getFullYear, getHours, getMilliseconds, getMinutes, getMonth, getPan, getProperty, getRGB, getSeconds, getTime, getTimer, getTimezoneOffset, getTransform, getURL, getUTCDate, getUTCDay, getUTCFullYear, getUTCHours, getUTCMilliseconds, getUTCMinutes, getUTCMonth, getUTCSeconds, getVersion, getVolume, getYear, globalToLocal, gotoAndPlay, gotoAndStop
128 HOME, haschildNodes, hide, hitTest
129 INSERT, Infinity, ifFrameLoaded, ignoreWhite, indexOf, insertBefore, int, isDown, isFinite, isNaN, isToggled
130 join
131 keycode, keyDown, keyUp
132 LEFT, LN10, LN2, LOG10E, LOG2E, lastChild, lastIndexOf, length, load, loaded, loadMovie, loadMovieNum, loadVariables, loadVariablesNum, localToGlobal, log
133 MAX_VALUE, MIN_VALUE, max, maxscroll, mbchr, mblength, mbord, mbsubstring, min,
134 NEGATIVE_INFINITY, NaN, newline, nextFrame, nextScene, nextSibling, nodeName, nodeType, nodeValue
135 on, onClipEvent, onClose, onConnect, onData, onLoad, onXML, ord
136 PGDN, PGUP, PI, POSITIVE_INFINITY, parentNode, parseFloat, parseInt, parseXML, play, pop, pow, press, prevFrame, previousSibling, prevScene, print, printAsBitmap, printAsBitmapNum, printNum, push
137 RIGHT, random, release, removeMovieClip, removeNode, reverse, round
138 SPACE, SQRT1_2, SQRT2, scroll, send, sendAndLoad, set, setDate, setFocus, setFullYear, setHours, setMilliseconds, setMinutes, setMonth, setPan, setProperty, setRGB, setSeconds, setSelection, setTime, setTransform, setUTCDate, setUTCFullYear, setUTCHours, setUTCMilliseconds, setUTCMinutes, setUTCMonth, setUTCSeconds, setVolume, setYear, shift, show, sin, slice, sort, start, startDrag, status, stop, stopAllSounds, stopDrag, substr, substring, swapDepths, splice, split, sqrt
139 TAB, tan, targetPath, tellTarget, toggleHighQuality, toLowerCase, toString, toUpperCase, trace
140 UP, UTC, unescape, unloadMovie, unLoadMovieNum, unshift, updateAfterEvent
141 valueOf
142 xmlDecl, _alpha
143 _currentframe
144 _droptarget
145 _focusrect, _framesloaded
146 _height, _highquality
147 _name
148 _quality
149 _rotation
150 _soundbuftime
151 _target, _totalframes
152 _url
153 _visible
154 _width
155 _x, _xmouse, _xscale
156 _y, _ymouse, _yscale
157 and, add, eq, ge, gt, le, lt, ne, not, or, Array, Boolean, Color, Date, Key, Math, MovieClip, Mouse, Number, Object, Selection, Sound, String, XML, XMLSocket
158 """)
159 self.color('actionscript', text)
160 #@+node:ekr.20210905170507.6: *3* TestColorizer.test_colorizer_C
161 def test_colorizer_C(self):
162 text = textwrap.dedent("""\
163 @comment /* */
165 @
166 @c
168 #define WIPEOUT 0 /*
169 * Causes database card number & flags to be set to zero.
170 * This is so I don't need an infinite supply of cards!
171 */
172 // Not colored (because of @language /* */)
173 #include "equ.h"
174 #include "cmn.h"
175 #include "ramdef.h"
176 #include "eeprom.h"
177 #include <hpc_ram.h>
178 #include <rlydef.h>
179 """)
180 self.color('c', text)
181 #@+node:ekr.20210905170507.7: *3* TestColorizer.test_colorizer_C_
182 def test_colorizer_C_(self):
183 text = textwrap.dedent("""\
184 @ comment
185 @c
187 /* block
188 comment */
190 // test
192 id // not a keyword
194 abstract as
195 base bool break byte
196 case catch char checked class const continue
197 decimal default delegate do double
198 else enum event explicit extern
199 false finally fixed float for foreach
200 get goto
201 if implicit in int interface internal is
202 lock long
203 namespace new null
204 object operator out override
205 params partial private protected public
206 readonly ref return
207 sbyte sealed set short sizeof stackalloc
208 static string struct switch
209 this throw true try typeof
210 uint ulong unchecked unsafe ushort using
211 value virtual void volatile
212 where while
213 yield
214 """)
215 self.color('csharp', text)
216 #@+node:ekr.20210905170507.8: *3* TestColorizer.test_colorizer_css
217 def test_colorizer_css(self):
218 text = textwrap.dedent("""\
219 /* New in 4.2. */
221 /*html tags*/
222 address, applet, area, a, base, basefont,
223 big, blockquote, body, br, b, caption, center,
224 cite, code, dd, dfn, dir, div, dl, dt, em, font,
225 form, h1, h2, h3, h4, h5, h6, head, hr, html, img,
226 input, isindex, i, kbd, link, li, link, map, menu,
227 meta, ol, option, param, pre, p, samp,
228 select, small, span, strike, strong, style, sub, sup,
229 table, td, textarea, th, title, tr, tt, ul, u, var,
230 /*units*/
231 mm, cm, in, pt, pc, em, ex, px,
232 /*colors*/
233 aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, yellow, white,
234 /*important directive*/
235 !important,
236 /*font rules*/
237 font, font-family, font-style, font-variant, font-weight, font-size,
238 /*font values*/
239 cursive, fantasy, monospace, normal, italic, oblique, small-caps,
240 bold, bolder, lighter, medium, larger, smaller,
241 serif, sans-serif,
242 /*background rules*/
243 background, background-color, background-image, background-repeat, background-attachment, background-position,
244 /*background values*/
245 contained, none, top, center, bottom, left, right, scroll, fixed,
246 repeat, repeat-x, repeat-y, no-repeat,
247 /*text rules*/
248 word-spacing, letter-spacing, text-decoration, vertical-align, text-transform, text-align, text-indent, text-transform, text-shadow, unicode-bidi, line-height,
249 /*text values*/
250 normal, none, underline, overline, blink, sub, super, middle, top, text-top, text-bottom,
251 capitalize, uppercase, lowercase, none, left, right, center, justify,
252 line-through,
253 /*box rules*/
254 margin, margin-top, margin-bottom, margin-left, margin-right,
255 margin, padding-top, padding-bottom, padding-left, padding-right,
256 border, border-width, border-style, border-top, border-top-width, border-top-style, border-bottom, border-bottom-width, border-bottom-style, border-left, border-left-width, border-left-style, border-right, border-right-width, border-right-style, border-color,
257 /*box values*/
258 width, height, float, clear,
259 auto, thin, medium, thick, left, right, none, both,
260 none, dotted, dashed, solid, double, groove, ridge, inset, outset,
261 /*display rules*/
262 display, white-space,
263 min-width, max-width, min-height, max-height,
264 outline-color, outline-style, outline-width,
265 /*display values*/
266 run-in, inline-block, list-item, block, inline, none, normal, pre, nowrap, table-cell, table-row, table-row-group, table-header-group, inline-table, table-column, table-column-group, table-cell, table-caption
267 /*list rules*/
268 list-style, list-style-type, list-style-image, list-style-position,
269 /*list values*/
270 disc, circle, square, decimal, decimal-leading-zero, none,
271 lower-roman, upper-roman, lower-alpha, upper-alpha, lower-latin, upper-latin,
272 /*table rules*/
273 border-collapse, caption-side,
274 /*table-values*/
275 empty-cells, table-layout,
276 /*misc values/rules*/
277 counter-increment, counter-reset,
278 marker-offset, z-index,
279 cursor, direction, marks, quotes,
280 clip, content, orphans, overflow, visibility,
281 /*aural rules*/
282 pitch, range, pitch-during, cue-after, pause-after, cue-before, pause-before, speak-header, speak-numeral, speak-punctuation, speed-rate, play-during, voice-family,
283 /*aural values*/
284 stress, azimuth, elevation, pitch, richness, volume,
285 page-break, page-after, page-inside
286 """)
287 self.color('css', text)
288 #@+node:ekr.20210905170507.9: *3* TestColorizer.test_colorizer_CWEB
289 def test_colorizer_CWEB(self):
290 text = textwrap.dedent(r"""\\\
291 % This is limbo in cweb mode... It should be in \LaTeX mode, not \c mode.
292 % The following should not be colorized: class,if,else.
294 @* this is a _cweb_ comment. Code is written in \c.
295 "strings" should not be colorized.
296 It should be colored in \LaTeX mode.
297 The following are not keywords in latex mode: if, else, etc.
298 Noweb section references are _valid_ in cweb comments!
299 < < section ref > >
300 < < missing ref > >
301 @c
303 and this is C code. // It is colored in \LaTeX mode by default.
304 /* This is a C block comment. It may also be colored in restricted \LaTeX mode. */
306 // Section refs are valid in code too, of course.
307 < < section ref > >
308 < < missing ref > >
310 \LaTeX and \c should not be colored.
311 if else, while, do // C keywords.
312 """)
313 self.color('cweb', text)
314 #@+node:ekr.20210905170507.10: *3* TestColorizer.test_colorizer_cython
315 def test_colorizer_cython(self):
316 text = textwrap.dedent("""\
317 by cdef cimport cpdef ctypedef enum except?
318 extern gil include nogil property public
319 readonly struct union DEF IF ELIF ELSE
321 NULL bint char dict double float int list
322 long object Py_ssize_t short size_t void
324 try:
325 pass
326 except Exception:
327 pass
328 """)
329 self.color('cython', text)
330 #@+node:ekr.20210905170507.11: *3* TestColorizer.test_colorizer_elisp
331 def test_colorizer_elisp(self):
332 text = textwrap.dedent("""\
333 ; Maybe...
334 error princ
336 ; More typical of other lisps...
337 and apply
338 car cdr cons cond
339 defconst defun defvar
340 eq equal eval
341 gt ge
342 if
343 let le lt
344 mapcar
345 ne nil
346 or not
347 prog progn
348 set setq
349 t type-of
350 unless
351 when while
352 """)
353 self.color('elisp', text)
354 #@+node:ekr.20210905170507.12: *3* TestColorizer.test_colorizer_erlang
355 def test_colorizer_erlang(self):
356 text = textwrap.dedent("""\
357 halt()
359 -module()
360 """)
361 self.color('erlang', text)
362 #@+node:ekr.20210905170507.13: *3* TestColorizer.test_colorizer_forth
363 def test_colorizer_forth(self):
364 text = textwrap.dedent(r"""\\\
365 \ tiny demo of Leo forth syntax colouring
367 : some-forth-word ( x1 x2 -- x3 ) \ blue :, black/bold some-forth-word
368 label: y \ blue label:
369 asm[ s" some string" type ]asm cr
370 asm[ abc ]asm
371 a
372 s" abc "
373 s" abc"
374 a
375 tty" abc "
376 lcd2" abc "
377 until
379 @ test
380 @c
382 { abc }
384 a b @ c
386 asm[ abc ]asm
388 .( ab ) \ a string
390 : foo [ .s ] ;
392 [ a b c
393 x y z]
394 ;
395 """)
396 self.color('forth', text)
397 #@+node:ekr.20210905170507.14: *3* TestColorizer.test_colorizer_HTML_string_bug
398 def test_colorizer_HTML_string_bug(self):
399 text = textwrap.dedent("""\
400 b = "cd"
401 d
402 """)
403 self.color('html', text)
404 #@+node:ekr.20210905170507.15: *3* TestColorizer.test_colorizer_HTML1
405 def test_colorizer_HTML1(self):
406 text = textwrap.dedent("""\
407 <HTML>
408 <!-- Author: Edward K. Ream, edream@tds.net -->
409 <HEAD>
410 <META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
411 <TITLE> Leo's Home Page </TITLE>
412 <META NAME="description" CONTENT="This page describes Leo.
413 Leo adds powerful outlines to the noweb and CWEB literate programming languages.">
414 <META NAME="keywords" CONTENT="LEO, LITERATE PROGRAMMING, OUTLINES, CWEB,
415 NOWEB, OUTLINES, EDWARD K. REAM, DONALD E. KNUTH, SILVIO LEVY, OPEN SOFTWARE">
416 </HEAD>
417 <!-- Last Modified: May 12, 2002 -->
418 <BODY BGCOLOR="#fffbdc">
420 <H1 ALIGN=CENTER><a NAME="top"></a><IMG SRC="Blank.gif" width=
421 "32" height="32" ALIGN="BOTTOM" NATURALSIZEFLAG="3"><IMG SRC="leo.gif"
422 WIDTH="32" HEIGHT="32" ALIGN="BOTTOM" NATURALSIZEFLAG="3"><a href="leo_TOC.html#top"><IMG SRC=
423 "arrow_rt.gif" WIDTH="32" HEIGHT="32" ALIGN="BOTTOM" NATURALSIZEFLAG="3"></a> </H1>
425 <H1 ALIGN=CENTER> Leo's Home Page</H1>
427 <p align="center"><a href="http://www.python.org/"><img border="0" src="PythonPowered.gif" width="110" height="44"> </a> <A HREF="http://sourceforge.net/"><IMG SRC="http://sourceforge.net/sflogo.php?group_id=3458&type=1" NATURALSIZEFLAG="0" ALT="SourceForge Logo"></A>
428 <A HREF="http://sourceforge.net/project/?group_id=3458">Leo at SourceForge</A>
429 <a href="icons.html"><img border="0" src="LeoCodeGray.gif" width="77" height="42"></a>
430 <a href="icons.html"><img border="0" src="LeoProse.gif" width="81" height="42"></a>
432 <H3><A NAME="anchor127554"></A>Summary</H3>
434 <UL>
435 <LI>Leo is a <i> programmer's editor</i> and a flexible <i>browser</i> for
436 projects, programs, classes or data. Leo clarifies design, coding, debugging, testing
437 and maintenance.
438 <LI>Leo is an <i>outlining editor</i>. Outlines clarify the big picture while
439 providing unlimited space for details.
440 <LI>Leo
441 is a <a HREF="http://www.literateprogramming.com/"><i>literate
442 programming</i></a> tool, compatible with <A HREF="http://www.eecs.harvard.edu/~nr/noweb/">noweb</A>
443 and <a HREF="http://www-cs-faculty.stanford.edu/~knuth/cweb.html">CWEB</a>.
444 Leo enhances any text-based
445 programming language, from assembly language and C to Java, Python and XML.
446 <LI>Leo is also a <i>data organizer</i>. A single Leo outline can generate complex
447 data spanning many different files. Leo has been used to manage web sites.
448 <LI>Leo is a <i> project manager</i>. Leo provides multiple views
449 of a project within a single outline. Leo naturally represents tasks that remain
450 up-to-date.
451 <LI>Leo is fully <i> scriptable</i> using <A HREF="http://www.python.org/">Python</A>
452 and saves its files in <A HREF="http://www.w3.org/XML/">XML</A> format.
453 <LI>Leo is <i>portable</i>. Leo.py is 100% pure Python and will run on
454 any platform supporting <A HREF="http://www.python.org/">Python</A>
455 and <a href="http://tcl.activestate.com/">Tk/tcl</a>, including Windows,
456 Linux and MacOS X. Leo.exe runs on any Windows platform.
457 <LI>Leo is <a href="http://www.opensource.org/"> <i> Open Software</i></a>, distributed under
458 the <a href="http://www.python.org/doc/Copyright.html"> Python License</a>.
459 </UL>
461 <H3>More Information and downloads</H3>
463 <ul>
464 <LI>An excellent <a href="http://www.3dtree.com/ev/e/sbooks/leo/sbframetoc_ie.htm">online
465 tutorial</a> and <A HREF="http://www.jserv.com/jk_orr/xml/leo.htm">Leo resource
466 page</A>, both written by <a href="http://www.jserv.com/jk_orr">Joe Orr</a>.
467 <LI>My brother's <a href="SpeedReam.html">slashdot
468 article about Leo</a>, the best description about why Leo is special.
469 <LI><A HREF="testimonials.html#anchor104391">What people are saying about Leo</A>
470 <LI><A HREF="leo_TOC.html#anchor964914">Complete users guide</A>
471 and
472 <A HREF="intro.html#anchor887874">tutorial introduction</A> with
473 screen shots.
474 <li><a href="FAQ.html">FAQ</a> and <a href="http://sourceforge.net/forum/?group_id=3458">help and discussion
475 forums</a>, preferable to <A HREF="mailto:edream@tds.net">email</A> so others may join
476 in.</li>
477 <li><a href="icons.html">Icons</a> for bragging about Leo.</li>
478 </ul>
480 <a href="http://sourceforge.net/project/showfiles.php?group_id=3458">Download
481 Leo</a> from <A HREF="http://sourceforge.net/project/?group_id=3458">Leo's SourceForge
482 site</A>.
484 <P ALIGN=left>Leo's author is <A HREF="http://personalpages.tds.net/~edream/index.html">Edward
485 K. Ream</A> email: <A HREF="mailto:edream@tds.net">edream@tds.net</A> voice: (608) 231-0766
487 <HR ALIGN=LEFT>
489 <p align="center">
491 <IMG SRC="Blank.gif" ALIGN="left" NATURALSIZEFLAG=
492 "3" width="34" height="34"><IMG SRC="leo.gif" ALIGN="left" NATURALSIZEFLAG=
493 "3" width="32" height="32"><a HREF="leo_TOC.html"><IMG SRC="arrow_rt.gif" WIDTH="32"
494 HEIGHT="32" ALIGN="left" NATURALSIZEFLAG="3">
496 </BODY>
497 </HTML>
498 """)
499 self.color('html', text)
500 #@+node:ekr.20210905170507.16: *3* TestColorizer.test_colorizer_HTML2
501 def test_colorizer_HTML2(self):
502 text = textwrap.dedent("""\
503 <? xml version="1.0">
504 <!-- test -->
505 <project name="Converter" default="dist">
506 </project>
507 """)
508 self.color('html', text)
509 #@+node:ekr.20210905170507.17: *3* TestColorizer.test_colorizer_Java
510 def test_colorizer_Java(self):
511 text = textwrap.dedent('''\
512 @ doc part
513 @c
515 @language java /* Colored by match_leo_keyword: tag = leoKeyword. */
517 @whatever /* Colored by java match_following rule: tag = keyword4. */
519 /** A javadoc: tag = comment3 */
521 /** <!-- comment --> tag = comment1. */
523 /** @see tag = label */
524 ''')
525 self.color('java', text)
526 #@+node:ekr.20210905170507.18: *3* TestColorizer.test_colorizer_LaTex
527 def test_colorizer_LaTex(self):
528 text = textwrap.dedent(r"""\\\
529 % This is a \LaTeX mode comment.
531 This is a test of \LaTeX mode.
533 @ blah blah blah
534 @c
536 \c and \LaTeX are latex keywords.
538 This is a keyword \% not the start of a comment.
540 More keywords: \@ and \( and \) and \{ and \}
542 The following should be colored:
544 \documentclass{report}
546 The following 2-letter words should be colored, regardless of what follows:
548 \(\)\{\}\@
549 \(abc\)abc\{abc\}abc\@abc
550 """)
551 self.color('latex', text)
552 #@+node:ekr.20210905170507.19: *3* TestColorizer.test_colorizer_lisp
553 def test_colorizer_lisp(self):
554 text = textwrap.dedent("""\
555 ; Maybe...
556 error princ
558 ; More typical of other lisps...
559 and apply
560 car cdr cons cond
561 defconst defun defvar
562 eq equal eval
563 gt ge
564 if
565 let le lt
566 mapcar
567 ne nil
568 or not
569 prog progn
570 set setq
571 t type-of
572 unless
573 when while
574 """)
575 self.color('lisp', text)
576 #@+node:ekr.20210905170507.20: *3* TestColorizer.test_colorizer_objective_c
577 def test_colorizer_objective_c(self):
578 text = textwrap.dedent("""\
579 @interface Application
580 -(void) init;
581 -(void) showMessage;
582 @end
584 @implementation Application
585 -(id) init {
586 if (self = [super init]) {
587 NSLog(@"Init ok");
588 return self;
589 }
590 return nil;
591 }
592 -(void) showMessage {
593 NSLog(@"Hello there");
594 }
595 @end
597 @"Hello there"
599 ,@interface
600 , @interface
601 the @interface
603 // By the way, I have noticed that such kind of words in doxygen block
604 // are highlighted properly, but they are labels here, not keywords1 as in my case.
605 /**
606 @var test
607 @todo
608 */
609 """)
610 self.color('objective_c', text)
611 #@+node:ekr.20210905170507.21: *3* TestColorizer.test_colorizer_perl
612 def test_colorizer_perl(self):
613 text = textwrap.dedent("""\
614 # From a perl tutorial.
616 print 'Hello world.'; # Print a message
618 $a = $b; # Assign $b to $a
620 @food = ("apples", "pears", "eels");
622 $grub = pop(@food); # Now $grub = "eels"
624 $#food
626 @lines = <INFO>;
628 #!/usr/local/bin/perl
629 print "Password? "; # Ask for input
630 $a = <STDIN>; # Get input
631 chop $a; # Remove the newline at end
632 while ($a ne "fred") # While input is wrong...
633 {
634 print "sorry. Again? "; # Ask again
635 $a = <STDIN>; # Get input again
636 chop $a; # Chop off newline again
637 }
639 if ($sentence =~ /under/)
640 {
641 print "We're talking about rugby\\n";
642 }
644 $sentence =~ s/london/London/
646 $_ = "Capes:Geoff::Shot putter:::Big Avenue";
647 @personal = split(/:/);
649 foreach $age (values %ages)
650 {
651 print "Somebody is $age\\n";
652 }
654 &mysubroutine; # Call the subroutine
655 &mysubroutine($_); # Call it with a parameter
656 &mysubroutine(1+2, $_); # Call it with two parameters
658 sub inside
659 {
660 local($a, $b); # Make local variables
661 ($a, $b) = ($_[0], $_[1]); # Assign values
662 $a =~ s/ //g; # Strip spaces from
663 $b =~ s/ //g; # local variables
664 ($a =~ /$b/ || $b =~ /$a/); # Is $b inside $a
665 # or $a inside $b?
666 }
667 """)
668 self.color('perl', text)
669 #@+node:ekr.20210905170507.22: *3* TestColorizer.test_colorizer_PHP
670 def test_colorizer_PHP(self):
671 text = textwrap.dedent("""\
672 @ doc
673 This is a doc part.
674 @c
676 and or
677 array
678 array()
679 /* Multi-line comment
680 */
681 this is a test.
682 __CLASS__
683 <?php and or array() ?>
684 <?PHP and or array() ?>
685 """)
686 self.color('php', text)
687 #@+node:ekr.20210905170507.23: *3* TestColorizer.test_colorizer_plsql
688 def test_colorizer_plsql(self):
689 text = textwrap.dedent("""\
690 "a string"
691 -- reserved keywords
692 ABORT,
693 abort,
694 ACceSS,
695 access,
696 add,
697 all,
698 allocate,
699 alter,
700 analyze,
701 and,
702 any,
703 archive,
704 archivelog,
705 array,
706 arraylen,
707 as,
708 asc,
709 assert,
710 assign,
711 at,
712 audit,
713 authorization,
714 avg,
715 backup,
716 base_table,
717 become,
718 before,
719 begin,
720 between,
721 binary_integer,
722 block,
723 body,
724 boolean,
725 by,
726 cache,
727 cancel,
728 cascade,
729 case,
730 change,
731 char,
732 char_base,
733 character,
734 check,
735 checkpoint,
736 close,
737 cluster,
738 clusters,
739 cobol,
740 colauth,
741 column,
742 columns,
743 comment,
744 commit,
745 compile,
746 compress,
747 connect,
748 constant,
749 constraint,
750 constraints,
751 contents,
752 continue,
753 controlfile,
754 count,
755 crash,
756 create,
757 current,
758 currval,
759 cursor,
760 cycle,
761 data_base,
762 database,
763 datafile,
764 date,
765 dba,
766 debugoff,
767 debugon,
768 dec,
769 decimal,
770 declare,
771 default,
772 definition,
773 delay,
774 delete,
775 delta,
776 desc,
777 digits,
778 disable,
779 dismount,
780 dispose,
781 distinct,
782 distinct,
783 do,
784 double,
785 drop,
786 drop,
787 dump,
788 each,
789 else,
790 else,
791 elsif,
792 enable,
793 end,
794 end,
795 entry,
796 escape,
797 events,
798 except,
799 exception,
800 exception_init,
801 exceptions,
802 exclusive,
803 exec,
804 execute,
805 exists,
806 exists,
807 exit,
808 explain,
809 extent,
810 externally,
811 false,
812 fetch,
813 fetch,
814 file,
815 float,
816 float,
817 flush,
818 for,
819 for,
820 force,
821 foreign,
822 form,
823 fortran,
824 found,
825 freelist,
826 freelists,
827 from,
828 from,
829 function,
830 generic,
831 go,
832 goto,
833 grant,
834 group,
835 groups,
836 having,
837 identified,
838 if,
839 immediate,
840 in,
841 including,
842 increment,
843 index,
844 indexes,
845 indicator,
846 initial,
847 initrans,
848 insert,
849 instance,
850 int,
851 integer,
852 intersect,
853 into,
854 is,
855 key,
856 language,
857 layer,
858 level,
859 like,
860 limited,
861 link,
862 lists,
863 lock,
864 logfile,
865 long,
866 loop,
867 manage,
868 manual,
869 max,
870 maxdatafiles,
871 maxextents,
872 maxinstances,
873 maxlogfiles,
874 maxloghistory,
875 maxlogmembers,
876 maxtrans,
877 maxvalue,
878 min,
879 minextents,
880 minus,
881 minvalue,
882 mlslabel,
883 mod,
884 mode,
885 modify,
886 module,
887 mount,
888 natural,
889 new,
890 new,
891 next,
892 nextval,
893 noarchivelog,
894 noaudit,
895 nocache,
896 nocompress,
897 nocycle,
898 nomaxvalue,
899 nominvalue,
900 none,
901 noorder,
902 noresetlogs,
903 normal,
904 nosort,
905 not,
906 notfound,
907 nowait,
908 null,
909 number,
910 number_base,
911 numeric,
912 of,
913 off,
914 offline,
915 old,
916 on,
917 online,
918 only,
919 open,
920 open,
921 optimal,
922 option,
923 or,
924 order,
925 others,
926 out,
927 own,
928 package,
929 package,
930 parallel,
931 partition,
932 pctfree,
933 pctincrease,
934 pctused,
935 plan,
936 pli,
937 positive,
938 pragma,
939 precision,
940 primary,
941 prior,
942 private,
943 private,
944 privileges,
945 procedure,
946 procedure,
947 profile,
948 public,
949 quota,
950 raise,
951 range,
952 raw,
953 read,
954 real,
955 record,
956 recover,
957 references,
958 referencing,
959 release,
960 remr,
961 rename,
962 resetlogs,
963 resource,
964 restricted,
965 return,
966 reuse,
967 reverse,
968 revoke,
969 role,
970 roles,
971 rollback,
972 row,
973 rowid,
974 rowlabel,
975 rownum,
976 rows,
977 rowtype,
978 run,
979 savepoint,
980 schema,
981 scn,
982 section,
983 segment,
984 select,
985 select,
986 separate,
987 sequence,
988 session,
989 set,
990 set,
991 share,
992 shared,
993 size,
994 size,
995 smallint,
996 smallint,
997 snapshot,
998 some,
999 sort,
1000 space,
1001 sql,
1002 sqlbuf,
1003 sqlcode,
1004 sqlerrm,
1005 sqlerror,
1006 sqlstate,
1007 start,
1008 start,
1009 statement,
1010 statement_id,
1011 statistics,
1012 stddev,
1013 stop,
1014 storage,
1015 subtype,
1016 successful,
1017 sum,
1018 sum,
1019 switch,
1020 synonym,
1021 sysdate,
1022 system,
1023 tabauth,
1024 table,
1025 tables,
1026 tables,
1027 tablespace,
1028 task,
1029 temporary,
1030 terminate,
1031 then,
1032 thread,
1033 time,
1034 to,
1035 tracing,
1036 transaction,
1037 trigger,
1038 triggers,
1039 true,
1040 truncate,
1041 type,
1042 uid,
1043 under,
1044 union,
1045 unique,
1046 unlimited,
1047 until,
1048 update,
1049 use,
1050 user,
1051 using,
1052 validate,
1053 values,
1054 varchar,
1055 varchar2,
1056 variance,
1057 view,
1058 views,
1059 when,
1060 whenever,
1061 where,
1062 while,
1063 with,
1064 work,
1065 write,
1066 xor
1067 """)
1068 self.color('plsql', text)
1069 #@+node:ekr.20210905170507.24: *3* TestColorizer.test_colorizer_python_xml_jEdit_
1070 def test_colorizer_python_xml_jEdit_(self):
1071 text = textwrap.dedent(r"""\\\
1072 <?xml version="1.0"?>
1074 <!DOCTYPE MODE SYSTEM "xmode.dtd">
1075 < < remarks > >
1077 <MODE>
1078 <PROPS>
1079 <PROPERTY NAME="indentPrevLine" VALUE="\s*.{3,}:\s*(#.*)?" />
1080 <PROPERTY NAME="lineComment" VALUE="#" />
1081 </PROPS>
1082 <RULES ESCAPE="\" IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="TRUE">
1083 < < comments > >
1084 < < literals > >
1085 < < operators > >
1086 <MARK_PREVIOUS TYPE="FUNCTION" EXCLUDE_MATCH="TRUE">(</MARK_PREVIOUS>
1087 < < keywords > >
1088 </RULES>
1089 </MODE>
1090 """)
1091 self.color('html', text)
1092 #@+node:ekr.20210905170507.25: *3* TestColorizer.test_colorizer_Python1
1093 def test_colorizer_Python1(self):
1094 text = textwrap.dedent("""\
1095 int
1096 float
1097 dict
1098 """)
1099 self.color('python', text)
1100 #@+node:ekr.20210905170507.26: *3* TestColorizer.test_colorizer_Python2
1101 def test_colorizer_Python2(self):
1103 text = textwrap.dedent('''\
1104 """This creates a free-floating copy of v's tree for undo.
1105 The copied trees must use different vnodes than the original."""
1107 def copyTree(self,root):
1108 c = self
1109 # Create the root VNode.
1110 result = v = leoNodes.VNode(c)
1111 # Copy the headline and icon values v.copyNode(root,v)
1112 # Copy the rest of tree.
1113 v.copyTree(root,v)
1114 # Replace all vnodes in v by copies.
1115 assert(v.nodeAfterTree() == None)
1116 while v:
1117 v = leoNodes.VNode(c)
1118 v = v.threadNext()
1119 return result
1120 ''')
1121 self.color('python', text)
1123 #@+node:ekr.20210905170507.27: *3* TestColorizer.test_colorizer_r
1124 def test_colorizer_r(self):
1125 text = textwrap.dedent("""\
1126 x <- rnorm(10)
1128 vv <- function(z) return(z)
1130 def python_funct(uu):
1131 return uu
1132 """)
1133 self.color('r', text)
1134 #@+node:ekr.20210905170507.28: *3* TestColorizer.test_colorizer_rapidq
1135 def test_colorizer_rapidq(self):
1136 text = textwrap.dedent("""\
1137 ' New in 4.2.
1138 ' a comment.
1140 $APPTYPE,$DEFINE,$ELSE,$ENDIF,$ESCAPECHARS,$IFDEF,$IFNDEF,
1141 $INCLUDE,$MACRO,$OPTIMIZE,$OPTION,$RESOURCE,$TYPECHECK,$UNDEF,
1142 ABS,ACOS,ALIAS,AND,AS,ASC,ASIN,ATAN,ATN,BIN$,BIND,BYTE,
1143 CALL,CALLBACK,CALLFUNC,CASE,CEIL,CHDIR,CHDRIVE,CHR$,CINT,
1144 CLNG,CLS,CODEPTR,COMMAND$,COMMANDCOUNT,CONSOLE,CONST,CONSTRUCTOR,
1145 CONVBASE$,COS,CREATE,CSRLIN,CURDIR$,DATA,DATE$,DEC,DECLARE,
1146 DEFBYTE,DEFDBL,DEFDWORD,DEFINT,DEFLNG,DEFSHORT,DEFSNG,DEFSTR,
1147 DEFWORD,DELETE$,DIM,DIR$,DIREXISTS,DO,DOEVENTS,DOUBLE,DWORD,
1148 ELSE,ELSEIF,END,ENVIRON,ENVIRON$,EVENT,EXIT,EXP,EXTENDS,
1149 EXTRACTRESOURCE,FIELD$,FILEEXISTS,FIX,FLOOR,FOR,FORMAT$,FRAC,
1150 FUNCTION,FUNCTIONI,GET$,GOSUB,GOTO,HEX$,IF,INC,INITARRAY,
1151 INKEY$,INP,INPUT,INPUT$,INPUTHANDLE,INSERT$,INSTR,INT,INTEGER,
1152 INV,IS,ISCONSOLE,KILL,KILLMESSAGE,LBOUND,LCASE$,LEFT$,LEN,
1153 LFLUSH,LIB,LIBRARYINST,LOCATE,LOG,LONG,LOOP,LPRINT,LTRIM$,
1154 MEMCMP,MESSAGEBOX,MESSAGEDLG,MID$,MKDIR,MOD,MOUSEX,MOUSEY,
1155 NEXT,NOT,OFF,ON,OR,OUT,OUTPUTHANDLE,PARAMSTR$,PARAMSTRCOUNT,
1156 PARAMVAL,PARAMVALCOUNT,PCOPY,PEEK,PLAYWAV,POKE,POS,POSTMESSAGE,
1157 PRINT,PROPERTY,QUICKSORT,RANDOMIZE,REDIM,RENAME,REPLACE$,
1158 REPLACESUBSTR$,RESOURCE,RESOURCECOUNT,RESTORE,RESULT,RETURN,
1159 REVERSE$,RGB,RIGHT$,RINSTR,RMDIR,RND,ROUND,RTRIM$,RUN,
1160 SCREEN,SELECT,SENDER,SENDMESSAGE,SETCONSOLETITLE,SGN,SHELL,
1161 SHL,SHORT,SHOWMESSAGE,SHR,SIN,SINGLE,SIZEOF,SLEEP,SOUND,
1162 SPACE$,SQR,STACK,STATIC,STEP,STR$,STRF$,STRING,STRING$,
1163 SUB,SUBI,SWAP,TALLY,TAN,THEN,TIME$,TIMER,TO,TYPE,UBOUND,
1164 UCASE$,UNLOADLIBRARY,UNTIL,VAL,VARIANT,VARPTR,VARPTR$,VARTYPE,
1165 WEND,WHILE,WITH,WORD,XOR
1166 """)
1167 self.color('rapidq', text)
1168 #@+node:ekr.20210905170507.29: *3* TestColorizer.test_colorizer_Rebol
1169 def test_colorizer_Rebol(self):
1170 text = textwrap.dedent("""\
1171 ; a comment
1172 about abs absolute add alert alias all alter and and~ any append arccosine arcsine arctangent array ask at
1173 back bind boot-prefs break browse build-port build-tag
1174 call caret-to-offset catch center-face change change-dir charset checksum choose clean-path clear clear-fields close comment complement compose compress confirm continue-post context copy cosine create-request crypt cvs-date cvs-version
1175 debase decode-cgi decode-url decompress deflag-face dehex delete demo desktop detab dh-compute-key dh-generate-key dh-make-key difference dirize disarm dispatch divide do do-boot do-events do-face do-face-alt does dsa-generate-key dsa-make-key dsa-make-signature dsa-verify-signature
1176 echo editor either else emailer enbase entab exclude exit exp extract
1177 fifth find find-key-face find-window flag-face first flash focus for forall foreach forever form forskip fourth free func function
1178 get get-modes get-net-info get-style
1179 halt has head help hide hide-popup
1180 if import-email in inform input insert insert-event-func intersect
1181 join
1182 last launch launch-thru layout license list-dir load load-image load-prefs load-thru log-10 log-2 log-e loop lowercase
1183 make make-dir make-face max maximum maximum-of min minimum minimum-of mold multiply
1184 negate net-error next not now
1185 offset-to-caret open open-events or or~
1186 parse parse-email-addrs parse-header parse-header-date parse-xml path-thru pick poke power prin print probe protect protect-system
1187 q query quit
1188 random read read-io read-net read-thru reboot recycle reduce reform rejoin remainder remold remove remove-event-func rename repeat repend replace request request-color request-date request-download request-file request-list request-pass request-text resend return reverse rsa-encrypt rsa-generate-key rsa-make-key
1189 save save-prefs save-user scroll-para second secure select send send-and-check set set-modes set-font set-net set-para set-style set-user set-user-name show show-popup sine size-text skip sort source split-path square-root stylize subtract switch
1190 tail tangent textinfo third throw throw-on-error to to-binary to-bitset to-block to-char to-date to-decimal to-email to-event to-file to-get-word to-hash to-hex to-idate to-image to-integer to-issue to-list to-lit-path to-lit-word to-local-file to-logic to-money to-none to-pair to-paren to-path to-rebol-file to-refinement to-set-path to-set-word to-string to-tag to-time to-tuple to-url to-word trace trim try
1191 unfocus union unique uninstall unprotect unset until unview update upgrade uppercase usage use
1192 vbug view view-install view-prefs
1193 wait what what-dir while write write-io
1194 xor xor~
1195 action! any-block! any-function! any-string! any-type! any-word!
1196 binary! bitset! block!
1197 char!
1198 datatype! date! decimal!
1199 email! error! event!
1200 file! function!
1201 get-word!
1202 hash!
1203 image! integer! issue!
1204 library! list! lit-path! lit-word! logic!
1205 money!
1206 native! none! number!
1207 object! op!
1208 pair! paren! path! port!
1209 refinement! routine!
1210 series! set-path! set-word! string! struct! symbol!
1211 tag! time! tuple!
1212 unset! url!
1213 word!
1214 any-block? any-function? any-string? any-type? any-word?
1215 binary? bitset? block?
1216 char? connected? crypt-strength?
1217 datatype? date? decimal? dir?
1218 email? empty? equal? error? even? event? exists? exists-key?
1219 file? flag-face? found? function?
1220 get-word? greater-or-equal? greater?
1221 hash? head?
1222 image? in-window? index? info? input? inside? integer? issue?
1223 length? lesser-or-equal? lesser? library? link-app? link? list? lit-path? lit-word? logic?
1224 modified? money?
1225 native? negative? none? not-equal? number?
1226 object? odd? offset? op? outside?
1227 pair? paren? path? port? positive?
1228 refinement? routine?
1229 same? screen-offset? script? series? set-path? set-word? size? span? strict-equal? strict-not-equal? string? struct?
1230 tag? tail? time? tuple? type?
1231 unset? url?
1232 value? view?
1233 within? word?
1234 zero?
1235 """)
1236 self.color('rebol', text)
1237 #@+node:ekr.20210905170507.30: *3* TestColorizer.test_colorizer_rest
1238 def test_colorizer_rest(self):
1239 text = textwrap.dedent(r"""\\\
1240 @ @rst-options
1241 code_mode=False
1242 generate_rst=True
1243 http_server_support = False
1244 show_organizer_nodes=True
1245 show_headlines=True
1246 show_leo_directives=True
1247 stylesheet_path=..\doc
1248 write_intermediate_file = False
1249 verbose=True
1250 @c
1252 . Links used in this document...
1254 .. _`Pmw`: http://pmw.sourceforge.net/
1255 .. _run: `Running Leo`_
1257 .. WARNING: image targets may not have upper case letters!
1259 .. |back| image:: arrow_lt.gif
1260 :target: FAQ.html
1262 .. |leo| image:: leo.gif
1263 :target: front.html
1265 .. |next| image:: arrow_rt.gif
1266 :target: intro.html
1268 |back| |leo| |next|
1270 ###########################
1271 Chapter 1: Installing Leo
1272 ###########################
1274 This chapter tells how to install and run Leo.
1276 **Important**:
1278 If you have *any* problems installing Leo,
1279 please ask for help on Leo's help forum:
1281 .. contents::
1283 **Windows**
1284 If you have `associated .leo files with Leo`_ you may run Leo by double-clicking any .leo file.
1285 You can also use a batch file.
1286 Put the following .bat file in c:\\Windows::
1288 cd c:\prog\LeoCVS\leo
1289 c:\python22\python c:\prog\LeoCVS\leo\leo.py %1
1291 - Download the latest version of Leo from `Leo's download page`_.
1293 - In Windows 2K or XP, go to ``Start->Settings->Control panel``, open the ``Folder Options`` tab.
1295 **Warning**: When building Tcl on Linux, do **not** specify
1296 "--enable-threads".
1297 Only use Tcl with the default "threads not enabled" case.
1299 -------------
1301 |back| |leo| |next|
1302 """)
1303 self.color('rest', text)
1304 #@+node:ekr.20210905170507.31: *3* TestColorizer.test_colorizer_scala
1305 def test_colorizer_scala(self):
1306 text = textwrap.dedent("""\
1307 /* A comment */
1309 object HelloWorld {
1310 def main(args: Array[String]) {
1311 println("Hello, world!")
1312 }
1313 }
1314 """)
1315 self.color('scala', text)
1316 #@+node:ekr.20210905170507.32: *3* TestColorizer.test_colorizer_shell
1317 def test_colorizer_shell(self):
1318 text = textwrap.dedent("""\
1319 # New in 4.2.
1321 # comment
1322 $# not a comment
1323 break
1324 case,continue,
1325 do,done
1326 elif,else,esac
1327 fi,for
1328 if,in
1329 return,
1330 then
1331 until
1332 while,
1334 cd,chdir,eval,exec,
1335 exit,kill,newgrp,pwd,read,readonly,
1336 shift,test,trap,ulimit,
1337 umask,wait
1338 """)
1339 self.color('shell', text)
1340 #@+node:ekr.20210905170507.33: *3* TestColorizer.test_colorizer_shellscript
1341 def test_colorizer_shellscript(self):
1342 text = textwrap.dedent("""\
1343 # comment
1344 $# not a comment
1345 break
1346 case,continue,
1347 do,done
1348 elif,else,esac
1349 fi,for
1350 if,in
1351 return,
1352 then
1353 until
1354 while,
1356 cd,chdir,eval,exec,
1357 exit,kill,newgrp,pwd,read,readonly,
1358 shift,test,trap,ulimit,
1359 umask,wait
1360 """)
1361 self.color('shellscript', text)
1362 #@+node:ekr.20210905170507.34: *3* TestColorizer.test_colorizer_tex_xml_jEdit_
1363 def test_colorizer_tex_xml_jEdit_(self):
1364 text = textwrap.dedent("""\
1365 <!-- ekr uses the MARK_FOLLOWING to mark _anything_ after \\ -->
1367 <?xml version="1.0"?>
1369 <!DOCTYPE MODE SYSTEM "xmode.dtd">
1371 <MODE>
1372 <PROPS>
1373 <PROPERTY NAME="lineComment" VALUE="%" />
1374 </PROPS>
1376 <RULES>
1377 < < general rules > >
1378 </RULES>
1380 <RULES SET="MATH" DEFAULT="MARKUP">
1381 < < math rules > >
1382 </RULES>
1383 </MODE>
1384 """)
1385 self.color('html', text)
1386 #@+node:ekr.20210905170507.36: *3* TestColorizer.test_colorizer_wikiTest
1387 def test_colorizer_wikiTest(self):
1388 # both color_markup & add_directives plugins must be enabled.
1389 text = textwrap.dedent('''\
1390 @markup wiki
1392 """ text~~red:some text~~more text"""
1394 """ text~~#ee0ff:some text~~more text"""
1396 if 1 and 2:
1397 pass
1398 ''')
1399 self.color('html', text)
1400 #@+node:ekr.20210905170507.39: *3* TestColorizer.test_scanColorDirectives
1401 def test_scanColorDirectives(self):
1402 c = self.c
1403 language = g.findLanguageDirectives(c, c.p)
1404 self.assertEqual(language, 'python')
1405 #@+node:ekr.20210905170507.40: *3* TestColorizer.test_vbscript
1406 def test_vbscript(self):
1407 text = textwrap.dedent("""\
1408 if
1409 IF
1410 """)
1411 self.color('vbscript', text)
1412 #@-others
1413#@-others
1414#@-leo