Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PropertyName equals match similar name if only first letter differs #1298

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private static boolean equalsInternal(final String name, final int offset, final
}
matchPosition--;
}
return matchPosition <= offset;
return matchPosition < offset;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.smallrye.config.PropertyName.name;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -64,4 +65,12 @@ void propertyNameEqualsRegions() {
assertTrue(PropertyName.equals("foo.bar", 4, 3, "bar", 0, 3));
assertTrue(PropertyName.equals("foo.\"bar\".baz", 4, 5, "*", 0, 1));
}

@Test
void simpleNames() {
assertFalse(PropertyName.equals("sync", "async"));
assertFalse(PropertyName.equals("async", "sync"));
assertFalse(PropertyName.equals("async-client", "sync-client"));
assertFalse(PropertyName.equals("sync-client", "async-client"));
}
}