core: attempt to determine edits between strings (not working)

This commit is contained in:
Evgeny Poberezkin
2023-05-22 13:42:38 +01:00
parent d39614713d
commit 2aba2e2ecf
2 changed files with 88 additions and 3 deletions
+20
View File
@@ -20,6 +20,7 @@ markdownTests = do
textWithEmail
textWithPhone
multilineMarkdownList
formattedEditedTextTests
textFormat :: Spec
textFormat = describe "text format (bold)" do
@@ -206,3 +207,22 @@ multilineMarkdownList = describe "multiline markdown" do
parseMaybeMarkdownList "http://simplex.chat\nhttp://app.simplex.chat" `shouldBe` Just [uri' "http://simplex.chat", "\n", uri' "http://app.simplex.chat"]
it "no markdown" do
parseMaybeMarkdownList "not a\nmarkdown" `shouldBe` Nothing
plainText :: Text -> FormattedText
plainText = FormattedText Nothing
redText :: Text -> FormattedText
redText = FormattedText $ Just $ colored Red
plainEdited :: Text -> Bool -> EditedText
plainEdited t added = EditedText Nothing t (Just added)
redEdited :: Text -> Bool -> EditedText
redEdited t added = EditedText (Just $ colored Red) t (Just added)
formattedEditedTextTests :: Spec
formattedEditedTextTests = fdescribe "show edits using Wagner-Fisher algorithm" do
it "one character change" do
formattedEditedText [plainText "Hrllo"] [plainText "Hello"]
`shouldBe` []
-- `shouldBe` [plainText "H", plainEdited "r" False, plainEdited "e" True, plainText "llo"]