====== Tests of CLI Plugin ======
This page provides a set of test cases for the [[plugins:cli|CLI Plugin]] and also serves as an example of its use.
===== Basic Shell Script =====
Wiki text:
user@host:~/somedir $ ls
conf lang README screen.gif ui
info.txt manager.dat renderer.php syntax.php
user@host:~/somedir $ wc info.txt # count words in info.txt
55 108 1032 info.txt
user@host:~/somedir $
Rendered result:
user@host:~/somedir $ ls
conf lang README screen.gif ui
info.txt manager.dat renderer.php syntax.php
user@host:~/somedir $ wc info.txt # count words in info.txt
55 108 1032 info.txt
user@host:~/somedir $
===== Shell Script with Comments =====
user@host:~/somedir $ ls # List current directory
conf lang README screen,gif ui
info.txt manager.dat renderer.php syntax.php
user@host:~/somedir $
===== Root Shell Script with Comments =====
This (default shell comment character):
root@host:~user/somedir # ls # List current directory
conf lang README screen,gif ui
info.txt manager.dat renderer.php syntax.php
root@host:~user/somedir #
renders as this:
root@host:~user/somedir # ls # List current directory
conf lang README screen,gif ui
info.txt manager.dat renderer.php syntax.php
root@host:~user/somedir #
This is also valid:
root@host:~user/somedir # ls # List current directory
conf lang README screen,gif ui
info.txt manager.dat renderer.php syntax.php
root@host:~user/somedir #
root@host:~user/somedir # ls # List current directory
conf lang README screen,gif ui
info.txt manager.dat renderer.php syntax.php
root@host:~user/somedir #
Example with a continuation prompt:
user@host:~/somedir $ ls \
> # List directory
file1 file2
user@host:~/somedir $ ls \
> # List directory
file1 file2
===== Shell Script with Comments =====
user@host:~/somedir $ ls # List current directory
conf lang README screen,gif ui
info.txt manager.dat renderer.php syntax.php
user@host:~/somedir $
===== Windows Command Window =====
Wiki text:
C:\Users\User>REM hello world!
C:\Users\User>echo 'hello world!'
'hello world!'
Rendered result:
C:\Users\User>REM hello world!
C:\Users\User>echo 'hello world!'
'hello world!'
===== Ruby irb =====
Simple minded implementation will not work for results as end of prompt is same as results marker!
irb(main):001:0> 2+2
=> 4
irb(main):002:0>
===== Python =====
ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 2+2
4
>>>
===== Python + Windows Shell (Nested CLIs) =====
Wiki text:
C:\Users\Chris Jobling>python
ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 2+2
4
>>> ^Z
C:\Users\Chris Jobling>
Rendered result:
Wiki text:
C:\Users\Chris Jobling>python
ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 2+2
4
>>> ^Z
C:\Users\Chris Jobling>
===== Corner Cases =====
* The following codes don't display right
# rpm -ivh darcs-1.0.9-3.fc6.i386.rpm
Preparing... ########################################### [100%]
1:darcs ########################################### [100%]
# rpm -ivh darcs-1.0.9-3.fc6.i386.rpm
Preparing... ########################################### [100%]
1:darcs ########################################### [100%]
Not sure to do about this as download progress marker uses same character as prompt!
* CLI shouldn't silently eat intentional blank lines:
user@host:~/somedir $ ls # List current directory
conf lang README screen,gif ui
info.txt manager.dat renderer.php syntax.php
user@host:~/somedir $ # I intended there to be two blank lines above!