mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
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.
This commit is contained in:
parent
b62277f9b6
commit
086947ade5
@ -53,6 +53,7 @@ parseFixtures =
|
||||
, ("json", parseTermBuilder TermJSONTree, path', prefix </> "parse-trees.json")
|
||||
, ("json", parseTermBuilder TermJSONTree, [], prefix </> "parse-tree-empty.json")
|
||||
, ("symbols", parseSymbolsBuilder Serializing.Format.JSON, path'', prefix </> "parse-tree.symbols.json")
|
||||
, ("protobuf symbols", parseSymbolsBuilder Serializing.Format.Proto, path'', prefix </> "parse-tree.symbols.protobuf.bin")
|
||||
]
|
||||
where path = [File "test/fixtures/ruby/corpus/and-or.A.rb" Ruby]
|
||||
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 =
|
||||
[ ("json diff", parseDiffBuilder DiffJSONTree, pathMode, prefix </> "diff-tree.json")
|
||||
, ("s-expression diff", parseDiffBuilder DiffSExpression, pathMode, "test/fixtures/ruby/corpus/method-declaration.diffA-B.txt")
|
||||
, ("toc summaries diff", diffSummaryBuilder Serializing.Format.JSON, pathMode, prefix </> "diff-tree.toc.json")
|
||||
, ("protobuf diff", diffSummaryBuilder Serializing.Format.Proto, pathMode, prefix </> "diff-tree.toc.protobuf.bin")
|
||||
]
|
||||
where pathMode = [Both (File "test/fixtures/ruby/corpus/method-declaration.A.rb" Ruby) (File "test/fixtures/ruby/corpus/method-declaration.B.rb" Ruby)]
|
||||
prefix = "test/fixtures/cli"
|
||||
|
5
test/fixtures/cli/diff-tree.toc.protobuf.bin
vendored
Normal file
5
test/fixtures/cli/diff-tree.toc.protobuf.bin
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
<EFBFBD>
|
||||
ftest/fixtures/ruby/corpus/method-declaration.A.rb -> test/fixtures/ruby/corpus/method-declaration.B.rbRuby
|
||||
Methodbar
|
||||
|
5
test/fixtures/cli/parse-tree.symbols.protobuf.bin
vendored
Normal file
5
test/fixtures/cli/parse-tree.symbols.protobuf.bin
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
_
|
||||
1test/fixtures/ruby/corpus/method-declaration.A.rbRuby$
|
||||
fooMethoddef foo"
|
||||
|
Loading…
Reference in New Issue
Block a user