Skip to content
Snippets Groups Projects
Commit 6de018f9 authored by Jay.Udey's avatar Jay.Udey
Browse files

allow object to be passed in as a description

parent a99ce0f6
No related branches found
No related tags found
No related merge requests found
......@@ -118,9 +118,13 @@ Declarer get _declarer {
///
/// If multiple platforms match, the annotations apply in order as through
/// they were in nested groups.
void test(String description, body(), {String testOn, Timeout timeout, skip,
tags, Map<String, dynamic> onPlatform}) =>
_declarer.test(description, body,
void test(description, body(),
{String testOn,
Timeout timeout,
skip,
tags,
Map<String, dynamic> onPlatform}) =>
_declarer.test(description.toString(), body,
testOn: testOn,
timeout: timeout,
skip: skip,
......@@ -171,10 +175,18 @@ void test(String description, body(), {String testOn, Timeout timeout, skip,
///
/// If multiple platforms match, the annotations apply in order as through
/// they were in nested groups.
void group(String description, body(), {String testOn, Timeout timeout, skip,
tags, Map<String, dynamic> onPlatform}) =>
_declarer.group(description, body,
testOn: testOn, timeout: timeout, skip: skip, tags: tags);
void group(description, body(),
{String testOn,
Timeout timeout,
skip,
tags,
Map<String, dynamic> onPlatform}) =>
description == null
? _declarer.group(description, body,
testOn: testOn, timeout: timeout, skip: skip, tags: tags)
: _declarer.group(description.toString(), body,
testOn: testOn, timeout: timeout, skip: skip, tags: tags);
/// Registers a function to be run before tests.
///
......
......@@ -36,6 +36,15 @@ void main() {
expect(bodyRun, isTrue);
});
test("declares a test with an object as the description", () async {
var tests = declare(() {
test(Object, () {
});
});
expect(tests.single.name, equals("Object"));
});
test("declares multiple tests", () {
var tests = declare(() {
test("description 1", () {});
......@@ -277,6 +286,21 @@ void main() {
expect(entries.single.entries.single.name, "group description");
});
test("tests inherit the group's description when it's not a string", () {
var entries = declare(() {
group(Object, () {
test("description", () {});
});
});
expect(entries, hasLength(1));
expect(entries.single, new isInstanceOf<Group>());
expect(entries.single.name, equals("Object"));
expect(entries.single.entries, hasLength(1));
expect(entries.single.entries.single, new isInstanceOf<Test>());
expect(entries.single.entries.single.name, "Object description");
});
test("a test's timeout factor is applied to the group's", () {
var entries = declare(() {
group("group", () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment