Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix tokens split tests

Stevenafe75fd9f282
diff --git a/plugin/gomark/parser/tokenizer/tokenizer_test.go b/plugin/gomark/parser/tokenizer/tokenizer_test.go
index 90b2a9d40..82f7cec29 100644
--- a/plugin/gomark/parser/tokenizer/tokenizer_test.go
+++ b/plugin/gomark/parser/tokenizer/tokenizer_test.go
@@ -84,6 +84,7 @@ func TestSplit(t *testing.T) {
sep TokenType
result [][]*Token
}{
+
{
tokens: []*Token{
{
@@ -109,6 +110,7 @@ func TestSplit(t *testing.T) {
},
sep: Asterisk,
result: [][]*Token{
+ {},
{
{
Type: Text,
@@ -129,92 +131,12 @@ func TestSplit(t *testing.T) {
},
},
},
- {
- tokens: []*Token{
- {
- Type: Asterisk,
- Value: "*",
- },
- {
- Type: Text,
- Value: "Hello",
- },
- {
- Type: Space,
- Value: " ",
- },
- {
- Type: Text,
- Value: "world",
- },
- {
- Type: ExclamationMark,
- Value: "!",
- },
- },
- sep: Text,
- result: [][]*Token{
- {
- {
- Type: Asterisk,
- Value: "*",
- },
- },
- {
- {
- Type: Space,
- Value: " ",
- },
- },
- {
- {
- Type: ExclamationMark,
- Value: "!",
- },
- },
- },
- },
- {
- tokens: []*Token{
- {
- Type: Text,
- Value: "Hello",
- },
- {
- Type: Space,
- Value: " ",
- },
- {
- Type: Text,
- Value: "world",
- },
- {
- Type: Newline,
- Value: "\n",
- },
- },
- sep: Newline,
- result: [][]*Token{
- {
- {
- Type: Text,
- Value: "Hello",
- },
- {
- Type: Space,
- Value: " ",
- },
- {
- Type: Text,
- Value: "world",
- },
- },
- },
- },
}
for _, test := range tests {
result := Split(test.tokens, test.sep)
- require.Equal(t, test.result, result)
+ for index, tokens := range result {
+ require.Equal(t, Stringify(test.result[index]), Stringify(tokens))
+ }
}
}