Skip to content

Commit

Permalink
Enable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdogpr committed May 7, 2021
1 parent e203073 commit fd9a96c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 25 deletions.
14 changes: 4 additions & 10 deletions core/src/main/scala-3/caliban/parsing/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ object Parser {
private def interfaceTypeDefinition(description: Option[String]): P[InterfaceTypeDefinition] =
((P.string("interface") *> whitespaceWithComment1 *> name <* whitespaceWithComment) ~
(directives <* whitespaceWithComment).? ~ wrapBrackets(
fieldDefinition.repSep0(whitespaceWithComment)
)).map { case ((name, directives), fields) =>
fieldDefinition.repSep0(whitespaceWithComment)
)).map { case ((name, directives), fields) =>
InterfaceTypeDefinition(description, name, directives.getOrElse(Nil), fields)
}

Expand All @@ -375,8 +375,8 @@ object Parser {
private def enumTypeDefinition(description: Option[String]): P[EnumTypeDefinition] =
((P.string("enum") *> whitespaceWithComment1 *> enumName <* whitespaceWithComment) ~
(directives <* whitespaceWithComment).? ~ wrapBrackets(
enumValueDefinition.repSep0(whitespaceWithComment)
)).map { case ((name, directives), enumValuesDefinition) =>
enumValueDefinition.repSep0(whitespaceWithComment)
)).map { case ((name, directives), enumValuesDefinition) =>
EnumTypeDefinition(description, name, directives.getOrElse(Nil), enumValuesDefinition)
}

Expand Down Expand Up @@ -569,12 +569,6 @@ object Parser {
*/
def parseQuery(query: String): IO[ParsingError, Document] = {
val sm = SourceMapper(query)
// document.parse(query) match {
// case Left(error) =>
// IO.fail(ParsingError(error.toString, Some(sm.getLocation(error.failedAtOffset))))
// case Right(result) =>
// IO.succeed(Document(result._2.definitions,sm))
// }
Task(document.parse(query))
.mapError(ex => ParsingError(s"Internal parsing error", innerThrowable = Some(ex)))
.flatMap {
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala-3/caliban/Scala3SpecificSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package caliban
import caliban.GraphQL._
import caliban.schema.Annotations.GQLInterface
import zio.test.Assertion._
import zio.test.TestAspect.exceptDotty
import zio.test._
import zio.test.environment.TestEnvironment

Expand Down Expand Up @@ -71,5 +70,5 @@ object Scala3SpecificSpec extends DefaultRunnableSpec {
equalTo("""{"item":{"a":1}}""")
)
}
) @@ exceptDotty
)
}
3 changes: 1 addition & 2 deletions core/src/test/scala/caliban/execution/ExecutionSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import caliban.schema.{ Schema, Step, Types }
import zio.{ IO, Task, UIO, ZIO }
import zio.stream.ZStream
import zio.test.Assertion._
import zio.test.TestAspect.exceptDotty
import zio.test._
import zio.test.environment.TestEnvironment

Expand Down Expand Up @@ -814,5 +813,5 @@ object ExecutionSpec extends DefaultRunnableSpec {
)
)
}
) @@ exceptDotty
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import caliban.introspection.adt.__Introspection
import caliban.wrappers.Wrapper.IntrospectionWrapper
import zio.ZIO
import zio.test.Assertion._
import zio.test.TestAspect.exceptDotty
import zio.test._
import zio.test.environment.TestEnvironment

Expand Down Expand Up @@ -184,5 +183,5 @@ object IntrospectionSpec extends DefaultRunnableSpec {
equalTo("""{"__type":null}""")
)
}
) @@ exceptDotty
)
}
4 changes: 2 additions & 2 deletions core/src/test/scala/caliban/parsing/ParserSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ object ParserSpec extends DefaultRunnableSpec {
assertM(Parser.parseQuery(query).run)(
fails(equalTo(ParsingError("Position 4:3, found \"}\\n}\"", locationInfo = Some(LocationInfo(3, 4)))))
)
},
} @@ exceptDotty,
testM("type") {
val gqltype =
"""type Hero {
Expand Down Expand Up @@ -1011,7 +1011,7 @@ object ParserSpec extends DefaultRunnableSpec {
)
)
}
) @@ exceptDotty
)

def simpleQuery(
name: Option[String] = None,
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala/caliban/parsing/SourceMapperSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package caliban.parsing

import caliban.parsing.adt.LocationInfo
import zio.test.Assertion._
import zio.test.TestAspect.exceptDotty
import zio.test.environment.TestEnvironment
import zio.test._

Expand All @@ -20,5 +19,5 @@ object SourceMapperSpec extends DefaultRunnableSpec {
|""".stripMargin)
assert(sm.getLocation(3))(equalTo(LocationInfo(1, 3)))
}
) @@ exceptDotty
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import caliban.schema.Types
import caliban.{ GraphQL, RootResolver }
import zio.IO
import zio.test.Assertion._
import zio.test.TestAspect.exceptDotty
import zio.test._
import zio.test.environment.TestEnvironment

Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala/caliban/validation/ValidationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import caliban.TestUtils._
import caliban.Value.StringValue
import zio.IO
import zio.test.Assertion._
import zio.test.TestAspect.exceptDotty
import zio.test.environment.TestEnvironment
import zio.test._

Expand Down Expand Up @@ -289,5 +288,5 @@ object ValidationSpec extends DefaultRunnableSpec {
}""")
check(query, "Directive 'skip' is defined twice.")
}
) @@ exceptDotty
)
}
3 changes: 1 addition & 2 deletions core/src/test/scala/caliban/wrappers/WrappersSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import zio.clock.Clock
import zio.duration._
import zio.query.ZQuery
import zio.test.Assertion._
import zio.test.TestAspect.exceptDotty
import zio.test._
import zio.test.environment.{ TestClock, TestEnvironment }
import zio.{ clock, Promise, Ref, UIO, URIO, ZIO }
Expand Down Expand Up @@ -301,5 +300,5 @@ object WrappersSpec extends DefaultRunnableSpec {
equalTo("""true""")
)
}
) @@ exceptDotty
)
}

0 comments on commit fd9a96c

Please sign in to comment.