]> git.giacomolli.uk - onechat/blobdiff - memory_test.go
Order functions by their first use
[onechat] / memory_test.go
index 6713f6dab219d83d0139ec8cc3656bc19f0cba42..d3fa6129d4cc2134dd4130f0917224268bedd6a9 100644 (file)
@@ -143,6 +143,7 @@ func TestMemoryRunsAtMostEightBuilds(t *testing.T) {
        slices.SortFunc(running, func(a, b NodeKey) int {
                return a.index - b.index
        })
        slices.SortFunc(running, func(a, b NodeKey) int {
                return a.index - b.index
        })
+
        require.Equal(t, []NodeKey{{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}}, running)
 
        require.Eventually(t, func() bool {
        require.Equal(t, []NodeKey{{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}}, running)
 
        require.Eventually(t, func() bool {
@@ -482,21 +483,22 @@ func TestQueuedAppendRefusesAnInvalidReceipt(t *testing.T) {
                cause string
        }{
                {
                cause string
        }{
                {
-                       name:  "receipt points to different text",
+                       name:  "refuses when receipt points to different text",
                        id:    0,
                        cause: "does not match",
                },
                {
                        id:    0,
                        cause: "does not match",
                },
                {
-                       name:  "receipt skips a log position",
+                       name:  "refuses when receipt skips a log position",
                        id:    2,
                        cause: "beyond the log",
                },
                {
                        id:    2,
                        cause: "beyond the log",
                },
                {
-                       name:  "receipt has a negative position",
+                       name:  "refuses when receipt has a negative position",
                        id:    -1,
                        cause: "read queued message",
                },
        }
                        id:    -1,
                        cause: "read queued message",
                },
        }
+
        for _, tc := range testCases {
                t.Run(tc.name, func(t *testing.T) {
                        _, err := memory.AppendOnce("user", "Other text.", &tc.id, func(int) error {
        for _, tc := range testCases {
                t.Run(tc.name, func(t *testing.T) {
                        _, err := memory.AppendOnce("user", "Other text.", &tc.id, func(int) error {