mirror of
https://github.com/github/semantic.git
synced 2024-12-24 15:35:14 +03:00
Use new example repository for integration testing
This commit is contained in:
parent
980b6c95bc
commit
54029595b0
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,6 +8,8 @@ xcuserdata
|
||||
profiles
|
||||
tags
|
||||
|
||||
tmp/
|
||||
|
||||
vendor/icu/tools
|
||||
vendor/icu/lib
|
||||
vendor/icu/layoutex
|
||||
|
@ -21,31 +21,25 @@ spec :: Spec
|
||||
spec = parallel $ do
|
||||
describe "fetchDiffs" $ do
|
||||
it "generates diff summaries for two shas" $ do
|
||||
(errors, summaries) <- getSummaryOutput $ args "test/fixtures/git/examples/ruby.git" "03d0b4db2c6f47c1bb440b9d886a77671e8db340" "5cf7a3421535e139c9a9e47f823db037df3248f6" ["methods.rb"] Renderer.Summary
|
||||
(errors, summaries) <- getOutput summaryText $ args "test/fixtures/git/examples/all-languages.git" "dfac8fd681b0749af137aebf3203e77a06fbafc2" "2e4144eb8c44f007463ec34cb66353f0041161fe" ["methods.rb"] Renderer.Summary
|
||||
errors `shouldBe` Just (fromList [])
|
||||
summaries `shouldBe` Just (fromList [("methods.rb", ["Added the 'foo()' method"])])
|
||||
|
||||
it "generates toc summaries for two shas" $ do
|
||||
(errors, summaries) <- getTOCOutput $ args "test/fixtures/git/examples/ruby.git" "03d0b4db2c6f47c1bb440b9d886a77671e8db340" "5cf7a3421535e139c9a9e47f823db037df3248f6" ["methods.rb"] Renderer.TOC
|
||||
(errors, summaries) <- getOutput termText $ args "test/fixtures/git/examples/all-languages.git" "dfac8fd681b0749af137aebf3203e77a06fbafc2" "2e4144eb8c44f007463ec34cb66353f0041161fe" ["methods.rb"] Renderer.TOC
|
||||
errors `shouldBe` Just (fromList [])
|
||||
summaries `shouldBe` Just (fromList [("methods.rb", ["foo"])])
|
||||
|
||||
xit "is ok with bad shas" $ do
|
||||
(errors, summaries) <- getSummaryOutput $ args "test/fixtures/git/examples/ruby.git" "dead" "beef" ["methods.rb"] Renderer.Summary
|
||||
(errors, summaries) <- getOutput summaryText $ args "test/fixtures/git/examples/all-languages.git" "dead" "beef" ["methods.rb"] Renderer.Summary
|
||||
errors `shouldBe` Just (fromList [])
|
||||
summaries `shouldBe` Just (fromList [("methods.rb", ["Added the 'foo()' method"])])
|
||||
|
||||
getSummaryOutput :: Arguments -> IO (Maybe (Map Text Value), Maybe (Map Text [Text]))
|
||||
getSummaryOutput arguments = do
|
||||
getOutput :: (Object -> Text) -> Arguments -> IO (Maybe (Map Text Value), Maybe (Map Text [Text]))
|
||||
getOutput f arguments = do
|
||||
diffs <- fetchDiffs arguments
|
||||
let json = fromJust . decode . E.encodeUtf8 $ T.fromChunks [concatOutputs diffs]
|
||||
pure (errors json, summaries summaryText json)
|
||||
|
||||
getTOCOutput :: Arguments -> IO (Maybe (Map Text Value), Maybe (Map Text [Text]))
|
||||
getTOCOutput arguments = do
|
||||
diffs <- fetchDiffs arguments
|
||||
let json = fromJust . decode . E.encodeUtf8 $ T.fromChunks [concatOutputs diffs]
|
||||
pure (errors json, summaries termText json)
|
||||
pure (errors json, summaries f json)
|
||||
|
||||
-- Diff Summaries payloads look like this:
|
||||
-- {
|
||||
@ -75,8 +69,5 @@ termText :: Object -> Text
|
||||
termText o = fromMaybe (panic "key 'term' not found") $
|
||||
parseMaybe (.: "term") o
|
||||
|
||||
textForKey key o = fromMaybe (panic "key '" <> key <> "' not found") $
|
||||
parseMaybe (.: key) o
|
||||
|
||||
errors :: Object -> Maybe (Map Text Value)
|
||||
errors = parseMaybe (.: "errors")
|
||||
|
1
test/fixtures/git/examples/all-languages.git/HEAD
vendored
Normal file
1
test/fixtures/git/examples/all-languages.git/HEAD
vendored
Normal file
@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
6
test/fixtures/git/examples/all-languages.git/config
vendored
Normal file
6
test/fixtures/git/examples/all-languages.git/config
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
1
test/fixtures/git/examples/all-languages.git/info/refs
vendored
Normal file
1
test/fixtures/git/examples/all-languages.git/info/refs
vendored
Normal file
@ -0,0 +1 @@
|
||||
2e4144eb8c44f007463ec34cb66353f0041161fe refs/heads/master
|
2
test/fixtures/git/examples/all-languages.git/objects/info/packs
vendored
Normal file
2
test/fixtures/git/examples/all-languages.git/objects/info/packs
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
P pack-5780c6ea9558e3f68939b63e4f2365eb390e658d.pack
|
||||
|
Binary file not shown.
Binary file not shown.
2
test/fixtures/git/examples/all-languages.git/packed-refs
vendored
Normal file
2
test/fixtures/git/examples/all-languages.git/packed-refs
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# pack-refs with: peeled fully-peeled
|
||||
2e4144eb8c44f007463ec34cb66353f0041161fe refs/heads/master
|
Loading…
Reference in New Issue
Block a user