From aff1f1bf6c83cd52311f5b14c6b0a7d77d87e86d Mon Sep 17 00:00:00 2001 From: James Iry Date: Mon, 18 Nov 2013 10:06:37 -0800 Subject: [PATCH] Move tests from partests to junit Parser combinator tests didn't need all the machinery of partest and it was just slowing them down. This commit converts all the partest tests into junit. The sbt project file is modified to get rid of all the partest cruft. --- build.sbt | 56 ---------- .../util/parsing/combinator/JsonTest.scala | 105 ++++++++++-------- .../util/parsing/combinator/UnitTestIO.scala | 32 ++++++ .../scala/util/parsing/combinator/t0700.scala | 28 +++++ .../scala/util/parsing/combinator/t1100.scala | 31 ++++++ .../scala/util/parsing/combinator/t4138.scala | 12 ++ .../scala/util/parsing/combinator/t4929.scala | 41 +++++++ .../scala/util/parsing/combinator/t5514.scala | 40 +++++++ test/files/run/json.check | 21 ---- test/files/run/t0700.check | 2 - test/files/run/t0700.scala | 24 ---- test/files/run/t1100.check | 4 - test/files/run/t1100.scala | 17 --- test/files/run/t4138.check | 2 - test/files/run/t4138.scala | 6 - test/files/run/t4929.check | 1 - test/files/run/t4929.scala | 43 ------- test/files/run/t5514.check | 19 ---- test/files/run/t5514.scala | 35 ------ test/files/run/unittest_io.scala | 42 ------- 20 files changed, 244 insertions(+), 317 deletions(-) rename test/files/run/json.scala => src/test/scala/scala/util/parsing/combinator/JsonTest.scala (76%) create mode 100644 src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala create mode 100644 src/test/scala/scala/util/parsing/combinator/t0700.scala create mode 100644 src/test/scala/scala/util/parsing/combinator/t1100.scala create mode 100644 src/test/scala/scala/util/parsing/combinator/t4138.scala create mode 100644 src/test/scala/scala/util/parsing/combinator/t4929.scala create mode 100644 src/test/scala/scala/util/parsing/combinator/t5514.scala delete mode 100644 test/files/run/json.check delete mode 100644 test/files/run/t0700.check delete mode 100644 test/files/run/t0700.scala delete mode 100644 test/files/run/t1100.check delete mode 100644 test/files/run/t1100.scala delete mode 100644 test/files/run/t4138.check delete mode 100644 test/files/run/t4138.scala delete mode 100644 test/files/run/t4929.check delete mode 100644 test/files/run/t4929.scala delete mode 100644 test/files/run/t5514.check delete mode 100644 test/files/run/t5514.scala delete mode 100644 test/files/run/unittest_io.scala diff --git a/build.sbt b/build.sbt index 3165ab97..9ff28686 100644 --- a/build.sbt +++ b/build.sbt @@ -83,62 +83,6 @@ pomExtra := ( libraryDependencies ++= Seq("junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test") -// default value must be set here -TestKeys.includeTestDependencies := true - -// default -TestKeys.partestVersion := "1.0.0-RC7" - -// the actual partest the interface calls into -- must be binary version close enough to ours -// so that it can link to the compiler/lib we're using (testing) -// NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?) -libraryDependencies ++= ( - if (TestKeys.includeTestDependencies.value) { - /** - * Exclude all transitive dependencies of partest that include scala-parser-combinators. - * This way we avoid having two (or more) versions of scala-parser-combinators on a classpath. - * See this comment which describes the same issue for scala-xml - * https://github.com/scala/scala-xml/pull/6#issuecomment-26614894 - * - * Note that we are using ModuleID.exclude instead of more flexible ModuleID.excludeAll - * (describe here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management#exclude-transitive-dependencies) - * because only plain excludes are incorporated in generated pom.xml. There are two ways - * to address this problem: - * - * 1. Figure out how to depend on partest in non-transitive way: not include that dependency - * in generated pom.xml for scala-parser-combinators. - * 2. Declare dependencies in partest as provided so they are not includeded transitively. - */ - def excludeScalaXml(dep: ModuleID): ModuleID = - (dep exclude("org.scala-lang.modules", "scala-parser-combinators_2.11.0-M4") - exclude("org.scala-lang.modules", "scala-parser-combinators_2.11.0-M5") - exclude("org.scala-lang.modules", "scala-parser-combinators_2.11.0-M6")) -// (this space intentionally not left blank) - Seq("org.scala-lang.modules" % s"scala-partest-interface_${scalaBinaryVersion.value}" % "0.2" % "test" intransitive, - "org.scala-lang.modules" % s"scala-partest_${scalaBinaryVersion.value}" % TestKeys.partestVersion.value % "test" intransitive, - "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0" % "test", // diffutils is needed by partest - "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").map(excludeScalaXml) - } - else Seq.empty -) - -fork in Test := true - -javaOptions in Test += "-Xmx1G" - -testFrameworks += new TestFramework("scala.tools.partest.Framework") - -definedTests in Test += ( - new sbt.TestDefinition( - "partest", - // marker fingerprint since there are no test classes - // to be discovered by sbt: - new sbt.testing.AnnotatedFingerprint { - def isModule = true - def annotationName = "partest" - }, true, Array()) - ) - osgiSettings val osgiVersion = version(_.replace('-', '.')) diff --git a/test/files/run/json.scala b/src/test/scala/scala/util/parsing/combinator/JsonTest.scala similarity index 76% rename from test/files/run/json.scala rename to src/test/scala/scala/util/parsing/combinator/JsonTest.scala index 36e86ac5..cb24a334 100644 --- a/test/files/run/json.scala +++ b/src/test/scala/scala/util/parsing/combinator/JsonTest.scala @@ -1,11 +1,10 @@ -/* - * filter: inliner warning\(s\); re-run with -Yinline-warnings for details - */ import scala.util.parsing.json._ import scala.collection.immutable.TreeMap -@deprecated("Suppress warnings", since="2.11") -object Test extends App { +import org.junit.Test +import org.junit.Assert.{assertEquals, assertTrue} + +class JsonTest { /* This method converts parsed JSON back into real JSON notation with objects in * sorted-key order. Not required by the spec, but it allows us to do a stable * toString comparison. */ @@ -32,12 +31,8 @@ object Test extends App { } // For this one, just parsing should be considered a pass - def printJSON(given : String) { - JSON parseRaw given match { - case None => println("Parse failed for \"%s\"".format(given)) - case Some(parsed) => println("Passed parse : " + sortJSON(parsed)) - } - } + def printJSON(given : String) : Unit = + assertTrue("Parse failed for \"%s\"".format(given), (JSON parseRaw given).isDefined) // For this usage, do a raw parse (to JSONObject/JSONArray) def printJSON(given : String, expected : JSONType) { @@ -52,18 +47,16 @@ object Test extends App { // For this usage, do configurable parsing so that you can do raw if desired def printJSON[T](given : String, parser : String => T, expected : Any) { parser(given) match { - case None => println("Parse failed for \"%s\"".format(given)) - case Some(parsed) => if (parsed == expected) { - println("Passed compare: " + parsed) - } else { + case None => assertTrue("Parse failed for \"%s\"".format(given), false) + case Some(parsed) => if (parsed != expected) { val eStr = sortJSON(expected).toString val pStr = sortJSON(parsed).toString - stringDiff(eStr,pStr) + assertTrue(stringDiff(eStr,pStr), false) } } } - def stringDiff (expected : String, actual : String) { + def stringDiff (expected : String, actual : String): String = { if (expected != actual) { // Figure out where the Strings differ and generate a marker val mismatchPosition = expected.toList.zip(actual.toList).indexWhere({case (x,y) => x != y}) match { @@ -71,57 +64,77 @@ object Test extends App { case x => x } val reason = (" " * mismatchPosition) + "^" - println("Expected: %s\nGot : %s \n %s".format(expected, actual, reason)) + "Expected: %s\nGot : %s \n %s".format(expected, actual, reason) } else { - println("Passed compare: " + actual) + "Passed compare: " + actual } } - // The library should differentiate between lower case "l" and number "1" (ticket #136) - printJSON("{\"name\" : \"value\"}", JSONObject(Map("name" -> "value"))) - printJSON("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue"))) - printJSON("{\"name\" : { \"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\" } }", - JSONObject(Map("name" -> JSONObject(Map("name1" -> "va1ue1", "name2" -> "va1ue2"))))) + @Test + def testEllVsOne: Unit = { + printJSON("{\"name\" : \"value\"}", JSONObject(Map("name" -> "value"))) + printJSON("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue"))) + printJSON("{\"name\" : { \"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\" } }", + JSONObject(Map("name" -> JSONObject(Map("name1" -> "va1ue1", "name2" -> "va1ue2"))))) + } // Unicode escapes should be handled properly - printJSON("{\"name\" : \"\\u0022\"}") + @Test + def testEscapes: Unit = + printJSON("{\"name\" : \"\\u0022\"}") // The library should return a map for JSON objects (ticket #873) - printJSONFull("{\"function\" : \"add_symbol\"}", Map("function" -> "add_symbol")) + @Test + def testMap: Unit = + printJSONFull("{\"function\" : \"add_symbol\"}", Map("function" -> "add_symbol")) // The library should recurse into arrays to find objects (ticket #2207) - printJSON("[{\"a\" : \"team\"},{\"b\" : 52}]", JSONArray(List(JSONObject(Map("a" -> "team")), JSONObject(Map("b" -> 52.0))))) + @Test + def testObjectsInArrays: Unit = + printJSON("[{\"a\" : \"team\"},{\"b\" : 52}]", JSONArray(List(JSONObject(Map("a" -> "team")), JSONObject(Map("b" -> 52.0))))) + // The library should differentiate between empty maps and lists (ticket #3284) - printJSONFull("{}", Map()) - printJSONFull("[]", List()) + @Test + def testEmptyMapsVsLists: Unit = { + printJSONFull("{}", Map()) + printJSONFull("[]", List()) + } // Lists should be returned in the same order as specified - printJSON("[4,1,3,2,6,5,8,7]", JSONArray(List[Double](4,1,3,2,6,5,8,7))) + @Test + def testListOrder: Unit = + printJSON("[4,1,3,2,6,5,8,7]", JSONArray(List[Double](4,1,3,2,6,5,8,7))) // Additional tests + @Test + def testAdditional: Unit = printJSON("{\"age\": 0}") // The library should do a proper toString representation using default and custom renderers (ticket #3605) - stringDiff("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue")).toString) - stringDiff("{\"name\" : {\"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\"}}", - JSONObject(Map("name" -> JSONObject(TreeMap("name1" -> "va1ue1", "name2" -> "va1ue2")))).toString) + @Test + def testDefaultAndCustomRenderers: Unit = { + assertEquals("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue")).toString()) + assertEquals("{\"name\" : {\"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\"}}", + JSONObject(Map("name" -> JSONObject(TreeMap("name1" -> "va1ue1", "name2" -> "va1ue2")))).toString()) - stringDiff("[4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]", JSONArray(List[Double](4,1,3,2,6,5,8,7)).toString) + assertEquals("[4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]", JSONArray(List[Double](4,1,3,2,6,5,8,7)).toString()) + } // A test method that escapes all characters in strings def escapeEverything (in : Any) : String = in match { case s : String => "\"" + s.map(c => "\\u%04x".format(c : Int)).mkString + "\"" - case jo : JSONObject => jo.toString(escapeEverything) - case ja : JSONArray => ja.toString(escapeEverything) + case jo : JSONObject => jo.toString(escapeEverything _) + case ja : JSONArray => ja.toString(escapeEverything _) case other => other.toString } - stringDiff("{\"\\u006e\\u0061\\u006d\\u0065\" : \"\\u0076\\u0061\\u006c\"}", JSONObject(Map("name" -> "val")).toString(escapeEverything)) + @Test + def testEscapeEverything: Unit = + assertEquals("{\"\\u006e\\u0061\\u006d\\u0065\" : \"\\u0076\\u0061\\u006c\"}", JSONObject(Map("name" -> "val")).toString(escapeEverything _)) - println // from http://en.wikipedia.org/wiki/JSON val sample1 = """ @@ -156,9 +169,9 @@ object Test extends App { ) ) - - printJSONFull(sample1, sample1Obj) - println + @Test + def testSample1: Unit = + printJSONFull(sample1, sample1Obj) // from http://www.developer.com/lang/jscript/article.php/3596836 val sample2 = """ @@ -186,8 +199,9 @@ object Test extends App { ] }""" - printJSON(sample2) - println + @Test + def testSampl2: Unit = + printJSON(sample2) // from http://json.org/example.html val sample3 = """ @@ -282,6 +296,7 @@ object Test extends App { } }""" - printJSON(sample3) - println + @Test + def testSample3 = + printJSON(sample3) } diff --git a/src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala b/src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala new file mode 100644 index 00000000..ffb6398e --- /dev/null +++ b/src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala @@ -0,0 +1,32 @@ +import org.junit.Test +import org.junit.Assert.assertEquals + +class UnitTestIO { + + @Test + def testUTF8 { + def decode(ch: Int) = new String(Array(ch), 0, 1).getBytes("UTF-8") + + assert(new String( decode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char]))) + assert(new String( decode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char]))) + assert(new String( decode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char]))) + assert(new String(decode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char], + 0xDF02.asInstanceOf[Char]))) + // a client + val test = "{\"a\":\"\\u0022\"}" + val expected = "a" -> "\"" + + val parsed = scala.util.parsing.json.JSON.parseFull(test) + val result = parsed == Some(Map(expected)) + assertEquals(Some(Map(expected)), parsed) + } + + @Test + def testSource { + val s = "Here is a test string" + val f = io.Source.fromBytes(s.getBytes("utf-8")) + val b = new collection.mutable.ArrayBuffer[Char]() + f.copyToBuffer(b) + assertEquals(new String(b.toArray), s) + } +} \ No newline at end of file diff --git a/src/test/scala/scala/util/parsing/combinator/t0700.scala b/src/test/scala/scala/util/parsing/combinator/t0700.scala new file mode 100644 index 00000000..97fe69ff --- /dev/null +++ b/src/test/scala/scala/util/parsing/combinator/t0700.scala @@ -0,0 +1,28 @@ +import java.io.{File,StringReader} + +import scala.util.parsing.combinator.Parsers +import scala.util.parsing.input.{CharArrayReader, StreamReader} + +import org.junit.Test +import org.junit.Assert.assertEquals + +class T0700 { + class TestParsers extends Parsers { + type Elem = Char + + def p: Parser[List[Int]] = rep(p1 | p2) + def p1: Parser[Int] = 'a' ~ nl ~ 'b' ~ nl ^^^ 1 + def p2: Parser[Int] = 'a' ~ nl ^^^ 2 + def nl: Parser[Int] = rep(accept('\n') | accept('\r')) ^^^ 0 + } + + @Test + def test: Unit = { + val tstParsers = new TestParsers + val s = "a\na\na" + val r1 = new CharArrayReader(s.toCharArray()) + val r2 = StreamReader(new StringReader(s)) + assertEquals("[3.2] parsed: List(2, 2, 2)", tstParsers.p(r1).toString) + assertEquals("[3.2] parsed: List(2, 2, 2)", tstParsers.p(r2).toString) + } +} \ No newline at end of file diff --git a/src/test/scala/scala/util/parsing/combinator/t1100.scala b/src/test/scala/scala/util/parsing/combinator/t1100.scala new file mode 100644 index 00000000..fd26389e --- /dev/null +++ b/src/test/scala/scala/util/parsing/combinator/t1100.scala @@ -0,0 +1,31 @@ +import scala.util.parsing.combinator.Parsers +import scala.util.parsing.input.CharSequenceReader + +import java.io.{File,StringReader} + +import scala.util.parsing.combinator.Parsers +import scala.util.parsing.input.{CharArrayReader, StreamReader} + +import org.junit.Test +import org.junit.Assert.assertEquals + +class T1100 { + class TestParsers extends Parsers { + type Elem = Char + + def p: Parser[List[Char]] = rep1(p1) + def p1: Parser[Char] = accept('a') | err("errors are propagated") + } + +val expected = """[1.4] error: errors are propagated + +aaab + ^""" + + @Test + def test(): Unit = { + val tstParsers = new TestParsers + val s = new CharSequenceReader("aaab") + assertEquals(expected, tstParsers.p(s).toString) + } +} diff --git a/src/test/scala/scala/util/parsing/combinator/t4138.scala b/src/test/scala/scala/util/parsing/combinator/t4138.scala new file mode 100644 index 00000000..87f8fde8 --- /dev/null +++ b/src/test/scala/scala/util/parsing/combinator/t4138.scala @@ -0,0 +1,12 @@ +import org.junit.Test +import org.junit.Assert.assertEquals + +class T4138 { + object p extends scala.util.parsing.combinator.JavaTokenParsers + + @Test + def test: Unit = { + assertEquals("""[1.45] parsed: "lir 'de\' ' \\ \n / upa \"new\" \t parsing"""", p.parse(p.stringLiteral, """"lir 'de\' ' \\ \n / upa \"new\" \t parsing"""").toString) + assertEquals("""[1.5] parsed: "s """", p.parse(p.stringLiteral, """"s " lkjse"""").toString) + } +} diff --git a/src/test/scala/scala/util/parsing/combinator/t4929.scala b/src/test/scala/scala/util/parsing/combinator/t4929.scala new file mode 100644 index 00000000..945bb283 --- /dev/null +++ b/src/test/scala/scala/util/parsing/combinator/t4929.scala @@ -0,0 +1,41 @@ +import scala.util.parsing.json._ +import java.util.concurrent._ +import collection.JavaConversions._ + +import org.junit.Test + +class t4929 { + + val LIMIT = 2000 + val THREAD_COUNT = 20 + val count = new java.util.concurrent.atomic.AtomicInteger(0) + + val begin = new CountDownLatch(THREAD_COUNT) + val finish = new CountDownLatch(THREAD_COUNT) + + val errors = new ConcurrentLinkedQueue[Throwable] + + @Test + def test: Unit = { + (1 to THREAD_COUNT) foreach { i => + val thread = new Thread { + override def run() { + begin.await(1, TimeUnit.SECONDS) + try { + while (count.getAndIncrement() < LIMIT && errors.isEmpty) { + JSON.parseFull("""{"foo": [1,2,3,4]}""") + } + } catch { + case t: Throwable => errors.add(t) + } + + finish.await(10, TimeUnit.SECONDS) + } + } + + thread.setDaemon(true) + thread.start() + } + errors foreach { throw(_) } + } +} diff --git a/src/test/scala/scala/util/parsing/combinator/t5514.scala b/src/test/scala/scala/util/parsing/combinator/t5514.scala new file mode 100644 index 00000000..5f649839 --- /dev/null +++ b/src/test/scala/scala/util/parsing/combinator/t5514.scala @@ -0,0 +1,40 @@ +import scala.io.Source +import scala.util.parsing.combinator.Parsers +import scala.util.parsing.input.Reader +import scala.util.parsing.input.Position + +import org.junit.Test +import org.junit.Assert.assertEquals + +class T5514 extends Parsers { + var readerCount = 0 + class DemoReader(n: Int) extends Reader[String] { + def atEnd = n == 0 + def first = if (n >= 0) "s" + n else throw new IllegalArgumentException("No more input.") + def rest = new DemoReader(n - 1) + def pos = new Position { + def line = 0 + def column = 0 + def lineContents = first + } + readerCount += 1 + } + + + type Elem = String + def startsWith(prefix: String) = acceptIf(_ startsWith prefix)("Error: " + _) + + @Test + def test: Unit = { + val resrep = startsWith("s").*(new DemoReader(10)) + assertEquals("[0.0] parsed: List(s10, s9, s8, s7, s6, s5, s4, s3, s2, s1)", resrep.toString) + assertEquals(11, readerCount) + + readerCount = 0 + val resrep5 = repN(5, startsWith("s"))(new DemoReader(10)) + assertEquals("[0.0] parsed: List(s10, s9, s8, s7, s6)", resrep5.toString) + assertEquals(6, readerCount) + } +} + + diff --git a/test/files/run/json.check b/test/files/run/json.check deleted file mode 100644 index d4d2b416..00000000 --- a/test/files/run/json.check +++ /dev/null @@ -1,21 +0,0 @@ -Passed compare: {"name" : "value"} -Passed compare: {"name" : "va1ue"} -Passed compare: {"name" : {"name1" : "va1ue1", "name2" : "va1ue2"}} -Passed parse : {"name" : "\""} -Passed compare: Map(function -> add_symbol) -Passed compare: [{"a" : "team"}, {"b" : 52.0}] -Passed compare: Map() -Passed compare: List() -Passed compare: [4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0] -Passed parse : {"age" : 0.0} -Passed compare: {"name" : "va1ue"} -Passed compare: {"name" : {"name1" : "va1ue1", "name2" : "va1ue2"}} -Passed compare: [4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0] -Passed compare: {"\u006e\u0061\u006d\u0065" : "\u0076\u0061\u006c"} - -Passed compare: Map(firstName -> John, lastName -> Smith, address -> Map(streetAddress -> 21 2nd Street, city -> New York, state -> NY, postalCode -> 10021.0), phoneNumbers -> List(212 732-1234, 646 123-4567)) - -Passed parse : {"addresses" : [{"format" : "us", "type" : "work", "value" : "1234 Main StnSpringfield, TX 78080-1216"}, {"format" : "us", "type" : "home", "value" : "5678 Main StnSpringfield, TX 78080-1316"}], "emailaddrs" : [{"type" : "work", "value" : "kelly@seankelly.biz"}, {"pref" : 1.0, "type" : "home", "value" : "kelly@seankelly.tv"}], "fullname" : "Sean Kelly", "org" : "SK Consulting", "telephones" : [{"pref" : 1.0, "type" : "work", "value" : "+1 214 555 1212"}, {"type" : "fax", "value" : "+1 214 555 1213"}, {"type" : "mobile", "value" : "+1 214 555 1214"}], "urls" : [{"type" : "work", "value" : "http:\/\/seankelly.biz\/"}, {"type" : "home", "value" : "http:\/\/seankelly.tv\/"}]} - -Passed parse : {"web-app" : {"servlet" : [{"init-param" : {"cachePackageTagsRefresh" : 60.0, "cachePackageTagsStore" : 200.0, "cachePackageTagsTrack" : 200.0, "cachePagesDirtyRead" : 10.0, "cachePagesRefresh" : 10.0, "cachePagesStore" : 100.0, "cachePagesTrack" : 200.0, "cacheTemplatesRefresh" : 15.0, "cacheTemplatesStore" : 50.0, "cacheTemplatesTrack" : 100.0, "configGlossary:adminEmail" : "ksm@pobox.com", "configGlossary:installationAt" : "Philadelphia, PA", "configGlossary:poweredBy" : "Cofax", "configGlossary:poweredByIcon" : "\/images\/cofax.gif", "configGlossary:staticPath" : "\/content\/static", "dataStoreClass" : "org.cofax.SqlDataStore", "dataStoreConnUsageLimit" : 100.0, "dataStoreDriver" : "com.microsoft.jdbc.sqlserver.SQLServerDriver", "dataStoreInitConns" : 10.0, "dataStoreLogFile" : "\/usr\/local\/tomcat\/logs\/datastore.log", "dataStoreLogLevel" : "debug", "dataStoreMaxConns" : 100.0, "dataStoreName" : "cofax", "dataStorePassword" : "dataStoreTestQuery", "dataStoreTestQuery" : "SET NOCOUNT ON;select test='test';", "dataStoreUrl" : "jdbc:microsoft:sqlserver:\/\/LOCALHOST:1433;DatabaseName=goon", "dataStoreUser" : "sa", "defaultFileTemplate" : "articleTemplate.htm", "defaultListTemplate" : "listTemplate.htm", "jspFileTemplate" : "articleTemplate.jsp", "jspListTemplate" : "listTemplate.jsp", "maxUrlLength" : 500.0, "redirectionClass" : "org.cofax.SqlRedirection", "searchEngineFileTemplate" : "forSearchEngines.htm", "searchEngineListTemplate" : "forSearchEnginesList.htm", "searchEngineRobotsDb" : "WEB-INF\/robots.db", "templateLoaderClass" : "org.cofax.FilesTemplateLoader", "templateOverridePath" : "", "templatePath" : "templates", "templateProcessorClass" : "org.cofax.WysiwygTemplate", "useDataStore" : true, "useJSP" : false}, "servlet-class" : "org.cofax.cds.CDSServlet", "servlet-name" : "cofaxCDS"}, {"init-param" : {"mailHost" : "mail1", "mailHostOverride" : "mail2"}, "servlet-class" : "org.cofax.cds.EmailServlet", "servlet-name" : "cofaxEmail"}, {"servlet-class" : "org.cofax.cds.AdminServlet", "servlet-name" : "cofaxAdmin"}, {"servlet-class" : "org.cofax.cds.FileServlet", "servlet-name" : "fileServlet"}, {"init-param" : {"adminGroupID" : 4.0, "betaServer" : true, "dataLog" : 1.0, "dataLogLocation" : "\/usr\/local\/tomcat\/logs\/dataLog.log", "dataLogMaxSize" : "", "fileTransferFolder" : "\/usr\/local\/tomcat\/webapps\/content\/fileTransferFolder", "log" : 1.0, "logLocation" : "\/usr\/local\/tomcat\/logs\/CofaxTools.log", "logMaxSize" : "", "lookInContext" : 1.0, "removePageCache" : "\/content\/admin\/remove?cache=pages&id=", "removeTemplateCache" : "\/content\/admin\/remove?cache=templates&id=", "templatePath" : "toolstemplates\/"}, "servlet-class" : "org.cofax.cms.CofaxToolsServlet", "servlet-name" : "cofaxTools"}], "servlet-mapping" : {"cofaxAdmin" : "\/admin\/*", "cofaxCDS" : "\/", "cofaxEmail" : "\/cofaxutil\/aemail\/*", "cofaxTools" : "\/tools\/*", "fileServlet" : "\/static\/*"}, "taglib" : {"taglib-location" : "\/WEB-INF\/tlds\/cofax.tld", "taglib-uri" : "cofax.tld"}}} - diff --git a/test/files/run/t0700.check b/test/files/run/t0700.check deleted file mode 100644 index b4eabbab..00000000 --- a/test/files/run/t0700.check +++ /dev/null @@ -1,2 +0,0 @@ -[3.2] parsed: List(2, 2, 2) -[3.2] parsed: List(2, 2, 2) diff --git a/test/files/run/t0700.scala b/test/files/run/t0700.scala deleted file mode 100644 index 5a718052..00000000 --- a/test/files/run/t0700.scala +++ /dev/null @@ -1,24 +0,0 @@ -import java.io.{File,StringReader} - -import scala.util.parsing.combinator.Parsers -import scala.util.parsing.input.{CharArrayReader, StreamReader} - -class TestParsers extends Parsers { - type Elem = Char - - def p: Parser[List[Int]] = rep(p1 | p2) - def p1: Parser[Int] = 'a' ~ nl ~ 'b' ~ nl ^^^ 1 - def p2: Parser[Int] = 'a' ~ nl ^^^ 2 - def nl: Parser[Int] = rep(accept('\n') | accept('\r')) ^^^ 0 -} - -object Test { - def main(args: Array[String]): Unit = { - val tstParsers = new TestParsers - val s = "a\na\na" - val r1 = new CharArrayReader(s.toCharArray()) - val r2 = StreamReader(new StringReader(s)) - println(tstParsers.p(r1)) - println(tstParsers.p(r2)) - } -} diff --git a/test/files/run/t1100.check b/test/files/run/t1100.check deleted file mode 100644 index d3a49a47..00000000 --- a/test/files/run/t1100.check +++ /dev/null @@ -1,4 +0,0 @@ -[1.4] error: errors are propagated - -aaab - ^ diff --git a/test/files/run/t1100.scala b/test/files/run/t1100.scala deleted file mode 100644 index 6b95fd6e..00000000 --- a/test/files/run/t1100.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.util.parsing.combinator.Parsers -import scala.util.parsing.input.CharSequenceReader - -class TestParsers extends Parsers { - type Elem = Char - - def p: Parser[List[Char]] = rep1(p1) - def p1: Parser[Char] = accept('a') | err("errors are propagated") -} - -object Test { - def main(args: Array[String]): Unit = { - val tstParsers = new TestParsers - val s = new CharSequenceReader("aaab") - println(tstParsers.p(s)) - } -} diff --git a/test/files/run/t4138.check b/test/files/run/t4138.check deleted file mode 100644 index f561b5e6..00000000 --- a/test/files/run/t4138.check +++ /dev/null @@ -1,2 +0,0 @@ -[1.45] parsed: "lir 'de\' ' \\ \n / upa \"new\" \t parsing" -[1.5] parsed: "s " diff --git a/test/files/run/t4138.scala b/test/files/run/t4138.scala deleted file mode 100644 index 131489e5..00000000 --- a/test/files/run/t4138.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test extends App { - object p extends scala.util.parsing.combinator.JavaTokenParsers - - println(p.parse(p.stringLiteral, """"lir 'de\' ' \\ \n / upa \"new\" \t parsing"""")) - println(p.parse(p.stringLiteral, """"s " lkjse"""")) -} diff --git a/test/files/run/t4929.check b/test/files/run/t4929.check deleted file mode 100644 index 0f0c913d..00000000 --- a/test/files/run/t4929.check +++ /dev/null @@ -1 +0,0 @@ -success \ No newline at end of file diff --git a/test/files/run/t4929.scala b/test/files/run/t4929.scala deleted file mode 100644 index 1b0e8672..00000000 --- a/test/files/run/t4929.scala +++ /dev/null @@ -1,43 +0,0 @@ -import scala.util.parsing.json._ -import java.util.concurrent._ -import collection.JavaConversions._ - -@deprecated("Suppress warnings", since="2.11") -object Test extends App { - - val LIMIT = 2000 - val THREAD_COUNT = 20 - val count = new java.util.concurrent.atomic.AtomicInteger(0) - - val begin = new CountDownLatch(THREAD_COUNT) - val finish = new CountDownLatch(THREAD_COUNT) - - val errors = new ConcurrentLinkedQueue[Throwable] - - (1 to THREAD_COUNT) foreach { i => - val thread = new Thread { - override def run() { - begin.await(1, TimeUnit.SECONDS) - try { - while (count.getAndIncrement() < LIMIT && errors.isEmpty) { - JSON.parseFull("""{"foo": [1,2,3,4]}""") - } - } catch { - case t: Throwable => errors.add(t) - } - - finish.await(10, TimeUnit.SECONDS) - } - } - - thread.setDaemon(true) - thread.start() - - } - - - errors foreach { throw(_) } - - println("success") - -} diff --git a/test/files/run/t5514.check b/test/files/run/t5514.check deleted file mode 100644 index c68f7c90..00000000 --- a/test/files/run/t5514.check +++ /dev/null @@ -1,19 +0,0 @@ -constructed reader: 10 -constructed reader: 9 -constructed reader: 8 -constructed reader: 7 -constructed reader: 6 -constructed reader: 5 -constructed reader: 4 -constructed reader: 3 -constructed reader: 2 -constructed reader: 1 -constructed reader: 0 -[0.0] parsed: List(s10, s9, s8, s7, s6, s5, s4, s3, s2, s1) -constructed reader: 10 -constructed reader: 9 -constructed reader: 8 -constructed reader: 7 -constructed reader: 6 -constructed reader: 5 -[0.0] parsed: List(s10, s9, s8, s7, s6) \ No newline at end of file diff --git a/test/files/run/t5514.scala b/test/files/run/t5514.scala deleted file mode 100644 index efd5ba6c..00000000 --- a/test/files/run/t5514.scala +++ /dev/null @@ -1,35 +0,0 @@ - - - -import scala.io.Source -import scala.util.parsing.combinator.Parsers -import scala.util.parsing.input.Reader -import scala.util.parsing.input.Position - - - -class DemoReader(n: Int) extends Reader[String] { - def atEnd = n == 0 - def first = if (n >= 0) "s" + n else throw new IllegalArgumentException("No more input.") - def rest = new DemoReader(n - 1) - def pos = new Position { - def line = 0 - def column = 0 - def lineContents = first - } - println("constructed reader: " + n) -} - - -object Test extends App with Parsers { - type Elem = String - def startsWith(prefix: String) = acceptIf(_ startsWith prefix)("Error: " + _) - - val resrep = startsWith("s").*(new DemoReader(10)) - Console println resrep - - val resrep5 = repN(5, startsWith("s"))(new DemoReader(10)) - Console println resrep5 -} - - diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala deleted file mode 100644 index 2c3dacdf..00000000 --- a/test/files/run/unittest_io.scala +++ /dev/null @@ -1,42 +0,0 @@ - -@deprecated("Suppress warnings", since="2.11") -object Test { - - def main(args: Array[String]) { - UTF8Tests.run() - SourceTest.run() - } - - object UTF8Tests { - def decode(ch: Int) = new String(Array(ch), 0, 1).getBytes("UTF-8") - - def run() { - assert(new String( decode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char]))) - assert(new String( decode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char]))) - assert(new String( decode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char]))) - assert(new String(decode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char], - 0xDF02.asInstanceOf[Char]))) - // a client - val test = "{\"a\":\"\\u0022\"}" - val expected = "a" -> "\"" - - val parsed = scala.util.parsing.json.JSON.parseFull(test) - val result = parsed == Some(Map(expected)) - if(result) - assert(result) - else { - Console.println(parsed); assert(result) - } - } - } - - object SourceTest { - def run() { - val s = "Here is a test string" - val f = io.Source.fromBytes(s.getBytes("utf-8")) - val b = new collection.mutable.ArrayBuffer[Char]() - f.copyToBuffer(b) - assert(s == new String(b.toArray)) - } - } -}