Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 086947a

Browse files
author
Patrick Thomson
committed
Add golden tests for parse --proto-symbols output.
This should help us ensure that we don't break CLI output, since our CLI is an API. This was made super-easy thanks to `tasty-golden`. I literally added those two lines of code and it automatically created the reference `.protobuf.bin` files. Slick as hell.
1 parent b62277f commit 086947a

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

test/Semantic/CLI/Spec.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ parseFixtures =
5353
, ("json", parseTermBuilder TermJSONTree, path', prefix </> "parse-trees.json")
5454
, ("json", parseTermBuilder TermJSONTree, [], prefix </> "parse-tree-empty.json")
5555
, ("symbols", parseSymbolsBuilder Serializing.Format.JSON, path'', prefix </> "parse-tree.symbols.json")
56+
, ("protobuf symbols", parseSymbolsBuilder Serializing.Format.Proto, path'', prefix </> "parse-tree.symbols.protobuf.bin")
5657
]
5758
where path = [File "test/fixtures/ruby/corpus/and-or.A.rb" Ruby]
5859
path' = [File "test/fixtures/ruby/corpus/and-or.A.rb" Ruby, File "test/fixtures/ruby/corpus/and-or.B.rb" Ruby]
@@ -64,6 +65,7 @@ diffFixtures =
6465
[ ("json diff", parseDiffBuilder DiffJSONTree, pathMode, prefix </> "diff-tree.json")
6566
, ("s-expression diff", parseDiffBuilder DiffSExpression, pathMode, "test/fixtures/ruby/corpus/method-declaration.diffA-B.txt")
6667
, ("toc summaries diff", diffSummaryBuilder Serializing.Format.JSON, pathMode, prefix </> "diff-tree.toc.json")
68+
, ("protobuf diff", diffSummaryBuilder Serializing.Format.Proto, pathMode, prefix </> "diff-tree.toc.protobuf.bin")
6769
]
6870
where pathMode = [Both (File "test/fixtures/ruby/corpus/method-declaration.A.rb" Ruby) (File "test/fixtures/ruby/corpus/method-declaration.B.rb" Ruby)]
6971
prefix = "test/fixtures/cli"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
�
3+
ftest/fixtures/ruby/corpus/method-declaration.A.rb -> test/fixtures/ruby/corpus/method-declaration.B.rbRuby
4+
Methodbar
5+
 
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
_
3+
1test/fixtures/ruby/corpus/method-declaration.A.rbRuby$
4+
fooMethoddef foo"
5+


0 commit comments

Comments
 (0)