daml/daml-lf/transaction/BUILD.bazel
nickchapman-da 8578e56aa7
Tests for transaction validation (#10167)
* Testing for Validation.isReplayedBy

changelog_begin
changelog_end

try fix scala 2_12 build

fetch node: samples and tweaks

list sig/insig field tweaks side-by-side so coverage is easier to eyeball

exerciseResult tweak sig & insig

add sig/insig tweak for byKey of Fetch node

add sig/insig tweak for key of Fetch node

must use ImmArray.empty instead of ImmArray() for scala 2.12

another blind attempt to fix scala 2.12

use for/yield instead of flatMap for list-comprehensions

test sig/insig tweaks to LookupByKey nodes

wont attempt to tweak rollbacks

(and shorten trailing dash in comment banners)

comment about how Tweak testing is organized

dont dep/import scalacheck (not used!)

no wild imports

* val --> private def

* def --> val

* prefer fail to println/assert(false)
2021-07-06 11:24:46 +00:00

121 lines
3.1 KiB
Python

# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:proto.bzl", "proto_jars")
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
"silencer_plugin",
)
#
# Transaction and value protocol buffers
#
proto_jars(
name = "value_proto",
srcs = ["src/main/protobuf/com/daml/lf/value.proto"],
maven_artifact_prefix = "daml-lf-value",
maven_group = "com.daml",
strip_import_prefix = "src/main/protobuf/",
visibility = ["//visibility:public"],
deps = [
"@com_google_protobuf//:empty_proto",
],
)
proto_jars(
name = "transaction_proto",
srcs = ["src/main/protobuf/com/daml/lf/transaction.proto"],
maven_artifact_prefix = "daml-lf-transaction",
maven_group = "com.daml",
proto_deps = [
":value_proto",
],
strip_import_prefix = "src/main/protobuf/",
visibility = ["//visibility:public"],
)
#
# Transaction library providing a high-level scala transaction
# data structure and associated utilities.
#
da_scala_library(
name = "transaction",
srcs = glob(["src/main/**/*.scala"]),
plugins = [
silencer_plugin,
],
scala_deps = [
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.daml:daml-lf-transaction:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
":transaction_proto_java",
":value_proto_java",
"//daml-lf/data",
"//daml-lf/language",
"@maven//:com_google_protobuf_protobuf_java",
],
)
da_scala_test(
name = "transaction-test",
size = "medium",
srcs = glob([
"src/test/**/EitherAssertions.scala",
"src/test/**/crypto/*.scala",
"src/test/**/value/*.scala",
"src/test/**/transaction/*.scala",
]),
plugins = [
silencer_plugin,
],
scala_deps = [
"@maven//:com_chuusai_shapeless",
"@maven//:org_scalacheck_scalacheck",
"@maven//:org_scalatestplus_scalacheck_1_14",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scalaz_scalaz_scalacheck_binding",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
scalacopts = lf_scalacopts,
deps = [
":transaction",
":transaction_proto_java",
":value_proto_java",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/language",
"//daml-lf/transaction-test-lib",
"//libs-scala/scalatest-utils",
"@maven//:com_google_protobuf_protobuf_java",
],
)
da_scala_test(
name = "validation-test",
size = "medium",
srcs = glob([
"src/test/**/validation/*.scala",
]),
plugins = [
silencer_plugin,
],
scala_deps = [
"@maven//:org_scalaz_scalaz_core",
],
scalacopts = lf_scalacopts,
deps = [
":transaction",
"//daml-lf/data",
"//daml-lf/language",
],
)