Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
ceylon.test: unification in naming
Browse files Browse the repository at this point in the history
  • Loading branch information
thradec committed Dec 1, 2015
1 parent c7ca54f commit f37b6ba
Show file tree
Hide file tree
Showing 28 changed files with 251 additions and 251 deletions.
12 changes: 6 additions & 6 deletions resource/ceylon/test/results.css
Expand Up @@ -60,7 +60,7 @@ body {
color: rgb(169, 68, 66);
}

.summary .ignored {
.summary .skipped {
color: rgb(119, 119, 119);
}

Expand Down Expand Up @@ -102,7 +102,7 @@ body {
color: rgb(169, 68, 66);
}

.results .ignored {
.results .skipped {
color: rgb(119, 119, 119);
}

Expand Down Expand Up @@ -164,16 +164,16 @@ body {
border-bottom: 10px solid rgb(242, 222, 222);
}

.ignored .stack-trace {
.skipped .stack-trace {
background-color: rgb(245, 245, 245);
border-top: 1px solid rgb(240, 240, 240);
}

.ignored .stack-trace-arrow {
.skipped .stack-trace-arrow {
border-bottom: 10px solid rgb(240, 240, 240);
}

.ignored .stack-trace-arrow-inner {
.skipped .stack-trace-arrow-inner {
border-bottom: 10px solid rgb(245, 245, 245);
}

Expand Down Expand Up @@ -208,7 +208,7 @@ body {
color: rgb(169, 68, 66);
}

.icon.ignored:BEFORE {
.icon.skipped:BEFORE {
content: '\2753';
color: rgb(119, 119, 119);
}
Expand Down
24 changes: 12 additions & 12 deletions source/ceylon/test/TestListener.ceylon
Expand Up @@ -24,29 +24,29 @@ import ceylon.test.event {
shared interface TestListener {

"Called before any tests have been run."
shared default void testRunStart(
shared default void testRunStarted(
"The event object."
TestRunStartEvent event) {}
TestRunStartedEvent event) {}

"Called after all tests have finished."
shared default void testRunFinish(
shared default void testRunFinished(
"The event object."
TestRunFinishEvent event) {}
TestRunFinishedEvent event) {}

"Called when a test is about to be started."
shared default void testStart(
shared default void testStarted(
"The event object."
TestStartEvent event) {}
TestStartedEvent event) {}

"Called when a test has finished, whether the test succeeds or not."
shared default void testFinish(
shared default void testFinished(
"The event object."
TestFinishEvent event) {}
TestFinishedEvent event) {}

"Called when a test will *not* be run, because it is marked with [[ignore]] annotation."
shared default void testIgnore(
shared default void testSkipped(
"The event object."
TestIgnoreEvent event) {}
TestSkippedEvent event) {}

"Called when a test has been aborted, because its assumption wasn't met."
shared default void testAborted(
Expand All @@ -60,7 +60,7 @@ shared interface TestListener {
TestErrorEvent event) {}

"Called when a test is excluded from the test run due [[TestFilter]]"
shared default void testExclude(
shared default void testExcluded(
"The event object."
TestExcludeEvent event) {}
TestExcludedEvent event) {}
}
36 changes: 18 additions & 18 deletions source/ceylon/test/TestRunContext.ceylon
Expand Up @@ -21,30 +21,30 @@ shared interface TestRunContext {
"The listeners for removing."
TestListener* listeners);

"Fire [[TestListener.testRunStart]] event."
shared formal void fireTestRunStart(
"Fire [[TestListener.testRunStarted]] event."
shared formal void fireTestRunStarted(
"The event object."
TestRunStartEvent event);
TestRunStartedEvent event);

"Fire [[TestListener.testRunFinish]] event."
shared formal void fireTestRunFinish(
"Fire [[TestListener.testRunFinished]] event."
shared formal void fireTestRunFinished(
"The event object."
TestRunFinishEvent event);
TestRunFinishedEvent event);

"Fire [[TestListener.testStart]] event."
shared formal void fireTestStart(
"Fire [[TestListener.testStarted]] event."
shared formal void fireTestStarted(
"The event object."
TestStartEvent event);
TestStartedEvent event);

"Fire [[TestListener.testFinish]] event."
shared formal void fireTestFinish(
"Fire [[TestListener.testFinished]] event."
shared formal void fireTestFinished(
"The event object."
TestFinishEvent event);
TestFinishedEvent event);

"Fire [[TestListener.testIgnore]] event."
shared formal void fireTestIgnore(
"Fire [[TestListener.testSkipped]] event."
shared formal void fireTestSkipped(
"The event object."
TestIgnoreEvent event);
TestSkippedEvent event);

"Fire [[TestListener.testAborted]] event."
shared formal void fireTestAborted(
Expand All @@ -56,8 +56,8 @@ shared interface TestRunContext {
"The event object."
TestErrorEvent event);

"Fire [[TestListener.testExclude]] event."
shared formal void fireTestExclude(
"Fire [[TestListener.testExcluded]] event."
shared formal void fireTestExcluded(
"The event object."
TestExcludeEvent event);
TestExcludedEvent event);
}
10 changes: 5 additions & 5 deletions source/ceylon/test/TestRunResult.ceylon
Expand Up @@ -10,16 +10,16 @@ shared interface TestRunResult {
"The number of tests that finished [[successfully|TestState.success]]."
shared formal Integer successCount;

"The number of tests that finished with [[TestState.failure]]."
"The number of tests that finished with [[failure|TestState.failure]]."
shared formal Integer failureCount;

"The number of tests that finished with [[TestState.error]]."
"The number of tests that finished with [[error|TestState.error]]."
shared formal Integer errorCount;

"The number of [[TestState.ignored]] tests during the test run."
shared formal Integer ignoreCount;
"The number of [[skipped|TestState.skipped]] tests during the test run."
shared formal Integer skippedCount;

"The number of [[TestState.aborted]] tests during the test run."
"The number of [[aborted|TestState.aborted]] tests during the test run."
shared formal Integer abortedCount;

"The time in milliseconds when the test run started."
Expand Down
6 changes: 3 additions & 3 deletions source/ceylon/test/TestRunner.ceylon
Expand Up @@ -8,14 +8,14 @@ import ceylon.test.core {
DefaultTestRunner
}

"Alias for program elements from which tests can be run."
"Alias for program elements which can be used as a source for discovering tests."
shared alias TestSource => Module|Package|ClassDeclaration|FunctionDeclaration|Class<>|FunctionModel<>|String;

"Alias for functions which filter tests.
Should return true if the given test should be run."
Should return true if the given test should be run, or false if it should be excluded."
shared alias TestFilter => Boolean(TestDescription);

"Alias for functions which compare two tests."
"Alias for functions which compare two tests, used for sorting tests in test plan."
shared alias TestComparator => Comparison(TestDescription, TestDescription);

"Represents a facade for running tests.
Expand Down
8 changes: 4 additions & 4 deletions source/ceylon/test/TestState.ceylon
@@ -1,6 +1,6 @@
"The result state of test execution."
shared class TestState
of success | failure | error | ignored | aborted
of success | failure | error | skipped | aborted
satisfies Comparable<TestState> {

String name;
Expand All @@ -24,9 +24,9 @@ shared class TestState
priority = 50;
}

"A test state is _ignored_, if it is marked with [[ignore]] annotation."
shared new ignored {
name = "ignored";
"A test state is _skipped_, if it is marked with [[ignore]] annotation."
shared new skipped {
name = "skipped";
priority = 10;
}

Expand Down
2 changes: 1 addition & 1 deletion source/ceylon/test/annotations.ceylon
Expand Up @@ -78,7 +78,7 @@ shared annotation BeforeTestAnnotation beforeTest() => BeforeTestAnnotation();
"
shared annotation AfterTestAnnotation afterTest() => AfterTestAnnotation();

"Marks a test or group of tests which should not be executed.
"Marks a test or group of tests which should not be executed, which will be skipped during test run.
It can be set on several places: on concrete test, on class which contains tests, on whole package or even module.
Expand Down
4 changes: 2 additions & 2 deletions source/ceylon/test/assumptions.ceylon
Expand Up @@ -2,7 +2,7 @@ import ceylon.test.core {
TestAbortedException
}

"Skip test execution if the assumption _condition_ is false.
"Abort test execution if the assumption _condition_ is false.
Example:
Expand All @@ -24,7 +24,7 @@ shared void assumeTrue(
}
}

"Skip test execution if the assumption _condition_ is true.
"Abort test execution if the assumption _condition_ is true.
Example:
Expand Down
11 changes: 6 additions & 5 deletions source/ceylon/test/core/DefaultLoggingListener.ceylon
Expand Up @@ -10,11 +10,11 @@ shared class DefaultLoggingListener(
"A function that log the given line."
void write(String line) => print(line)) satisfies TestListener {

shared actual void testRunStart(TestRunStartEvent event) {
shared actual void testRunStarted(TestRunStartedEvent event) {
writeBannerStart();
}

shared actual void testRunFinish(TestRunFinishEvent event) {
shared actual void testRunFinished(TestRunFinishedEvent event) {
writeBannerResults(event.result);
if (event.result.results nonempty) {
writeSummary(event.result);
Expand All @@ -27,11 +27,11 @@ shared class DefaultLoggingListener(
}
}

shared actual void testStart(TestStartEvent event) {
shared actual void testStarted(TestStartedEvent event) {
write("running: ``event.description.name``");
}

shared actual void testFinish(TestFinishEvent event) {
shared actual void testFinished(TestFinishedEvent event) {
if (event.result.state == TestState.error || event.result.state == TestState.failure) {
if (exists e = event.result.exception) {
e.printStackTrace();
Expand Down Expand Up @@ -71,7 +71,8 @@ shared class DefaultLoggingListener(
write("success: ``result.successCount``");
write("failure: ``result.failureCount``");
write("error: ``result.errorCount``");
write("ignored: ``result.ignoreCount``");
write("skipped: ``result.skippedCount``");
write("aborted: ``result.abortedCount``");
write("time: `` result.elapsedTime / 1000 ``s");
write("");
}
Expand Down
14 changes: 7 additions & 7 deletions source/ceylon/test/core/DefaultTestExecutor.ceylon
Expand Up @@ -137,7 +137,7 @@ shared class DefaultTestExecutor(FunctionDeclaration functionDeclaration, ClassD
shared default Boolean handleIgnored(TestRunContext context) {
value ignoreAnnotation = findAnnotation<IgnoreAnnotation>(functionDeclaration, classDeclaration);
if (exists ignoreAnnotation) {
context.fireTestIgnore(TestIgnoreEvent(TestResult(description, TestState.ignored, IgnoreException(ignoreAnnotation.reason))));
context.fireTestSkipped(TestSkippedEvent(TestResult(description, TestState.skipped, TestSkippedException(ignoreAnnotation.reason))));
return true;
}
return false;
Expand All @@ -148,19 +148,19 @@ shared class DefaultTestExecutor(FunctionDeclaration functionDeclaration, ClassD
value elapsedTime => system.milliseconds - startTime;

try {
context.fireTestStart(TestStartEvent(description, instance));
context.fireTestStarted(TestStartedEvent(description, instance));
execute();
context.fireTestFinish(TestFinishEvent(TestResult(description, TestState.success, null, elapsedTime), instance));
context.fireTestFinished(TestFinishedEvent(TestResult(description, TestState.success, null, elapsedTime), instance));
}
catch (Throwable e) {
if (e is IgnoreException) {
context.fireTestIgnore(TestIgnoreEvent(TestResult(description, TestState.ignored, e)));
if (e is TestSkippedException) {
context.fireTestSkipped(TestSkippedEvent(TestResult(description, TestState.skipped, e)));
} else if (e is TestAbortedException) {
context.fireTestAborted(TestAbortedEvent(TestResult(description, TestState.aborted, e)));
} else if (e is AssertionError) {
context.fireTestFinish(TestFinishEvent(TestResult(description, TestState.failure, e, elapsedTime), instance));
context.fireTestFinished(TestFinishedEvent(TestResult(description, TestState.failure, e, elapsedTime), instance));
} else {
context.fireTestFinish(TestFinishEvent(TestResult(description, TestState.error, e, elapsedTime), instance));
context.fireTestFinished(TestFinishedEvent(TestResult(description, TestState.error, e, elapsedTime), instance));
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions source/ceylon/test/core/DefaultTestRunner.ceylon
Expand Up @@ -30,7 +30,7 @@ shared class DefaultTestRunner(
function filterExecutor(TestExecutor e) {
value result = filter(e.description);
if (!result) {
listeners*.testExclude(TestExcludeEvent(e.description));
listeners*.testExcluded(TestExcludedEvent(e.description));
}
return result;
}
Expand All @@ -56,17 +56,16 @@ shared class DefaultTestRunner(
value context = TestRunContextImpl(this, result);

context.addTestListener(result.listener, *listeners);
context.fireTestRunStart(TestRunStartEvent(this, description));
context.fireTestRunStarted(TestRunStartedEvent(this, description));
executors*.execute(context);
context.fireTestRunFinish(TestRunFinishEvent(this, result));
context.fireTestRunFinished(TestRunFinishedEvent(this, result));
context.removeTestListener(result.listener, *listeners);

return result;
}
finally {
runningRunners.remove(this);
}

}

void verifyCycle() {
Expand Down
10 changes: 5 additions & 5 deletions source/ceylon/test/core/exceptions.ceylon
Expand Up @@ -2,16 +2,16 @@ import ceylon.language.meta {
type
}

"Thrown when test is ignored."
shared class IgnoreException(reason) extends Exception(reason) {
"Thrown when test is skipped."
shared class TestSkippedException(reason = null) extends Exception(reason) {

"Reason why the test is ignored."
shared String reason;
"Reason why the test is skipped."
shared String? reason;

}

"Thrown when the test assumption is not met, cause aborting of test execution."
shared class TestAbortedException(assumption) extends Exception(assumption) {
shared class TestAbortedException(assumption = null) extends Exception(assumption) {

"The message describing the assumption, which wasn't met."
shared String? assumption;
Expand Down

0 comments on commit f37b6ba

Please sign in to comment.