Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fbc6f943
Commit
fbc6f943
authored
Feb 19, 2012
by
Jesus Cea
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for issue #13500
parent
c33ae06c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
Lib/test/test_cmd.py
Lib/test/test_cmd.py
+29
-0
No files found.
Lib/test/test_cmd.py
View file @
fbc6f943
...
...
@@ -180,6 +180,14 @@ class TestAlternateInput(unittest.TestCase):
def
do_EOF
(
self
,
args
):
return
True
class
simplecmd2
(
simplecmd
):
def
do_EOF
(
self
,
args
):
print
(
'*** Unknown syntax: EOF'
,
file
=
self
.
stdout
)
return
True
def
test_file_with_missing_final_nl
(
self
):
input
=
io
.
StringIO
(
"print test
\
n
print test2"
)
output
=
io
.
StringIO
()
...
...
@@ -192,6 +200,27 @@ class TestAlternateInput(unittest.TestCase):
"(Cmd) "
))
def
test_input_reset_at_EOF
(
self
):
input
=
io
.
StringIO
(
"print test
\
n
print test2"
)
output
=
io
.
StringIO
()
cmd
=
self
.
simplecmd2
(
stdin
=
input
,
stdout
=
output
)
cmd
.
use_rawinput
=
False
cmd
.
cmdloop
()
self
.
assertMultiLineEqual
(
output
.
getvalue
(),
(
"(Cmd) test
\
n
"
"(Cmd) test2
\
n
"
"(Cmd) *** Unknown syntax: EOF
\
n
"
))
input
=
io
.
StringIO
(
"print
\
n
\
n
"
)
output
=
io
.
StringIO
()
cmd
.
stdin
=
input
cmd
.
stdout
=
output
cmd
.
cmdloop
()
self
.
assertMultiLineEqual
(
output
.
getvalue
(),
(
"(Cmd)
\
n
"
"(Cmd)
\
n
"
"(Cmd) *** Unknown syntax: EOF
\
n
"
))
def
test_main
(
verbose
=
None
):
from
test
import
test_cmd
support
.
run_doctest
(
test_cmd
,
verbose
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment