-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5a23d5
commit 534a8ab
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
load("//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite") | ||
|
||
# This package has a rust_test_suite containing no tests. | ||
# (This could happen if the srcs were seleceted via a glob). | ||
# | ||
# We test that the test suite exists and is empty, bypassing test_suite's | ||
# special-case behavior for empty suites. | ||
|
||
rust_library( | ||
name = "code", | ||
srcs = ["src/code.rs"], | ||
edition = "2018", | ||
) | ||
|
||
rust_test( | ||
name = "unrelated_unittest", | ||
crate = "code", | ||
edition = "2018", | ||
) | ||
|
||
rust_test( | ||
name = "unrelated_test", | ||
srcs = ["src/unrelated_test.rs"], | ||
edition = "2018", | ||
deps = [":code"], | ||
) | ||
|
||
rust_test_suite( | ||
name = "suite", | ||
srcs = [], | ||
edition = "2018", | ||
) | ||
|
||
# This verifies the suite exists, and calculates its contents. | ||
genquery( | ||
name = "deps", | ||
expression = "deps(//test/empty_suite:suite, 1) - //test/empty_suite:suite", | ||
scope = [":suite"], | ||
) | ||
|
||
# Test that the suite is empty. | ||
sh_test( | ||
name = "deps_test", | ||
srcs = ["verify_empty.sh"], | ||
args = ["$(location :deps)"], | ||
data = [":deps"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pub fn hello() {} | ||
|
||
#[cfg(test)] | ||
#[test] | ||
fn test_unit() { | ||
hello() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#[test] | ||
pub fn test_hello() { | ||
code::hello() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
# Verifies that argv[1] is an empty file. | ||
|
||
set -eux | ||
|
||
test -f $1 | ||
test ! -s $1 |