Merge branch 'master'

This commit is contained in:
Vasil Trifonov
2020-01-17 15:12:28 +02:00
parent 432a029499
commit b76893801d
3131 changed files with 418263 additions and 185769 deletions

View File

@@ -1,8 +1,8 @@
import {
import {
ErrorHandler, getErrorHandler, setErrorHandler, DefaultErrorHandler,
error as traceError
} from "tns-core-modules/trace";
import * as TKUnit from "../TKUnit";
} from "@nativescript/core/trace";
import * as TKUnit from "../tk-unit";
let cachedErrorHandler: ErrorHandler;
export function setUpModule() {
@@ -11,14 +11,14 @@ export function setUpModule() {
// before each
export function tearDown() {
setErrorHandler(cachedErrorHandler)
setErrorHandler(cachedErrorHandler);
}
export function test_DefaultErrorHandler_throws() {
setErrorHandler(new DefaultErrorHandler());
TKUnit.assertThrows(() => {
traceError(new Error("TEST"))
}, "DefaultErrorHandler should throw.", "TEST")
traceError(new Error("TEST"));
}, "DefaultErrorHandler should throw.", "TEST");
}
export function test_trace_error_should_call_handler() {
@@ -30,7 +30,7 @@ export function test_trace_error_should_call_handler() {
});
traceError(new Error("TEST"));
TKUnit.assert(called, "trace.error() should call handler")
TKUnit.assert(called, "trace.error() should call handler");
}
export function test_trace_error_should_create_error_from_string() {
@@ -44,8 +44,8 @@ export function test_trace_error_should_create_error_from_string() {
});
traceError("TEST");
TKUnit.assert(called, "trace.error() should call handler;")
TKUnit.assert(actualError instanceof Error, "trace.error() wrap string in error")
TKUnit.assert(called, "trace.error() should call handler;");
TKUnit.assert(actualError instanceof Error, "trace.error() wrap string in error");
}
export function test_trace_error_should_pass_errors() {
@@ -61,7 +61,7 @@ export function test_trace_error_should_pass_errors() {
}
});
traceError(testError);
TKUnit.assert(called, "trace.error() should call handler;")
TKUnit.assertDeepEqual(actualError, testError)
TKUnit.assert(called, "trace.error() should call handler;");
TKUnit.assertDeepEqual(actualError, testError);
}

View File

@@ -1,5 +1,5 @@
// >> trace-require
import * as trace from "tns-core-modules/trace";
// >> trace-require
import * as trace from "@nativescript/core/trace";
// << trace-require
export var test_DummyTestForSnippetOnly0 = function () {
@@ -7,7 +7,7 @@ export var test_DummyTestForSnippetOnly0 = function () {
trace.setCategories(trace.categories.All);
trace.enable();
// << trace-all-categories
}
};
export var test_DummyTestForSnippetOnly1 = function () {
// >> trace-specific-categories
@@ -20,10 +20,10 @@ export var test_DummyTestForSnippetOnly1 = function () {
, trace.categories.Style
, trace.categories.ViewHierarchy
, trace.categories.VisualTreeEvents
));
));
trace.enable();
// << trace-specific-categories
}
};
export var test_DummyTestForSnippetOnly2 = function () {
// >> trace-message
@@ -33,4 +33,4 @@ export var test_DummyTestForSnippetOnly2 = function () {
trace.write("My Debug Message", trace.categories.Debug);
}
// << trace-message
}
};