#2981 - ENH: Add profile-line-number-mode with options none | all | auto ... to control adding line numbers to profile locations

This commit is contained in:
rob
2023-02-22 23:02:42 +13:00
parent 34dc4375da
commit 2e0dba3741
16 changed files with 85 additions and 26 deletions
@@ -10,10 +10,12 @@ class ProfileLocationTest {
private static final ProfileLocation loc = ProfileLocation.create(12, "foo");
private static final ProfileLocation locB = ProfileLocation.create();
private static final ProfileLocation loc2 = ProfileLocation.create();
private static final ProfileLocation locWithLine = ProfileLocation.createWithLine();
private boolean doIt() {
locB.obtain(); // simulate a location moving by line number only
return loc.obtain();
boolean result = loc.obtain();
locWithLine.obtain();
return result;
}
@Test
@@ -29,6 +31,16 @@ class ProfileLocationTest {
assertThat(locB.label()).isEqualTo("ProfileLocationTest.doIt");
}
@Test
void test_obtainWithLine() {
doIt();
// same hash even when the line number has changed
assertThat(locWithLine.fullLocation()).isEqualTo("org.tests.profile.ProfileLocationTest.doIt(ProfileLocationTest.java:17)");
assertThat(locWithLine.location()).isEqualTo("org.tests.profile.ProfileLocationTest.doIt:17");
assertThat(locWithLine.label()).isEqualTo("ProfileLocationTest.doIt:17");
}
@Test
void test_add() {
loc.add(100);