Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added Junit test to help fixing bug #7058 #508

Closed
wants to merge 1 commit into from

2 participants

@inger

As you can see from the Travis failure, the test case is exposing a StackOverflow as well as a NullPointerException - all via legal API calls IMHO.

@yokolet
Collaborator

Thanks for writing the test. These tests have been manually merged to BiVariableMapTest in JRuby. Just clicking on merge button didn't work.

I'm going to close this pull request.

@yokolet yokolet closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 23, 2013
  1. @inger
This page is out of date. Refresh to see the latest.
Showing with 41 additions and 0 deletions.
  1. +41 −0 src/org/jruby/embed/EmbedClearBug7058Test.java
View
41 src/org/jruby/embed/EmbedClearBug7058Test.java
@@ -0,0 +1,41 @@
+package org.jruby.embed;
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class EmbedClearBug7058Test {
+ private ScriptingContainer c;
+ @Before
+ public void setUp() {
+ c = new ScriptingContainer(LocalContextScope.THREADSAFE);
+ }
+ @Test
+ public void testDoesNotThrowNPEAfterClear_Bug7058() {
+ c.clear();
+ c.runScriptlet(""); // throws NPE
+ }
+ @Test
+ public void testClearReleasesGlobalVariable_EndlessLoopIn1_7_2() {
+ c.runScriptlet("$a = 1");
+ assertEquals(1L, c.getVarMap().get("$a"));
+ c.clear();
+ assertEquals(null, c.getVarMap().get("$a"));
+ }
+ @Test
+ public void testClearReleasesGlobalVariable_NPEIn1_7_2() {
+ c.runScriptlet("$a = 1");
+ assertEquals(1L, c.runScriptlet("$a"));
+ assertEquals(1L, c.getVarMap().get("$a"));
+ c.clear();
+ assertEquals(null, c.runScriptlet("$a"));
+ }
+ @Test
+ public void testClearReleasesGlobalVariable_FailsIn1_6_7_NPEIn1_7_2() {
+ c.runScriptlet("$a = 1");
+ assertEquals(1L, c.runScriptlet("$a"));
+ c.clear();
+ assertEquals(null, c.runScriptlet("$a"));
+ }
+
+}
Something went wrong with that request. Please try again.