Skip to content

Instantly share code, notes, and snippets.

View chrisseaton's full-sized avatar

Chris Seaton chrisseaton

View GitHub Profile
# Port of deltablue.py, as documented below, to Ruby.
# Stefan Marr, 2014-04-28
#
# Was: deltablue.py
# =================
#
# Ported for the PyPy project.
# Contributed by Daniel Lindsley
#
# This implementation of the DeltaBlue benchmark was directly ported
// Copyright © 2004-2013 Brent Fulgham
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
a = 'foo<script src="jquery-2.1.1.js"></script>bar'
b = '<script src="jquery-2.1.1.js"></script>'
c = "Bootstrap\\'s JavaScript requires jQuery"
a.gsub(b, c) => "fooBootstrapbars JavaScript requires jQuerybar"
a.gsub(Regexp.quote(b), c) => "foo<script src=\"jquery-2.1.1.js\"></script>bar"
a.gsub(Regexp.quote(b), Regexp.quote(c)) => "foo<script src=\"jquery-2.1.1.js\"></script>bar"
a.gsub(b, Regexp.quote(c)) => "fooBootstrap\\'s\\ JavaScript\\ requires\\ jQuerybar"
I want:
a.replace(b, c) => 'fooBootstrap\\'s JavaScript requires jQuery</script>bar'
[exec] PANIC
[exec] java.lang.AssertionError
[exec] at BasicObject#instance_eval
[exec] method = BasicObject#instance_eval(core):core: BasicObject#instance_eval
[exec] declaring module = BasicObject
[exec] declaration frame:
[exec] self = #<Object:0x94>
[exec] block = org.jruby.truffle.runtime.core.RubyProc@dffa7ce
[exec] arguments:
[exec] frame:
module MS3
module ModA
end
class A
class << self
include ModA
end
end
end
module A
X = 14
module B
def self.foo
puts X
end
end
end
SyntaxError: /Users/chrisseaton/Documents/oracle/jruby/maven/pom.rb:56: syntax error, unexpected end-of-file
end
^
eval at org/jruby/RubyKernel.java:1101
eval_pom at file:/Users/chrisseaton/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-maven-3.1.1.0.8/ext/ruby/tesla-polyglot-ruby-0.1.1.jar!/maven/tools/dsl.rb:51
parse at parser.rb:74
ruby spec/mspec/bin/mspec tag -t bin/jruby -T -X+T -V --del fails --pass --config spec/truffle/truffle.mspec spec/ruby/language/class_spec.rb
chrisseaton@Chriss-MacBook-Pro:~/Documents/oracle/jruby [master!] $ bin/jruby -e 'puts 14'
chrisseaton@Chriss-MacBook-Pro:~/Documents/oracle/jruby [master!] $
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000104beeaef, pid=19070, tid=21251
#
# JRE version: OpenJDK Runtime Environment (8.0-b128) (build 1.8.0-internal-b128)
# Java VM: OpenJDK 64-Bit Server VM (25.0-b63-internal-graal-0.3 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V [libjvm.dylib+0x3eeaef]
#