This repository has been archived by the owner on May 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[epociask/no-issue-withdrawal-enforce] State key and contract event i…
…nvariant unit tests
- Loading branch information
Ethen Pociask
committed
Jun 28, 2023
1 parent
bb41869
commit 95c62c1
Showing
4 changed files
with
113 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package core_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/base-org/pessimism/internal/core" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_StateKey(t *testing.T) { | ||
sk := core.MakeStateKey(0, "testId", false) | ||
|
||
puuid := core.NilPUUID() | ||
puuid.PID[0] = 1 | ||
|
||
// Successfully set the key | ||
err := sk.SetPUUID(puuid) | ||
assert.NoError(t, err) | ||
assert.Contains(t, sk.String(), puuid.String()) | ||
|
||
pUUID2 := core.NilPUUID() | ||
|
||
err = sk.SetPUUID(pUUID2) | ||
assert.Error(t, err, "cannot set puuid more than once") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters