-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makes it possible to compare datastore-specific revisions with NoRevi…
…sion This is more ergonomic on the client-side, so it does not force client to check for nil revisions and instead always return datastore.NoRevision when there are errors computing a revision.
- Loading branch information
1 parent
c50701a
commit 92af38e
Showing
4 changed files
with
74 additions
and
12 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,17 @@ | ||
package revisions | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestZeroTimestampRevision(t *testing.T) { | ||
require.False(t, TimestampRevision(0).LessThan(zeroTimestampRevision)) | ||
require.True(t, TimestampRevision(0).Equal(zeroTimestampRevision)) | ||
require.False(t, TimestampRevision(0).GreaterThan(zeroTimestampRevision)) | ||
|
||
require.False(t, TimestampRevision(1).LessThan(zeroTimestampRevision)) | ||
require.False(t, TimestampRevision(1).Equal(zeroTimestampRevision)) | ||
require.True(t, TimestampRevision(1).GreaterThan(zeroTimestampRevision)) | ||
} |
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,17 @@ | ||
package revisions | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestZeroTransactionIDRevision(t *testing.T) { | ||
require.False(t, TransactionIDRevision(0).LessThan(zeroTransactionIDRevision)) | ||
require.True(t, TransactionIDRevision(0).Equal(zeroTransactionIDRevision)) | ||
require.False(t, TransactionIDRevision(0).GreaterThan(zeroTransactionIDRevision)) | ||
|
||
require.False(t, TransactionIDRevision(1).LessThan(zeroTransactionIDRevision)) | ||
require.False(t, TransactionIDRevision(1).Equal(zeroTransactionIDRevision)) | ||
require.True(t, TransactionIDRevision(1).GreaterThan(zeroTransactionIDRevision)) | ||
} |