mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Merge pull request #1020 from github/remove-corpus-specs
🔥 corpus specs and fixtures entirely
This commit is contained in:
commit
b9b8f2d04b
@ -139,7 +139,6 @@ test-suite test
|
||||
hs-source-dirs: test
|
||||
main-is: Spec.hs
|
||||
other-modules: AlignmentSpec
|
||||
, CorpusSpec
|
||||
, Data.Mergeable.Spec
|
||||
, Data.RandomWalkSimilarity.Spec
|
||||
, Diff.Spec
|
||||
|
@ -1,101 +0,0 @@
|
||||
{-# LANGUAGE DataKinds, FlexibleContexts, GeneralizedNewtypeDeriving #-}
|
||||
module CorpusSpec where
|
||||
|
||||
import Category
|
||||
import Control.DeepSeq
|
||||
import Data.Functor.Both
|
||||
import Data.List (union)
|
||||
import Data.Record
|
||||
import qualified Data.Text as T
|
||||
import Diffing
|
||||
import GHC.Show (Show(..))
|
||||
import Info
|
||||
import Prologue hiding (fst, snd, lookup)
|
||||
import Parse
|
||||
import Renderer
|
||||
import qualified Renderer.JSON as J
|
||||
import qualified Renderer.Patch as P
|
||||
import qualified Renderer.Split as Split
|
||||
import qualified Source as S
|
||||
import System.FilePath
|
||||
import System.FilePath.Glob
|
||||
import Test.Hspec (Spec, describe, it, SpecWith, runIO, parallel)
|
||||
import Test.Hspec.Expectations.Pretty
|
||||
import Unsafe (unsafeFromJust)
|
||||
|
||||
spec :: Spec
|
||||
spec = parallel $ do
|
||||
describe "crashers crash" . runTestsIn "test/crashers-todo/" $ \ a b ->
|
||||
a `deepseq` pure (a == b) `shouldThrow` anyException
|
||||
describe "crashers should not crash" $ runTestsIn "test/crashers/" shouldBe
|
||||
describe "todos are incorrect" $ runTestsIn "test/diffs-todo/" shouldNotBe
|
||||
describe "should produce the correct diff" $ runTestsIn "test/diffs/" shouldBe
|
||||
|
||||
it "lists example fixtures" $ do
|
||||
examples "test/crashers/" `shouldNotReturn` []
|
||||
examples "test/diffs/" `shouldNotReturn` []
|
||||
|
||||
where
|
||||
runTestsIn :: FilePath -> (Maybe Verbatim -> Maybe Verbatim -> Expectation) -> SpecWith ()
|
||||
runTestsIn directory matcher = do
|
||||
paths <- runIO $ examples directory
|
||||
let tests = correctTests =<< paths
|
||||
traverse_ (\ (formatName, renderer, paths, output) ->
|
||||
it (maybe "/dev/null" normalizeName (uncurry (<|>) (runJoin paths)) ++ " (" ++ formatName ++ ")") $ testDiff renderer paths output matcher) tests
|
||||
|
||||
correctTests paths@(_, _, Nothing, Nothing, Nothing) = testsForPaths paths
|
||||
correctTests paths = filter (\(_, _, _, output) -> isJust output) $ testsForPaths paths
|
||||
testsForPaths (aPath, bPath, json, patch, split) = [ ("json", J.json, paths, json), ("patch", P.patch, paths, patch), ("split", Split.split, paths, split) ]
|
||||
where paths = both aPath bPath
|
||||
|
||||
-- | Return all the examples from the given directory. Examples are expected to
|
||||
-- | have the form "foo.A.js", "foo.B.js", "foo.patch.js". Diffs are not
|
||||
-- | required as the test may be verifying that the inputs don't crash.
|
||||
examples :: FilePath -> IO [(Maybe FilePath, Maybe FilePath, Maybe FilePath, Maybe FilePath, Maybe FilePath)]
|
||||
examples directory = do
|
||||
as <- globFor "*.A.*"
|
||||
bs <- globFor "*.B.*"
|
||||
jsons <- globFor "*.json.*"
|
||||
patches <- globFor "*.patch.*"
|
||||
splits <- globFor "*.split.*"
|
||||
|
||||
let lookupName name = (lookupNormalized name as, lookupNormalized name bs, lookupNormalized name jsons, lookupNormalized name patches, lookupNormalized name splits)
|
||||
|
||||
let keys = (normalizeName <$> as) `union` (normalizeName <$> bs)
|
||||
pure $ lookupName <$> keys
|
||||
where
|
||||
lookupNormalized name = find $ (== name) . normalizeName
|
||||
globFor :: FilePath -> IO [FilePath]
|
||||
globFor p = globDir1 (compile p) directory
|
||||
|
||||
-- | Given a test name like "foo.A.js", return "foo.js".
|
||||
normalizeName :: FilePath -> FilePath
|
||||
normalizeName path = addExtension (dropExtension $ dropExtension path) (takeExtension path)
|
||||
|
||||
-- | Given file paths for A, B, and, optionally, a diff, return whether diffing
|
||||
-- | the files will produce the diff. If no diff is provided, then the result
|
||||
-- | is true, but the diff will still be calculated.
|
||||
testDiff :: Renderer (Record '[Range, Category, SourceSpan]) -> Both (Maybe FilePath) -> Maybe FilePath -> (Maybe Verbatim -> Maybe Verbatim -> Expectation) -> Expectation
|
||||
testDiff renderer paths diff matcher = do
|
||||
sources <- traverse (traverse readAndTranscodeFile) paths
|
||||
actual <- fmap Verbatim <$> traverse ((pure . concatOutputs . pure) <=< diffFiles' sources) parser
|
||||
case diff of
|
||||
Nothing -> matcher actual actual
|
||||
Just file -> do
|
||||
expected <- Verbatim <$> readFile file
|
||||
matcher actual (Just expected)
|
||||
where diffFiles' sources parser = diffFiles parser renderer (sourceBlobs sources paths)
|
||||
parser = parserForFilepath <$> runBothWith (<|>) paths
|
||||
sourceBlobs :: Both (Maybe (S.Source)) -> Both (Maybe FilePath) -> Both S.SourceBlob
|
||||
sourceBlobs sources paths = case runJoin paths of
|
||||
(Nothing, Nothing) -> Join (S.emptySourceBlob "", S.emptySourceBlob "")
|
||||
(Nothing, Just filepath) -> Join (S.emptySourceBlob "", S.sourceBlob (unsafeFromJust $ snd sources) filepath)
|
||||
(Just filepath, Nothing) -> Join (S.sourceBlob (unsafeFromJust $ fst sources) filepath, S.emptySourceBlob "")
|
||||
(Just path1, Just path2) -> Join (S.sourceBlob (unsafeFromJust $ fst sources) path1, S.sourceBlob (unsafeFromJust $ snd sources) path2)
|
||||
|
||||
-- | A wrapper around `Text` with a more readable `Show` instance.
|
||||
newtype Verbatim = Verbatim Text
|
||||
deriving (Eq, NFData)
|
||||
|
||||
instance Show Verbatim where
|
||||
showsPrec _ (Verbatim text) = ('\n':) . (T.unpack text ++)
|
@ -2,7 +2,6 @@ module Main where
|
||||
|
||||
import Prologue
|
||||
import qualified AlignmentSpec
|
||||
import qualified CorpusSpec
|
||||
import qualified Data.Mergeable.Spec
|
||||
import qualified Data.RandomWalkSimilarity.Spec
|
||||
import qualified Diff.Spec
|
||||
@ -19,7 +18,6 @@ import Test.Hspec
|
||||
main :: IO ()
|
||||
main = hspec . parallel $ do
|
||||
describe "Alignment" AlignmentSpec.spec
|
||||
describe "Corpus" CorpusSpec.spec
|
||||
describe "Data.Mergeable" Data.Mergeable.Spec.spec
|
||||
describe "Data.RandomWalkSimilarity" Data.RandomWalkSimilarity.Spec.spec
|
||||
describe "Diff.Spec" Diff.Spec.spec
|
||||
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
// g
|
||||
a: 5
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
// G
|
||||
a: 5
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
a: 5
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
c: 4,
|
||||
a: 5
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"b": 4,
|
||||
"a": 5
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"b": 5,
|
||||
"a": 5
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
a: 1,
|
||||
b: 1
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
b: 1,
|
||||
a: 1
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
if (a &&
|
||||
b) {}
|
@ -1 +0,0 @@
|
||||
if (a && b) {}
|
@ -1,2 +0,0 @@
|
||||
console.log('hello');
|
||||
console.log('world');
|
@ -1,6 +0,0 @@
|
||||
console.log('hello');
|
||||
|
||||
|
||||
|
||||
|
||||
console.log('world');
|
@ -1,31 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">2</td><td class="blob-code"><ul class="category-program">
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">3</td><td class="blob-code"><ul class="category-program">
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">4</td><td class="blob-code"><ul class="category-program">
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">5</td><td class="blob-code"><ul class="category-program">
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">2</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'world'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
<td class="blob-num">6</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'world'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">3</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
<td class="blob-num">7</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"b": 4,
|
||||
"a": 5
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"b": 5,
|
||||
"a": 5
|
||||
}
|
@ -1 +0,0 @@
|
||||
{"oids":["0000000000000000000000000000000000000000","0000000000000000000000000000000000000000"],"paths":["test/diffs/dictionary.A.js","test/diffs/dictionary.B.js"],"rows":[[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[],"range":[0,2]}],"range":[0,2]}],"range":[0,2]}],"hasChanges":false,"range":[0,2],"number":1},{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[],"range":[0,2]}],"range":[0,2]}],"range":[0,2]}],"hasChanges":false,"range":[0,2],"number":1}],[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[{"category":"Pair","children":[{"category":"StringLiteral","range":[4,7]},{"category":"NumberLiteral","patch":"replace","range":[9,10]}],"range":[4,10]}],"range":[2,12]}],"range":[2,12]}],"range":[2,12]}],"hasChanges":true,"range":[2,12],"number":2},{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[{"category":"Pair","children":[{"category":"StringLiteral","range":[4,7]},{"category":"NumberLiteral","patch":"replace","range":[9,10]}],"range":[4,10]}],"range":[2,12]}],"range":[2,12]}],"range":[2,12]}],"hasChanges":true,"range":[2,12],"number":2}],[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[{"category":"Pair","children":[{"category":"StringLiteral","range":[14,17]},{"category":"NumberLiteral","range":[19,20]}],"range":[14,20]}],"range":[12,21]}],"range":[12,21]}],"range":[12,21]}],"hasChanges":false,"range":[12,21],"number":3},{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[{"category":"Pair","children":[{"category":"StringLiteral","range":[14,17]},{"category":"NumberLiteral","range":[19,20]}],"range":[14,20]}],"range":[12,21]}],"range":[12,21]}],"range":[12,21]}],"hasChanges":false,"range":[12,21],"number":3}],[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[],"range":[21,22]}],"range":[21,23]}],"range":[21,23]}],"hasChanges":false,"range":[21,23],"number":4},{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"Object","children":[],"range":[21,22]}],"range":[21,23]}],"range":[21,23]}],"hasChanges":false,"range":[21,23],"number":4}],[{"terms":[{"category":"Program","children":[],"range":[23,23]}],"hasChanges":false,"range":[23,23],"number":5},{"terms":[{"category":"Program","children":[],"range":[23,23]}],"hasChanges":false,"range":[23,23],"number":5}]]}
|
@ -1,10 +0,0 @@
|
||||
diff --git a/test/diffs/dictionary.A.js b/test/diffs/dictionary.B.js
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/test/diffs/dictionary.A.js
|
||||
+++ b/test/diffs/dictionary.B.js
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
- "b": 4,
|
||||
+ "b": 5,
|
||||
"a": 5
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object">{
|
||||
</ul></li></ul></li></ul></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object">{
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-replacement">2</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object"> <li><ul class="category-pair"><li><span class="category-string">"b"</span></li>: <li><div class="patch replace"><span class="category-number">4</span></div></li></ul></li>,
|
||||
</ul></li></ul></li></ul></td>
|
||||
<td class="blob-num blob-num-replacement">2</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object"> <li><ul class="category-pair"><li><span class="category-string">"b"</span></li>: <li><div class="patch replace"><span class="category-number">5</span></div></li></ul></li>,
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">3</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object"> <li><ul class="category-pair"><li><span class="category-string">"a"</span></li>: <li><span class="category-number">5</span></li></ul></li>
|
||||
</ul></li></ul></li></ul></td>
|
||||
<td class="blob-num">3</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object"> <li><ul class="category-pair"><li><span class="category-string">"a"</span></li>: <li><span class="category-number">5</span></li></ul></li>
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">4</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object">}</ul></li>
|
||||
</ul></li></ul></td>
|
||||
<td class="blob-num">4</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-object">}</ul></li>
|
||||
</ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">5</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
<td class="blob-num">5</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
@ -1,3 +0,0 @@
|
||||
diff --git a/test/diffs/file-addition.B.js b/test/diffs/file-addition.B.js
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
@ -1,3 +0,0 @@
|
||||
diff --git a/test/diffs/file-deletion.A.js b/test/diffs/file-deletion.A.js
|
||||
deleted file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
@ -1 +0,0 @@
|
||||
console.log('hello');
|
@ -1,2 +0,0 @@
|
||||
console.log('hello');
|
||||
console.log('world');
|
@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num blob-num-replacement">2</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><div class="patch insert"><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'world'</span></li>)</ul></li>;</ul></div></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">2</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
<td class="blob-num">3</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
@ -1,27 +0,0 @@
|
||||
define( function() {
|
||||
|
||||
// We have to close these tags to support XHTML (#13200)
|
||||
var wrapMap = {
|
||||
|
||||
// Support: IE9
|
||||
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
||||
|
||||
// XHTML parsers do not magically insert elements in the
|
||||
// same way that tag soup parsers do. So we cannot shorten
|
||||
// this by omitting <tbody> or other required elements.
|
||||
thead: [ 1, "<table>", "</table>" ],
|
||||
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
|
||||
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
||||
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
||||
|
||||
_default: [ 0, "", "" ]
|
||||
};
|
||||
|
||||
// Support: IE9
|
||||
wrapMap.optgroup = wrapMap.option;
|
||||
|
||||
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
||||
wrapMap.th = wrapMap.td;
|
||||
|
||||
return wrapMap;
|
||||
} );
|
@ -1,27 +0,0 @@
|
||||
define( function() {
|
||||
|
||||
// We have to close these tags to support XHTML (#13200)
|
||||
var wrapMap = {
|
||||
|
||||
// Support: IE <=9 only
|
||||
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
||||
|
||||
// XHTML parsers do not magically insert elements in the
|
||||
// same way that tag soup parsers do. So we cannot shorten
|
||||
// this by omitting <tbody> or other required elements.
|
||||
thead: [ 1, "<table>", "</table>" ],
|
||||
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
|
||||
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
||||
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
||||
|
||||
_default: [ 0, "", "" ]
|
||||
};
|
||||
|
||||
// Support: IE <=9 only
|
||||
wrapMap.optgroup = wrapMap.option;
|
||||
|
||||
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
||||
wrapMap.th = wrapMap.td;
|
||||
|
||||
return wrapMap;
|
||||
} );
|
@ -1,22 +0,0 @@
|
||||
diff --git a/test/diffs/jquery.A.js b/test/diffs/jquery.B.js
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/test/diffs/jquery.A.js
|
||||
+++ b/test/diffs/jquery.B.js
|
||||
@@ -3,7 +3,7 @@
|
||||
// We have to close these tags to support XHTML (#13200)
|
||||
var wrapMap = {
|
||||
|
||||
- // Support: IE9
|
||||
+ // Support: IE <=9 only
|
||||
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
||||
|
||||
// XHTML parsers do not magically insert elements in the
|
||||
@@ -17,7 +17,7 @@
|
||||
_default: [ 0, "", "" ]
|
||||
};
|
||||
|
||||
- // Support: IE9
|
||||
+ // Support: IE <=9 only
|
||||
wrapMap.optgroup = wrapMap.option;
|
||||
|
||||
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
@ -1,2 +0,0 @@
|
||||
console.log('hello');
|
||||
console.log('world');
|
@ -1,5 +0,0 @@
|
||||
console.log('hello');
|
||||
if (true) {
|
||||
console.log('cruel');
|
||||
}
|
||||
console.log('world');
|
@ -1,27 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num blob-num-replacement">2</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><div class="patch insert"><ul class="category-if_statement">if (<li><span class="category-boolean">true</span></li>) <li><ul class="category-expression_statements">{
|
||||
</ul></li></ul></div></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num blob-num-replacement">3</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><div class="patch insert"><ul class="category-if_statement"><li><ul class="category-expression_statements"> <li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'cruel'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></li></ul></div></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num blob-num-replacement">4</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><div class="patch insert"><ul class="category-if_statement"><li><ul class="category-expression_statements">}</ul></li></ul></div></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">2</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'world'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
<td class="blob-num">5</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'world'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">3</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
<td class="blob-num">6</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
@ -1,13 +0,0 @@
|
||||
define( function() {
|
||||
console.log("foo");
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
console.log("bar");
|
||||
});
|
@ -1,13 +0,0 @@
|
||||
define( function() {
|
||||
console.log("bar");
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
console.log("foo");
|
||||
});
|
@ -1,18 +0,0 @@
|
||||
diff --git a/test/diffs/multiple-hunks.A.js b/test/diffs/multiple-hunks.B.js
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/test/diffs/multiple-hunks.A.js
|
||||
+++ b/test/diffs/multiple-hunks.B.js
|
||||
@@ -1,5 +1,5 @@
|
||||
define( function() {
|
||||
- console.log("foo");
|
||||
+ console.log("bar");
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
@@ -9,6 +9,6 @@
|
||||
// A comment
|
||||
// Another comment
|
||||
// Another comment
|
||||
- console.log("bar");
|
||||
+ console.log("foo");
|
||||
});
|
@ -1,3 +0,0 @@
|
||||
if (true) {
|
||||
console.log('hello');
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
if (true) {
|
||||
console.log('hello');
|
||||
console.log('world');
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-if_statement">if (<li><span class="category-boolean">true</span></li>) <li><ul class="category-expression_statements">{
|
||||
</ul></li></ul></li></ul></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-if_statement">if (<li><span class="category-boolean">true</span></li>) <li><ul class="category-expression_statements">{
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">2</td><td class="blob-code"><ul class="category-program"><li><ul class="category-if_statement"><li><ul class="category-expression_statements"> <li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></li></ul></li></ul></td>
|
||||
<td class="blob-num">2</td><td class="blob-code"><ul class="category-program"><li><ul class="category-if_statement"><li><ul class="category-expression_statements"> <li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'hello'</span></li>)</ul></li>;</ul></li>
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num blob-num-replacement">3</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><ul class="category-if_statement"><li><ul class="category-expression_statements"> <li><div class="patch insert"><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">'world'</span></li>)</ul></li>;</ul></div></li>
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">3</td><td class="blob-code"><ul class="category-program"><li><ul class="category-if_statement"><li><ul class="category-expression_statements">}</ul></li></ul></li>
|
||||
</ul></td>
|
||||
<td class="blob-num">4</td><td class="blob-code"><ul class="category-program"><li><ul class="category-if_statement"><li><ul class="category-expression_statements">}</ul></li></ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">4</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
<td class="blob-num">5</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
@ -1 +0,0 @@
|
||||
console.log("hello, world");
|
@ -1,3 +0,0 @@
|
||||
console.log("hello, world");
|
||||
|
||||
console.log("insertion");
|
@ -1 +0,0 @@
|
||||
{"oids":["0000000000000000000000000000000000000000","0000000000000000000000000000000000000000"],"paths":["test/diffs/newline-at-eof.A.js","test/diffs/newline-at-eof.B.js"],"rows":[[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"FunctionCall","children":[{"category":"Identifier","range":[0,7]},{"category":"Identifier","range":[8,11]},{"category":"StringLiteral","range":[12,26]}],"range":[0,27]}],"range":[0,28]}],"range":[0,29]}],"hasChanges":false,"range":[0,29],"number":1},{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"FunctionCall","children":[{"category":"Identifier","range":[0,7]},{"category":"Identifier","range":[8,11]},{"category":"StringLiteral","range":[12,26]}],"range":[0,27]}],"range":[0,28]}],"range":[0,29]}],"hasChanges":false,"range":[0,29],"number":1}],[{"terms":[{"category":"Program","children":[],"range":[29,29]}],"hasChanges":false,"range":[29,29],"number":2},{"terms":[{"category":"Program","children":[],"range":[29,30]}],"hasChanges":false,"range":[29,30],"number":2}],[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"FunctionCall","children":[{"category":"Identifier","range":[30,37]},{"category":"Identifier","range":[38,41]},{"category":"StringLiteral","range":[42,53]}],"range":[30,54]}],"patch":"insert","range":[30,55]}],"range":[30,56]}],"hasChanges":true,"range":[30,56],"number":3}],[{"terms":[{"category":"Program","children":[],"range":[56,56]}],"hasChanges":false,"range":[56,56],"number":4}]]}
|
@ -1,8 +0,0 @@
|
||||
diff --git a/test/diffs/newline-at-eof.A.js b/test/diffs/newline-at-eof.B.js
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/test/diffs/newline-at-eof.A.js
|
||||
+++ b/test/diffs/newline-at-eof.B.js
|
||||
@@ -1,2 +1,4 @@
|
||||
console.log("hello, world");
|
||||
|
||||
+console.log("insertion");
|
@ -1,18 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">"hello, world"</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">"hello, world"</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">2</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
<td class="blob-num">2</td><td class="blob-code"><ul class="category-program">
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num blob-num-replacement">3</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><div class="patch insert"><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">"insertion"</span></li>)</ul></li>;</ul></div></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">4</td><td class="blob-code"><ul class="category-program"></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
@ -1 +0,0 @@
|
||||
console.log("hello, world");
|
@ -1,3 +0,0 @@
|
||||
console.log("hello, world");
|
||||
|
||||
console.log("insertion");
|
@ -1 +0,0 @@
|
||||
{"oids":["0000000000000000000000000000000000000000","0000000000000000000000000000000000000000"],"paths":["test/diffs/no-newline-at-eof.A.js","test/diffs/no-newline-at-eof.B.js"],"rows":[[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"FunctionCall","children":[{"category":"Identifier","range":[0,7]},{"category":"Identifier","range":[8,11]},{"category":"StringLiteral","range":[12,26]}],"range":[0,27]}],"range":[0,28]}],"range":[0,28]}],"hasChanges":false,"range":[0,28],"number":1},{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"FunctionCall","children":[{"category":"Identifier","range":[0,7]},{"category":"Identifier","range":[8,11]},{"category":"StringLiteral","range":[12,26]}],"range":[0,27]}],"range":[0,28]}],"range":[0,29]}],"hasChanges":false,"range":[0,29],"number":1}],[{"terms":[{"category":"Program","children":[],"range":[29,30]}],"hasChanges":false,"range":[29,30],"number":2}],[{"terms":[{"category":"Program","children":[{"category":"ExpressionStatements","children":[{"category":"FunctionCall","children":[{"category":"Identifier","range":[30,37]},{"category":"Identifier","range":[38,41]},{"category":"StringLiteral","range":[42,53]}],"range":[30,54]}],"patch":"insert","range":[30,55]}],"range":[30,55]}],"hasChanges":true,"range":[30,55],"number":3}]]}
|
@ -1,9 +0,0 @@
|
||||
diff --git a/test/diffs/no-newline-at-eof.A.js b/test/diffs/no-newline-at-eof.B.js
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/test/diffs/no-newline-at-eof.A.js
|
||||
+++ b/test/diffs/no-newline-at-eof.B.js
|
||||
@@ -1,1 +1,3 @@
|
||||
console.log("hello, world");
|
||||
|
||||
+console.log("insertion");
|
||||
\ No newline at end of file
|
@ -1,13 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">"hello, world"</span></li>)</ul></li>;</ul></li></ul></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">"hello, world"</span></li>)</ul></li>;</ul></li>
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">2</td><td class="blob-code"><ul class="category-program">
|
||||
</ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num blob-num-replacement">3</td><td class="blob-code blob-code-replacement"><ul class="category-program"><li><div class="patch insert"><ul class="category-expression_statements"><li><ul class="category-function_call"><li><span class="category-identifier">console</span></li>.<li><span class="category-identifier">log</span></li>(<li><span class="category-string">"insertion"</span></li>)</ul></li>;</ul></div></li></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
@ -1 +0,0 @@
|
||||
[ bar ];
|
@ -1,3 +0,0 @@
|
||||
[
|
||||
bar
|
||||
];
|
@ -1,13 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><table class="diff"><colgroup><col width="40"><col><col width="40"><col></colgroup><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-array">[
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num">1</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-array">[ <li><span class="category-identifier">bar</span></li> ]</ul></li>;</ul></li></ul></td>
|
||||
<td class="blob-num">2</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-array"> <li><span class="category-identifier">bar</span></li>
|
||||
</ul></li></ul></li></ul></td>
|
||||
|
||||
</tr><tr><td class="blob-num blob-num-empty empty-cell"></td><td class="blob-code blob-code-empty empty-cell"></td>
|
||||
<td class="blob-num">3</td><td class="blob-code"><ul class="category-program"><li><ul class="category-expression_statements"><li><ul class="category-array">]</ul></li>;</ul></li></ul></td>
|
||||
|
||||
</tr></table></body></html>
|
Loading…
Reference in New Issue
Block a user