Skip to content
This repository has been archived by the owner on Jan 30, 2019. It is now read-only.

Commit

Permalink
Cosmetics.
Browse files Browse the repository at this point in the history
  • Loading branch information
wavexx committed Aug 6, 2014
1 parent 3e8c78c commit 2889342
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
4 changes: 3 additions & 1 deletion bond/JavaScript/prelude.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function __PY_BOND_sendline(line)
}


/// Serialization methods
/// Our minimal exception signature
function __PY_BOND_SerializationException(message)
{
this.message = message;
Expand All @@ -48,6 +48,8 @@ function __PY_BOND_SerializationException(message)
util.inherits(__PY_BOND_SerializationException, TypeError);
__PY_BOND_SerializationException.prototype.name = "__PY_BOND_SerializationException";


/// Serialization methods
function __PY_BOND_typecheck(key, value)
{
if(typeof value === 'function' && value.toJSON == null)
Expand Down
2 changes: 1 addition & 1 deletion bond/PHP/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, cmd="php", args="-a", xargs="", cwd=None, env=os.environ,
except pexpect.ExceptionPexpect:
raise BondException(self.LANG, 'cannot get an interactive prompt using: ' + cmd)

# inject our prelude in blocks (due line discipline input buffer limit)
# inject our prelude in small chunks (due to the line discipline input buffer limit)
# TODO: this requires a better approach
code = pkg_resources.resource_string(__name__, PHP_PRELUDE)
chunks = re.split(PHP_EOL_RE, code)
Expand Down
4 changes: 2 additions & 2 deletions bond/Python/prelude.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def __PY_BOND_sendline(line=""):


# Serialization methods
__PY_BOND_PROTOCOL = None

class __PY_BOND_SerializationException(cPickle.PicklingError):
pass

__PY_BOND_PROTOCOL = None

def __PY_BOND_dumps(*args):
try:
ret = base64.b64encode(cPickle.dumps(args, __PY_BOND_PROTOCOL))
Expand Down
7 changes: 5 additions & 2 deletions test/test_PHP.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,14 @@ def test_output_redirect():
php = PHP(timeout=1);

# standard output
php.eval_block(r'echo "Hello world!\n";')
php.eval_block(r'echo "echo: Hello world!\n";')
php.eval_block(r'fwrite(STDOUT, "STDOUT: Hello world!\n");')
php.eval_block(r'file_put_contents("php://stdout", "php://stdout: Hello world!\n");')
assert(php.eval('1') == 1)

# standard error
php.eval_block(r'fwrite(STDERR, "Hello world!\n");')
php.eval_block(r'fwrite(STDERR, "STDERR: Hello world!\n");')
php.eval_block(r'file_put_contents("php://stderr", "php://stderr: Hello world!\n");')
assert(php.eval('1') == 1)


Expand Down
6 changes: 3 additions & 3 deletions test/test_Perl.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,15 @@ def test_output_redirect():
perl = Perl(timeout=1)

# stdout
perl.eval_block(r'print "Hello world!\n";')
perl.eval_block(r'print "stdout: Hello world!\n";')
assert(perl.eval('1') == 1)

# stderr
perl.eval_block(r'print STDERR "Hello world!\n"')
perl.eval_block(r'print STDERR "stderr: Hello world!\n"')
assert(perl.eval('1') == 1)

# warnings
perl.eval_block(r'use warnings; "$undefined";')
perl.eval_block(r'use warnings; "$warning_expected_on_stderr";')
assert(perl.eval('1') == 1)


Expand Down
4 changes: 2 additions & 2 deletions test/test_Python.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ def test_output_redirect():
py = Python(timeout=1)

# stdout
py.eval_block(r'print "Hello world!\n"')
py.eval_block(r'print "stdout: Hello world!"')
assert(py.eval('1') == 1)

# stderr
py.eval_block(r'import sys; sys.stderr.write("Hello world!\n");')
py.eval_block(r'import sys; sys.stderr.write("stderr: Hello world!\n");')
assert(py.eval('1') == 1)


Expand Down

0 comments on commit 2889342

Please sign in to comment.