mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix(profiling): resetProfiles doesn't reset all profiles (#5425)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { assert, assertEqual, assertFalse, assertTrue, assertThrows } from "../TKUnit";
|
||||
import { assert, assertEqual, assertFalse, assertNull, assertTrue, assertThrows } from "../TKUnit";
|
||||
import { enable, disable, profile, time, start, stop, timer, isRunning, resetProfiles } from "tns-core-modules/profiling";
|
||||
|
||||
enable();
|
||||
@ -99,6 +99,19 @@ export function test_isRunning_withReentrancy() {
|
||||
assertFalse(isRunning(name), "isRunning should be false after second stop");
|
||||
}
|
||||
|
||||
export function test_reset_profiles() {
|
||||
resetProfiles();
|
||||
const name = "test_reset_profiles";
|
||||
|
||||
start(name);
|
||||
stop(name);
|
||||
resetProfiles();
|
||||
|
||||
const res = timer(name);
|
||||
|
||||
assertNull(res);
|
||||
}
|
||||
|
||||
export function test_start_stop() {
|
||||
resetProfiles();
|
||||
const name = "test_start_stop";
|
||||
|
@ -46,6 +46,7 @@ export function start(name: string): void {
|
||||
runCount: 1
|
||||
};
|
||||
timers[name] = info;
|
||||
profileNames.push(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user