summaryrefslogtreecommitdiff
path: root/test/junit
Commit message (Collapse)AuthorAgeFilesLines
* 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.