From 7b9d4b1f1b448cc5f6653c191beda8615b35fd7c Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Thu, 16 Feb 2017 08:29:49 -0800 Subject: [PATCH] Add test for toc summaries of files with unicode chars --- test/TOCSpec.hs | 5 +++++ test/corpus/toc/ruby/unicode.A.rb | 4 ++++ test/corpus/toc/ruby/unicode.B.rb | 7 +++++++ 3 files changed, 16 insertions(+) create mode 100644 test/corpus/toc/ruby/unicode.A.rb create mode 100644 test/corpus/toc/ruby/unicode.B.rb diff --git a/test/TOCSpec.hs b/test/TOCSpec.hs index a0d414812..8be608155 100644 --- a/test/TOCSpec.hs +++ b/test/TOCSpec.hs @@ -46,6 +46,11 @@ spec = parallel $ do diff <- testDiff sourceBlobs diffTOC sourceBlobs diff `shouldBe` [ JSONSummary $ Summarizable C.Function "performHealthCheck" (sourceSpanBetween (8, 1) (29, 2)) "modified" ] + it "handles unicode characters in file" $ do + sourceBlobs <- blobsForPaths (both "ruby/unicode.A.rb" "ruby/unicode.B.rb") + diff <- testDiff sourceBlobs + diffTOC sourceBlobs diff `shouldBe` [ JSONSummary $ Summarizable C.Method "foo" (sourceSpanBetween (6, 1) (7, 4)) "added" ] + prop "only methods and functions are summarized" $ \iden body -> let diff --git a/test/corpus/toc/ruby/unicode.A.rb b/test/corpus/toc/ruby/unicode.A.rb new file mode 100644 index 000000000..890628027 --- /dev/null +++ b/test/corpus/toc/ruby/unicode.A.rb @@ -0,0 +1,4 @@ +# ’ +# RIGHT SINGLE QUOTATION MARK +# Unicode: U+2019, UTF-8: E2 80 99 +"’" diff --git a/test/corpus/toc/ruby/unicode.B.rb b/test/corpus/toc/ruby/unicode.B.rb new file mode 100644 index 000000000..3d59ce4af --- /dev/null +++ b/test/corpus/toc/ruby/unicode.B.rb @@ -0,0 +1,7 @@ +# ’ +# RIGHT SINGLE QUOTATION MARK +# Unicode: U+2019, UTF-8: E2 80 99 +"’" + +def foo(a, b, c) +end