From b93d02a7219855367eaf60757e8590556ba82e58 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 16 Sep 2023 20:04:03 +0800 Subject: [PATCH 1/2] docs: fix dead cosmos-sdk links (#4678) --- docs/ibc/apps.md | 2 +- docs/ibc/apps/apps.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ibc/apps.md b/docs/ibc/apps.md index 7a8f07954bd..7e5293bfd0a 100644 --- a/docs/ibc/apps.md +++ b/docs/ibc/apps.md @@ -488,4 +488,4 @@ callbacks](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/ibc_ ## Next {hide} -Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/01-intro.md) {hide} +Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/00-intro.md) {hide} diff --git a/docs/ibc/apps/apps.md b/docs/ibc/apps/apps.md index 9cf9169c9b7..93f86d464b0 100644 --- a/docs/ibc/apps/apps.md +++ b/docs/ibc/apps/apps.md @@ -48,4 +48,4 @@ callbacks](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/ibc_ ## Next {hide} -Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/01-intro.md) {hide} +Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/00-intro.md) {hide} From f4e1f713ad2429ad498f26d27f86566b33840c8c Mon Sep 17 00:00:00 2001 From: Reece Williams <31943163+Reecepbcups@users.noreply.github.com> Date: Sat, 16 Sep 2023 13:57:33 -0500 Subject: [PATCH 2/2] Add test for parsing connection paths (#4111) * Use regex to parse identifiers in a key path * typo * Add regex godoc comment and 2 examples * Revert back to just TestMustParseConnectionPath * re-add description vars from main branch * chore: lint fix --------- Co-authored-by: Jim Fasarakis-Hilliard Co-authored-by: Carlos Rodriguez Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: Damian Nolan --- modules/core/24-host/parse_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/core/24-host/parse_test.go b/modules/core/24-host/parse_test.go index 817ad117030..c43a58d5b7b 100644 --- a/modules/core/24-host/parse_test.go +++ b/modules/core/24-host/parse_test.go @@ -77,3 +77,29 @@ func TestMustParseClientStatePath(t *testing.T) { } } } + +func TestMustParseConnectionPath(t *testing.T) { + testCases := []struct { + name string + path string + expected string + expPass bool + }{ + {"valid", "a/connection", "connection", true}, + {"valid localhost", "/connection-localhost", "connection-localhost", true}, + {"invalid empty path", "", "", false}, + } + + for _, tc := range testCases { + if tc.expPass { + require.NotPanics(t, func() { + connID := host.MustParseConnectionPath(tc.path) + require.Equal(t, connID, tc.expected) + }) + } else { + require.Panics(t, func() { + host.MustParseConnectionPath(tc.path) + }) + } + } +}