Merge pull request #13 from sbt/wip/packagenames2

package name change and test migration
This commit is contained in:
eugene yokota 2015-09-07 02:51:08 -04:00 committed by Dale Wijnand
commit ac8c3aefdd
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
43 changed files with 140 additions and 134 deletions

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
import Classes.Applicative
import Types._

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import Types._
import scala.reflect.Manifest

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
object Classes {
trait Applicative[M[_]] {

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2008, 2009, 2010 David MacIver, Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
trait Dag[Node <: Dag[Node]] {
self: Node =>

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import Types._

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
/** A mutable set interface that uses object identity to test for set membership.*/
trait IDSet[T] {

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
import java.lang.Runnable
import java.util.concurrent.{ atomic, Executor, LinkedBlockingQueue }

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
import Types._
import Classes.Applicative

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import collection.mutable

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import Types._

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
sealed trait SourcePosition

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2011 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import Types._

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
trait Show[T] {
def apply(t: T): String

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
trait ShowLines[A] {
def showLines(a: A): Seq[String]

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
object Signals {
val CONT = "CONT"

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
trait TypeFunctions {
type Id[X] = X

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
object Types extends Types

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2011 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import java.util.Locale

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2008 Mark Harrah */
package sbt.util.internal
package sbt.internal.util
import org.scalacheck._
import Prop._

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
import org.scalacheck._
import Prop._

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import Types._

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import Types._

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
/** Define our settings system */

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
import org.scalacheck._
import Prop._

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2008, 2009 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
import jline.console.ConsoleReader
import jline.console.history.{ FileHistory, MemoryHistory }
@ -128,7 +128,7 @@ final class FullReader(historyPath: Option[File], complete: Parser[_], val handl
protected[this] val reader =
{
val cr = JLine.createReader(historyPath)
sbt.util.internal.complete.JLineCompletion.installCustomCompletor(cr, complete)
sbt.internal.util.complete.JLineCompletion.installCustomCompletor(cr, complete)
cr
}
}

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
package complete
/**

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package complete
import java.lang.Character.{ toLowerCase => lower }

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package complete
import java.io.File

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
package complete
import History.number

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
package complete
import java.io.File

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2011 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
package complete
import jline.console.ConsoleReader

View File

@ -1,12 +1,12 @@
/* sbt -- Simple Build Tool
* Copyright 2008, 2010, 2011 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
package complete
import Parser._
import sbt.util.internal.Types.{ left, right, some }
import sbt.util.internal.Util.{ makeList, separate }
import sbt.internal.util.Types.{ left, right, some }
import sbt.internal.util.Util.{ makeList, separate }
/**
* A String parser that provides semi-automatic tab completion.

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2011 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
package complete
import Parser._

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package complete
object ProcessError {

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package complete
import Completion.{ token => ctoken, tokenDisplay }

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package complete
import DefaultParsers._

View File

@ -1,7 +1,7 @@
/* sbt -- Simple Build Tool
* Copyright 2008,2010 Mark Harrah
*/
package sbt.util.internal
package sbt.internal.util
package complete
sealed trait UpperBound {

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package complete
object JLineTest {

View File

@ -1,54 +1,60 @@
package sbt.util.internal
package sbt.internal.util
package complete
import org.specs2.mutable.Specification
import org.specs2.specification.Scope
import java.io.File
import sbt.io.IO._
class FileExamplesTest extends Specification {
class FileExamplesTest extends UnitSpec {
"listing all files in an absolute base directory" should {
"produce the entire base directory's contents" in new directoryStructure {
fileExamples().toList should containTheSameElementsAs(allRelativizedPaths)
"listing all files in an absolute base directory" should
"produce the entire base directory's contents" in {
val _ = new DirectoryStructure {
fileExamples().toList should contain theSameElementsAs (allRelativizedPaths)
}
}
"listing files with a prefix that matches none" should
"produce an empty list" in {
val _ = new DirectoryStructure(withCompletionPrefix = "z") {
fileExamples().toList shouldBe empty
}
}
"listing single-character prefixed files" should
"produce matching paths only" in {
val _ = new DirectoryStructure(withCompletionPrefix = "f") {
fileExamples().toList should contain theSameElementsAs (prefixedPathsOnly)
}
}
"listing directory-prefixed files" should
"produce matching paths only" in {
val _ = new DirectoryStructure(withCompletionPrefix = "far") {
fileExamples().toList should contain theSameElementsAs (prefixedPathsOnly)
}
}
it should "produce sub-dir contents only when appending a file separator to the directory" in {
val _ = new DirectoryStructure(withCompletionPrefix = "far" + File.separator) {
fileExamples().toList should contain theSameElementsAs (prefixedPathsOnly)
}
}
"listing files with a prefix that matches none" should {
"produce an empty list" in new directoryStructure(withCompletionPrefix = "z") {
fileExamples().toList should beEmpty
}
}
"listing single-character prefixed files" should {
"produce matching paths only" in new directoryStructure(withCompletionPrefix = "f") {
fileExamples().toList should containTheSameElementsAs(prefixedPathsOnly)
}
}
"listing directory-prefixed files" should {
"produce matching paths only" in new directoryStructure(withCompletionPrefix = "far") {
fileExamples().toList should containTheSameElementsAs(prefixedPathsOnly)
"listing files with a sub-path prefix" should
"produce matching paths only" in {
val _ = new DirectoryStructure(withCompletionPrefix = "far" + File.separator + "ba") {
fileExamples().toList should contain theSameElementsAs (prefixedPathsOnly)
}
}
"produce sub-dir contents only when appending a file separator to the directory" in new directoryStructure(withCompletionPrefix = "far" + File.separator) {
fileExamples().toList should containTheSameElementsAs(prefixedPathsOnly)
"completing a full path" should
"produce a list with an empty string" in {
val _ = new DirectoryStructure(withCompletionPrefix = "bazaar") {
fileExamples().toList shouldEqual List("")
}
}
}
"listing files with a sub-path prefix" should {
"produce matching paths only" in new directoryStructure(withCompletionPrefix = "far" + File.separator + "ba") {
fileExamples().toList should containTheSameElementsAs(prefixedPathsOnly)
}
}
"completing a full path" should {
"produce a list with an empty string" in new directoryStructure(withCompletionPrefix = "bazaar") {
fileExamples().toList shouldEqual List("")
}
}
class directoryStructure(withCompletionPrefix: String = "") extends Scope with DelayedInit {
class DirectoryStructure(withCompletionPrefix: String = "") extends DelayedInit {
var fileExamples: FileExamples = _
var baseDir: File = _
var childFiles: List[File] = _

View File

@ -1,26 +1,23 @@
package sbt.util.internal
package sbt.internal.util
package complete
import org.specs2.mutable.Specification
import org.specs2.specification.Scope
class FixedSetExamplesTest extends UnitSpec {
class FixedSetExamplesTest extends Specification {
"adding a prefix" should {
"produce a smaller set of examples with the prefix removed" in new examples {
fixedSetExamples.withAddedPrefix("f")() must containTheSameElementsAs(List("oo", "ool", "u"))
fixedSetExamples.withAddedPrefix("fo")() must containTheSameElementsAs(List("o", "ol"))
fixedSetExamples.withAddedPrefix("b")() must containTheSameElementsAs(List("ar"))
"adding a prefix" should "produce a smaller set of examples with the prefix removed" in {
val _ = new Examples {
fixedSetExamples.withAddedPrefix("f")() should contain theSameElementsAs (List("oo", "ool", "u"))
fixedSetExamples.withAddedPrefix("fo")() should contain theSameElementsAs (List("o", "ol"))
fixedSetExamples.withAddedPrefix("b")() should contain theSameElementsAs (List("ar"))
}
}
"without a prefix" should {
"produce the original set" in new examples {
fixedSetExamples() mustEqual exampleSet
"without a prefix" should "produce the original set" in {
val _ = new Examples {
fixedSetExamples() shouldBe exampleSet
}
}
trait examples extends Scope {
trait Examples {
val exampleSet = List("foo", "bar", "fool", "fu")
val fixedSetExamples = FixedSetExamples(exampleSet)
}

View File

@ -1,61 +1,64 @@
package sbt.util.internal
package sbt.internal.util
package complete
import org.specs2.mutable.Specification
import org.specs2.specification.Scope
import Completion._
class ParserWithExamplesTest extends Specification {
class ParserWithExamplesTest extends UnitSpec {
"listing a limited number of completions" should {
"grab only the needed number of elements from the iterable source of examples" in new parserWithLazyExamples {
parserWithExamples.completions(0)
examples.size shouldEqual maxNumberOfExamples
"listing a limited number of completions" should
"grab only the needed number of elements from the iterable source of examples" in {
val _ = new ParserWithLazyExamples {
parserWithExamples.completions(0)
examples.size shouldEqual maxNumberOfExamples
}
}
}
"listing only valid completions" should {
"use the delegate parser to remove invalid examples" in new parserWithValidExamples {
val validCompletions = Completions(Set(
suggestion("blue"),
suggestion("red")))
parserWithExamples.completions(0) shouldEqual validCompletions
"listing only valid completions" should
"use the delegate parser to remove invalid examples" in {
val _ = new ParserWithValidExamples {
val validCompletions = Completions(Set(
suggestion("blue"),
suggestion("red")))
parserWithExamples.completions(0) shouldEqual validCompletions
}
}
}
"listing valid completions in a derived parser" should {
"produce only valid examples that start with the character of the derivation" in new parserWithValidExamples {
val derivedCompletions = Completions(Set(
suggestion("lue")))
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
"listing valid completions in a derived parser" should
"produce only valid examples that start with the character of the derivation" in {
val _ = new ParserWithValidExamples {
val derivedCompletions = Completions(Set(
suggestion("lue")))
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
}
}
}
"listing valid and invalid completions" should {
"produce the entire source of examples" in new parserWithAllExamples {
val completions = Completions(examples.map(suggestion(_)).toSet)
parserWithExamples.completions(0) shouldEqual completions
"listing valid and invalid completions" should
"produce the entire source of examples" in {
val _ = new parserWithAllExamples {
val completions = Completions(examples.map(suggestion(_)).toSet)
parserWithExamples.completions(0) shouldEqual completions
}
}
}
"listing valid and invalid completions in a derived parser" should {
"produce only examples that start with the character of the derivation" in new parserWithAllExamples {
val derivedCompletions = Completions(Set(
suggestion("lue"),
suggestion("lock")))
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
"listing valid and invalid completions in a derived parser" should
"produce only examples that start with the character of the derivation" in {
val _ = new parserWithAllExamples {
val derivedCompletions = Completions(Set(
suggestion("lue"),
suggestion("lock")))
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
}
}
}
class parserWithLazyExamples extends parser(GrowableSourceOfExamples(), maxNumberOfExamples = 5, removeInvalidExamples = false)
class ParserWithLazyExamples extends ParserExample(GrowableSourceOfExamples(), maxNumberOfExamples = 5, removeInvalidExamples = false)
class parserWithValidExamples extends parser(removeInvalidExamples = true)
class ParserWithValidExamples extends ParserExample(removeInvalidExamples = true)
class parserWithAllExamples extends parser(removeInvalidExamples = false)
class parserWithAllExamples extends ParserExample(removeInvalidExamples = false)
case class parser(examples: Iterable[String] = Set("blue", "yellow", "greeen", "block", "red"),
case class ParserExample(examples: Iterable[String] = Set("blue", "yellow", "greeen", "block", "red"),
maxNumberOfExamples: Int = 25,
removeInvalidExamples: Boolean) extends Scope {
removeInvalidExamples: Boolean) {
import DefaultParsers._

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package logic
import scala.annotation.tailrec

View File

@ -1,4 +1,4 @@
package sbt.util.internal
package sbt.internal.util
package logic
import org.scalacheck._