summaryrefslogtreecommitdiff
path: root/test/junit
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3218 from som-snytt/issue/8027-repl-dbltabJason Zaugg2013-12-121-0/+52
|\ | | | | SI-8027 REPL double tab regression
| * SI-8027 REPL double tab regressionSom Snytt2013-12-031-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where did double tab go? "The shadow knows." The regression was introduced by the last flurry before we were left to wallow in whatever white space remained. Some xs put other xs under erasure. It's clear that somebody's daughter walked into the room and asked for a story, because, shockingly, the case arrows don't line up. We need a plug-in for Jenkins, or I guess Travis, to fail the build if arrows and equals don't align, because it clearly indicates a lapse of some kind.
* | add method dequeueOption to immutable.QueueThomas Geier2013-12-051-0/+28
| | | | | | | | | | | | This allows immutable.Queue to be used conveniently in functional code. Method is in the spirit of `headOption` on seqs or `get` on maps. Also adds a unit test for immutable.Queue.
* | Fixes SI-8014, regression in Vector ++ TraversableOnce.Rex Kerr2013-12-021-0/+51
|/ | | | | Now uses the cached copy instead of the exhausted iterator. Adds a JUnit test for ++.
* SI-8022 Backwards compatibility for Regex#unapplySeqJason Zaugg2013-12-011-0/+30
| | | | | | | | | | | | | | | The change in ce1bbfe / SI-6406 introduced overloads of `unapplySeq` with wider static and dynmaic result types than the now-deprecated alternative that accepted `Any`. This is subtly source incompatible and the change was noticed in Specs2. This commit uses `List` as the static and runtime type for the new overloads. For consistency, the same is done for the new method added in SI-7737 / 93e9623.
* Merge pull request #3147 from som-snytt/issue/repl-columnsAdriaan Moors2013-11-251-0/+85
|\ | | | | SI-7969 REPL -C columnar output
| * SI-7969 REPL variable columnar outputSom Snytt2013-11-181-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend column formatting to make columns only as wide as their widest element. This is similar to what `ls` does. Given the longest and shortest string, which bound the min and max column count, compute the layout for those possible column counts, and choose the minimal row count and minimal column count. The junit test is under pending because it uses expecty. (Edit: updated without expectytations.) Example that really benefits, witness the skinny columns: ``` scala> math. BigDecimal PartiallyOrdered cosh rint BigInt Pi exp round E ScalaNumber expm1 signum Equiv ScalaNumericAnyConversions floor sin Fractional ScalaNumericConversions hypot sinh IEEEremainder abs log sqrt Integral acos log10 tan LowPriorityEquiv asin log1p tanh LowPriorityOrderingImplicits atan max toDegrees Numeric atan2 min toRadians Ordered cbrt package ulp Ordering ceil pow PartialOrdering cos random ``` more
| * SI-7969 Refactor to trait with testSom Snytt2013-11-151-0/+41
| | | | | | | | Make REPL classes testable in junit. Test the Tabulator.
* | refactor out fresh name prefix extraction logicDen Shabalin2013-11-171-0/+47
|/ | | | | | | | | | | 1. refactor out FreshNameExtractor out of Quasiquotes cake into SymbolTable (can’t put it outside due to the fact that names are path-dependent) 2. add optional parameter to the fresh name creator to cover additional qq$ prefix needed for quasiquotes 3. add unit tests
* SI-7568 Adding PriorityQueueTestrjfwhite2013-11-111-0/+32
|
* Merge pull request #3006 from ivmaykov/masterAdriaan Moors2013-10-241-0/+49
|\ | | | | SI-7883 - don't iterate over all keys in MapWrapper.containsKey()
| * SI-7883 - don't iterate over all keys in MapWrapper.containsKey()Ilya Maykov2013-10-011-0/+49
| |
* | re-wire fresh name creator to currentUnit.fresh at compile-timeDen Shabalin2013-10-181-0/+2
| |
* | Rework cff8b569 to heal the windows build.Jason Zaugg2013-10-031-4/+4
|/ | | | | | | | | - change newTermName to fix negative length names rather than reject them - restore the old logic in unspecializedName for names that result from AnyRef specialized type parameters. Why does fix the windows build? I remain none the wiser.
* SI-7841 More robust unspecialization of namesJason Zaugg2013-09-161-0/+46
| | | | | | | | | | | | | | | | | | | | Names like `T1$sp`, which can arise from `AnyRef` specialization, were leading to negative length Names if they ever passed through `unspecializedName` or `splitSpecializedName`. This code path was touched when printing the tree of a certain AnyRef specialized classes after specialization, such as `AbstractPartialFunction` (which had such specialization until a few commits ago.) This commit handles that case correctly, and generally hardens against unexpected names, which could pop up from third party classes. The documentation for `splitSpecializedName` transposed the class and method specializations. The things you discover when you turn examples in documentation in to test cases! In addition, we now require non-negative length and offset in `newTermName`
* Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.x-to-masterJason Zaugg2013-09-101-0/+70
|\ | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
| * SI-7814 Avoid init cycle between Predef, `package`, ScalaRuntimeJason Zaugg2013-09-051-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not every application will force these in a single thread; we have to do our best to avoid cycles between them. The enclosed test was failing every time before the change. This commit breaks the cycle by avoiding computing `tupleNames` in the constructor of `ScalaRuntime`. The new version has the added benefit of including specialized tuple subclasses, which is verified with a unit test for `isTuple`. Are there more of these lurking? It seems likely. I'm more than a little concerned about the way the `ControlThrowable` fires up `scala.SystemProperties` to check whether or not to suppress stack traces; there is already an ugly hack in place: object NoStackTrace { final def noSuppression = _noSuppression // two-stage init to make checkinit happy, // since sys.SystemProperties.noTraceSupression.value // calls back into NoStackTrace.noSuppression final private var _noSuppression = false _noSuppression = sys.SystemProperties.noTraceSupression.value }
* | SI-7781 REPL stack trunc shows causeSom Snytt2013-09-021-0/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The handy stack trace truncation in REPL doesn't show cause like a regular trace. This commit fixes that and also adds the usual indicator for truncation, viz, "... 33 more". The example from the ticket produces: ``` scala> rewrapperer java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure at .rewrapper(<console>:9) at .rewrapperer(<console>:10) ... 32 elided Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure at .wrapper(<console>:8) ... 34 more Caused by: java.lang.RuntimeException: Point of failure at .sample(<console>:7) ... 35 more ``` Suppressed exceptions on Java 7 are handled reflectively. ``` java.lang.RuntimeException: My problem at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:56) ... 27 elided Suppressed: java.lang.RuntimeException: Point of failure at scala.tools.nsc.util.StackTraceTest.sample(StackTraceTest.scala:29) at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:54) ... 27 more ```
* | A better diagnostic error for corrupt or missing JARs.Jason Zaugg2013-08-271-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | Augment the IOException with the name of the file we're trying to open. Motivated by a troubleshooting session with partial downloads of JARs from Maven central breaking the Scala build on Martin's laptop. The test case only tests our part of the error message, so as not to be platform / JDK specific. Otherwise, it would check that the correct cause exception was present and accounted for.
* | Merge pull request #2830 from densh/topic/stats-parsing-2Adriaan Moors2013-08-164-4/+121
|\ \ | | | | | | updated SI-7331, SI-6843, SI-7731, parser entry point refactoring, assertThrows utility function
| * | addresses feedback regarding new junit testsDen Shabalin2013-08-154-21/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | 1. don't recreate symbol table manually and just let JUnit do it automatically behind the scenes 2. minor changes to assertThrow's description 3. add one more test case to check that exception's subclasses are catched too 4. refine rethrow test to ensure that the exception wasn't swallowed
| * | SI-7731 make CannotHaveAttrs more consistentDen Shabalin2013-08-141-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously setPos, pos_=, setType, tpe_= all behaved inconsistently between each other even though they all represent similar attributes that cannot be changed on CannotHaveAttrs trees. In order to simplify handling of such trees in compiler code each of these fields now supports assignment to its current default value: NoType for tpe and NoPosition for pos. Such assignments don't mutate underlying trees.
| * | add assertThrows testing utility functionDen Shabalin2013-08-142-0/+44
| | | | | | | | | | | | This is much easier to use than built-in JUnit method-level checks.
* | | Merge pull request #2819 from som-snytt/issue/regextract-charAdriaan Moors2013-08-141-0/+58
|\ \ \ | | | | | | | | SI-7737 Regex matches Char
| * | | SI-7737 Regex matches CharSom Snytt2013-08-101-0/+58
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enables Char extraction by regex. ``` val r = """(\p{Lower})""".r "cat"(0) match { case r(x) => true } val nc = """\p{Lower}""".r "cat"(0) match { case nc() => true } ```
* | | Merge pull request #2791 from som-snytt/issue/7265-2.11Adriaan Moors2013-08-141-0/+59
|\ \ \ | |/ / |/| | SI-7265 javaSpecVersion, adjust isJava... tests for 2.11
| * | SI-7265 javaSpecVersion, adjust isJava... testsSom Snytt2013-08-011-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make this and related properties public, because they are useful. This change ought to have been committed at 2.11 and then backported with restrictions, rather than vice-versa. Note that they are defined in the order, version, vendor and name, which is the order from the underlying javadoc. It would be a neat feature of the PR validator, as previously imagined, to run a "pending" test and then, on success and merge, to move it automatically to the canonical suite.
* | | Merge pull request #2776 from gkossakowski/symbolTable-refactoringsGrzegorz Kossakowski2013-08-062-0/+139
|\ \ \ | |/ / |/| | Refactor the cake so SymbolTable does not depend on Global
| * | Add sample to SymbolTableTest using custom symbols and type.Grzegorz Kossakowski2013-08-021-0/+21
| | | | | | | | | | | | | | | Add a test which demonstrates how one can create symbols and types from scratch and perform sub type check using them.
| * | Address TODOs around SymbolLoaders and SymbolTable.Grzegorz Kossakowski2013-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SymbolTable refactoring introduced some TODOs that were supposed to be addressed after M5 release. The reason I couldn't address those problems right away was a conflict with our plans to modularize Scaladoc and interactive. However, we decided to delay that work until after M5 is released so addressing TODOs is not blocked anymore. This commit introduces the following changes: * Eclipse project definitions for interactive and scaladoc depend on scala-compiler project so they are builded against latest version of the compiler (quick) instead of STARR. This aligns our Eclipse project definitions with build.xml structure. * Introduce GlobalSymbolLoaders class which wires dependencies of SymbolLoaders with assumption of dependency on Global. * Switch to GlobalSymbolLoaders in BrowsingLoaders, interactive Global and ScaladocGlobal; this eliminates all TODO comments introduced before
| * | Add example of SymbolTable unit test.Grzegorz Kossakowski2013-07-272-0/+118
| | | | | | | | | | | | | | | | | | | | | Add a SymbolTableTest which contains all the code needed to initialize a SymbolTable in JUnit environment. It shows that initialization of definitions works and one can easily lookup some symbols and perform tests like subtyping tests.
* | | Merge remote-tracking branch 'scala/2.10.x' into merge-2.10.xGrzegorz Kossakowski2013-07-291-0/+344
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/reflect/reify/phases/Reshape.scala src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/transform/Mixin.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/concurrent/impl/Promise.scala src/reflect/scala/reflect/internal/StdAttachments.scala test/files/neg/macro-override-macro-overrides-abstract-method-b.check test/files/run/t7569.check
| * SI-7336 - Link flatMapped promises to avoid memory leaksRich Dougherty2013-07-061-0/+344
| |
* | SI-7614 Minimize the times of evaluation f in TraversableOnce.maxBy/minBy.yllan2013-07-061-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | In the previous implementation, maxBy/minBy will evaluate most of its elements with f twice to get the ordering. That results (2n - 2) evaluations of f. I save both the element and result of evaluation to a tuple so that it doesn't need to re-evaluate f on next comparison. Thus only n evaluations of f, that is the optimal. Note that the original implementation always returns the first matched if more than one element evaluated to same largest/smallest value of f. I document this behavior explicitly in this commit as well.
* | Move WeakHashSetTest to junit tests.Grzegorz Kossakowski2013-06-161-0/+171
|/ | | | | | The WeakHashSetTest was written as unit test but put into partest's `run` category as we were missing direct unit testing support. That got fixed so moving the test now.
* Add support for JUnit testsGrzegorz Kossakowski2013-06-151-0/+17
Add `test.junit` ant target that compiles and runs JUnit tests found in `test/junit` directory. Add `scala.tools.nsc.SampleTest` that demonstrates working testing infrastructure.