Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
inferior-shell
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
qitab
inferior-shell
Commits
ae7c7dbe
Unverified
Commit
ae7c7dbe
authored
1 year ago
by
François-René Rideau
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge pull request
#1
from jcguu95/master
Add more tests.
parents
15c2d04a
7025daf0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inferior-shell.asd
+1
-1
1 addition, 1 deletion
inferior-shell.asd
test.lisp
+74
-12
74 additions, 12 deletions
test.lisp
with
75 additions
and
13 deletions
inferior-shell.asd
+
1
−
1
View file @
ae7c7dbe
...
@@ -23,6 +23,6 @@
...
@@ -23,6 +23,6 @@
(
symbol-call
:inferior-shell-test
:test-suite
)))
(
symbol-call
:inferior-shell-test
:test-suite
)))
(
defsystem
"inferior-shell/test"
(
defsystem
"inferior-shell/test"
:depends-on
(
"inferior-shell"
"
hu.dwim.stefil
"
)
:depends-on
(
"inferior-shell"
"
fiveam
"
)
:description
"testing inferior-shell"
:description
"testing inferior-shell"
:components
((
:file
"test"
)))
:components
((
:file
"test"
)))
This diff is collapsed.
Click to expand it.
test.lisp
+
74
−
12
View file @
ae7c7dbe
(
in-package
:cl
)
(
in-package
:cl
)
(
defpackage
:inferior-shell-test
(
defpackage
:inferior-shell-test
(
:use
:cl
:inferior-shell
:
hu.dwim.stefil
))
(
:use
:cl
:inferior-shell
:
fiveam
))
(
in-package
:inferior-shell-test
)
(
in-package
:inferior-shell-test
)
(
declaim
(
optimize
(
speed
1
)
(
debug
3
)
(
space
3
)))
(
declaim
(
optimize
(
speed
1
)
(
debug
3
)
(
space
3
)))
(
defsuite*
(
test-suite
(
def-suite
inferior-shell-test
:in
root-suite
:description
"Suite of tests for inferior shell."
)
:documentation
"Testing inferior-shell"
))
(
defun
do-test-inferior-shell
()
(
in-suite
inferior-shell-test
)
(
is
(
equal
(
run/ss
'
(
echo
(
1
)
"2"
(
+
3
)))
"1 2 3"
))
(
is
(
equal
(
run/ss
"echo 1 2 3"
)
"1 2 3"
))
(
is
(
equal
(
run/ss
`
(
pipe
(
echo
(
+
hel
"lo,"
)
world
)
(
tr
"hw"
"HW"
)
(
sed
-e
"s/$/!/"
)))
"Hello, World!"
)))
(
deftest
test-inferior-shell
()
(
def-test
basics
()
(
do-test-inferior-shell
))
(
is
(
equal
"1 2 3"
(
run/ss
'
(
echo
(
1
)
"2"
(
+
3
)))))
(
is
(
equal
"1 2 3"
(
run/ss
"echo 1 2 3"
)))
(
is
(
equal
"Hello, World!"
(
run/ss
`
(
pipe
(
echo
(
+
hel
"lo,"
)
world
)
(
tr
"hw"
"HW"
)
(
sed
-e
"s/$/!/"
)))))
(
is
(
equal
"hello"
(
run/ss
`
(
pipe
(
echo
,
(
format
nil
"hello~%world"
))
(
grep
"h"
))))))
(
def-test
tokens
()
(
is
(
equal
"Hello"
(
run/ss
`
(
echo
"Hello"
))))
(
is
(
equal
"hello"
(
run/ss
`
(
echo
hello
))))
(
is
(
equal
"hello"
(
run/ss
`
(
echo
|Hello|
))))
(
is
(
equal
" hello "
(
run/ss
`
(
echo
| Hello |
))))
(
is
(
equal
"--hello"
(
run/ss
`
(
echo
:hello
)))))
(
def-test
+
()
(
is
(
equal
(
format
nil
"Hello world!"
)
(
run/ss
`
(
echo
(
+
"Hello "
world!
))))))
(
def-test
and
()
(
is
(
equal
(
format
nil
"hello~%world"
)
(
run/ss
`
(
and
(
echo
hello
)
(
echo
world
)
(
return
1
)
(
echo
good
morning
))
:on-error
nil
))))
(
def-test
or
()
(
is
(
equal
"hello"
(
run/ss
`
(
or
(
return
1
)
(
echo
hello
)
(
echo
world
))))))
#+
unix
(
def-test
fork
()
(
let
((
fifo
"/tmp/inferior-shell.fifo"
))
(
run/ss
`
(
rm
,
fifo
)
:on-error
nil
)
(
run/ss
`
(
mkfifo
,
fifo
))
(
run/ss
`
(
fork
(
echo
"hello"
(
>
,
fifo
))))
(
is
(
equal
"hello"
(
run/ss
`
(
cat
,
fifo
))))
(
run/ss
`
(
rm
,
fifo
)
:on-error
nil
)))
(
def-test
progn
()
(
is
(
equal
(
format
nil
"Hello world!~%good morning"
)
(
run/ss
`
(
progn
(
echo
(
+
"Hello "
world!
))
(
echo
'|Good|
morning
))))))
(
def-test
redirection
()
;; TODO Test all other redirection methods.
(
uiop:with-temporary-file
(
:pathname
file
)
(
run/ss
`
(
rm
,
file
)
:on-error
nil
)
(
run/ss
`
(
echo
"1234567890"
(
>>
,
file
)))
(
is
(
equal
"1234567890"
(
run/ss
`
(
cat
,
file
))))
(
run/ss
`
(
echo
"abcdefghij"
(
>
,
file
)))
(
is
(
equal
"abcdefghij"
(
run/ss
`
(
cat
,
file
))))
(
run/ss
`
(
rm
,
file
))))
(
run!
'inferior-shell-test::inferior-shell-test
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment