diff --git a/.atom-build.yml b/.atom-build.yml index ff05c8224..6daeb5720 100644 --- a/.atom-build.yml +++ b/.atom-build.yml @@ -1,15 +1,11 @@ # Build configuration for https://atom.io/packages/build -cmd: stack build semantic-diff +cmd: stack build name: semantic-diff env: PATH: ~/.local/bin:~/Developer/Tools:~/Library/Haskell/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin targets: test: - cmd: stack build :semantic-diff-test + cmd: stack build :integration-test keymap: cmd-u - semantic-difftool: - cmd: stack build :semantic-difftool - semantic-git-diff: - cmd: stack build :semantic-git-diff errorMatch: - \n(?/[^:]+):(?\d+):((?\d+):)? diff --git a/.gitattributes b/.gitattributes index 663e9664c..ed17c0b5f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,4 +2,5 @@ test/diffs linguist-vendored test/diffs-todo linguist-vendored test/crashers linguist-vendored test/crashers-todo linguist-vendored +test/repos linguist-vendored vendor linguist-vendored diff --git a/.gitmodules b/.gitmodules index a099eb42c..e137d593d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,48 @@ -[submodule "vendor/tree-sitter-parsers"] - path = vendor/tree-sitter-parsers - url = git@github.com:github/tree-sitter-parsers.git [submodule "vendor/text-icu"] path = vendor/text-icu url = https://github.com/joshvera/text-icu [submodule "vendor/gitlib"] path = vendor/gitlib url = https://github.com/joshvera/gitlib +[submodule "test/repos/jquery"] + path = test/repos/jquery + url = https://github.com/jquery/jquery +[submodule "test/repos/js-test"] + path = test/repos/js-test + url = https://github.com/rewinfrey/js-test.git +[submodule "test/repos/backbone"] + path = test/repos/backbone + url = https://github.com/jashkenas/backbone +[submodule "test/corpus/repos/javascript"] + path = test/corpus/repos/javascript + url = https://github.com/diff-fixtures/javascript +[submodule "vendor/hspec-expectations-pretty-diff"] + path = vendor/hspec-expectations-pretty-diff + url = https://github.com/rewinfrey/hspec-expectations-pretty-diff +[submodule "test/corpus/repos/go"] + path = test/corpus/repos/go + url = https://github.com/diff-fixtures/go.git +[submodule "test/corpus/repos/ruby"] + path = test/corpus/repos/ruby + url = https://github.com/diff-fixtures/ruby.git +[submodule "vendor/effects"] + path = vendor/effects + url = https://github.com/joshvera/effects.git +[submodule "languages/ruby/vendor/tree-sitter-ruby"] + path = languages/ruby/vendor/tree-sitter-ruby + url = https://github.com/tree-sitter/tree-sitter-ruby.git +[submodule "languages/c/vendor/tree-sitter-c"] + path = languages/c/vendor/tree-sitter-c + url = https://github.com/tree-sitter/tree-sitter-c.git +[submodule "languages/go/vendor/tree-sitter-go"] + path = languages/go/vendor/tree-sitter-go + url = https://github.com/tree-sitter/tree-sitter-go.git +[submodule "languages/javascript/vendor/tree-sitter-javascript"] + path = languages/javascript/vendor/tree-sitter-javascript + url = https://github.com/tree-sitter/tree-sitter-javascript.git +[submodule "vendor/haskell-tree-sitter"] + path = vendor/haskell-tree-sitter + url = https://github.com/tree-sitter/haskell-tree-sitter.git +[submodule "test/corpus/profile"] + path = test/corpus/profile + url = https://github.com/diff-fixtures/profile.git diff --git a/HLint.hs b/HLint.hs new file mode 100644 index 000000000..9fbf296e6 --- /dev/null +++ b/HLint.hs @@ -0,0 +1,19 @@ +import "hint" HLint.Default +import "hint" HLint.Dollar +import "hint" HLint.Generalise + +ignore "Use mappend" +error "generalize ++" = (++) ==> (<>) +-- AMP fallout +error "generalize mapM" = mapM ==> traverse +error "generalize mapM_" = mapM_ ==> traverse_ +error "generalize forM" = forM ==> for +error "generalize forM_" = forM_ ==> for_ +error "Avoid return" = + return ==> pure + where note = "return is obsolete as of GHC 7.10" + +error "use pure" = free . Pure ==> pure +error "use wrap" = free . Free ==> wrap + +error "use extract" = headF . runCofree ==> extract diff --git a/ROADMAP.md b/ROADMAP.md index a793ab7f0..7aa40435a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,17 +1,50 @@ -# Semantic diff roadmap +# Roadmap -## Q1 2016 +This is the long form version of our [roadmap project][]. -1. [Staff ship & limited beta of semantic diffing on .com](https://github.com/github/semantic-diff/milestones/Staff%20Ship). This will be an opt-in, limited release of semantic diffs for a very small set of languages. UI in general will be unchanged; we’ll simply start showing better diffs for the languages in question. The goal is to ease ourselves into deployment of the system, and benchmark under real loads. +## Things we are currently doing: -2. [Semantic diffing on .com](https://github.com/github/semantic-diff/milestones/Dot%20Calm). General release of semantic diffs for the supported languages. +1. [Diff summaries][] for C & JavaScript. Q3 2016 or so. + - Modelling the abstract semantics of the supported languages. Good summaries require us to know what different parts of the syntax represent. + - Performance/responsiveness. We need to be able to produce diffs more quickly, and without unicorns. Some of this will involve front-end work (e.g. requesting summaries out-of-band). -## Q2–Q4 2016 +2. [Semantic diffs][] on .com for C & JavaScript. Q4 2016 or so. -We will discuss future milestones at the **@github/network-intelligence** minisummit mid-Q1 2016, and document them here at that point. - + - Performance, as above. + - Resilience. A fault in `semantic-diff` should not break anything else. + - Metrics. We need to know how it’s behaving in the wild to know what to do about it. This also includes operational metrics such as health checks. -## Ongoing +## Follow-up things: -- Creation, curation, and cultivation of grammars for semantic diffs. +1. Add support for more languages: [Ruby][], etc. +2. [Detecting & rendering moves][moves]. +3. [Merging][]. +4. Refining the diff summaries we produce. + +## Things we would like to do: + +1. [Interactively refining diffs][interactive]. +2. [Filtering][] diffs. +3. Diff [table of contents][]. +4. [Jump to symbol definition][]. +5. Eliminate conflicts from renaming [variables][]. + +## Things we would like to do modulo interest/support from other teams: + +1. APIs/tooling for data science & engineering teams. +2. Collect data on our heuristics &c. and refine them via e.g. ML. +3. Diffs as a [service][]. + +[roadmap project]: https://github.com/github/semantic-diff/projects/5 +[Diff summaries]: https://github.com/github/semantic-diff/milestones/Summer%20Eyes +[Semantic diffs]: https://github.com/github/semantic-diff/milestones/Dot%20Calm +[Ruby]: https://github.com/github/semantic-diff/issues/282 +[moves]: https://github.com/github/semantic-diff/issues/389 +[Merging]: https://github.com/github/semantic-diff/issues/431 +[interactive]: https://github.com/github/semantic-diff/issues/130 +[Filtering]: https://github.com/github/semantic-diff/issues/428 +[table of contents]: https://github.com/github/semantic-diff/issues/16 +[Jump to symbol definition]: https://github.com/github/semantic-diff/issues/6 +[variables]: https://github.com/github/semantic-diff/issues/91 +[service]: https://github.com/github/platform/blob/master/services/README.md diff --git a/UI/.gitignore b/UI/.gitignore new file mode 100644 index 000000000..2d19fc766 --- /dev/null +++ b/UI/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/app/GenerateTestCases.hs b/app/GenerateTestCases.hs new file mode 100644 index 000000000..1e1bf71ef --- /dev/null +++ b/app/GenerateTestCases.hs @@ -0,0 +1,376 @@ +{-# LANGUAGE LambdaCase, GADTs, DataKinds #-} +module Main where + +import Arguments +import Control.Exception +import Data.Aeson +import Data.Aeson.Encode.Pretty +import Data.Map.Strict as Map +import qualified Data.ByteString.Lazy as DL +import qualified Data.ByteString.Char8 as DC +import Data.String +import qualified Data.Text as DT +import JSONTestCase +import qualified Prelude +import Prologue +import SemanticDiff (fetchDiffs) +import System.FilePath.Glob +import System.Process +import qualified Data.String.Utils as DSUtils +import Options.Applicative hiding ((<>)) +import qualified Options.Applicative as O +import qualified Renderer as R +import Control.Monad.Effect +import Control.Monad.Effect.Internal + +data GenerateFormat = + GenerateSummaries + | GenerateJSON + deriving (Show) + +data GeneratorArgs = GeneratorArgs { generateFormat :: GenerateFormat } deriving (Show) + +generatorArgs :: Parser GeneratorArgs +generatorArgs = GeneratorArgs + <$> (flag' GenerateSummaries (long "generate-summaries" O.<> short 's' O.<> help "Generates summary results for new JSON test cases") + <|> flag' GenerateJSON (long "generate-json" O.<> short 'j' O.<> help "Generate JSON output for new JSON test cases")) + +options :: ParserInfo GeneratorArgs +options = info (helper <*> generatorArgs) (fullDesc O.<> progDesc "Auto-generate JSON test cases" O.<> header "JSON Test Case Generator") + +main :: IO () +main = do + opts <- execParser options + generatorFilePaths <- runFetchGeneratorFiles + metaRepos <- traverse DL.readFile generatorFilePaths + + for_ (decodeMetaRepos metaRepos) (handle opts generatorFilePaths) + + where decodeMetaRepos :: [DL.ByteString] -> [Either String [JSONMetaRepo]] + decodeMetaRepos metaRepos = eitherDecode <$> metaRepos + + handle :: GeneratorArgs -> [FilePath] -> Either String [JSONMetaRepo] -> IO () + handle opts generatorFilePaths decodedMetaRepos = + case decodedMetaRepos of + Left err -> Prelude.putStrLn $ "An error occurred: " <> err + Right metaRepos -> do + traverse_ (runGenerator opts) metaRepos + traverse_ runMoveGeneratorFile generatorFilePaths + +-- | Finds all JSON files within the generators directory. +runFetchGeneratorFiles :: IO [FilePath] +runFetchGeneratorFiles = globDir1 (compile "*.json") "test/corpus/generators" + +-- | First initialize the git submodule repository where commits will be made for the given metaRepo and its syntaxes. +-- | Second generate the commits for each syntax and generate the associated JSONTestCase objects. +-- | Finally push the generated commits to the submodule's remote repository. +runGenerator :: GeneratorArgs -> JSONMetaRepo -> IO () +runGenerator opts metaRepo@JSONMetaRepo{..} = do + runSetupGitRepo repoUrl $ repoPath language + runCommitsAndTestCasesGeneration opts metaRepo + runPullGitRemote repoUrl $ repoPath language + runPushGitRemote $ repoPath language + +-- | Defines the repoPath based on the convention that a repository is based on its language name for a defaut location. +repoPath :: String -> FilePath +repoPath language = "test/corpus/repos/" <> language + +-- | Upon successful test case generation for a generator file, move the file to the generated directory. +-- | This prevents subsequence runs of the test generator from duplicating test cases and adding extraneous +-- | commits to the git submodule. +runMoveGeneratorFile :: FilePath -> IO () +runMoveGeneratorFile filePath = do + let updatedPath = DT.unpack $ DT.replace (DT.pack "generators") (DT.pack "generated") (DT.pack filePath) + Prelude.putStrLn updatedPath + _ <- readCreateProcess (shell $ "mv " <> filePath <> " " <> updatedPath) "" + return () + +-- | Initializes a new git repository and adds it as a submodule to the semantic-diff git index. +-- | This repository contains the commits associated with the given JSONMetaRepo's syntax examples. +runSetupGitRepo :: String -> FilePath -> IO () +runSetupGitRepo repoUrl repoPath = do + runInitializeRepo repoUrl repoPath + runAddSubmodule repoUrl repoPath + +-- | Performs the system calls for initializing the git repository. +-- | If the git repository already exists, the operation will result in an error, +-- | but will not prevent successful completion of the test case generation. +runInitializeRepo :: String -> FilePath -> IO () +runInitializeRepo repoUrl repoPath = do + result <- try $ readCreateProcess (shell $ mkDirCommand repoPath) "" + case (result :: Either Prelude.IOError String) of + Left error -> Prelude.putStrLn $ "Creating the repository directory at " <> repoPath <> " failed with: " <> show error <> ". " <> "Possible reason: repository already initialized. \nProceeding to the next step." + Right _ -> do + _ <- executeCommand repoPath (initializeRepoCommand repoUrl) + Prelude.putStrLn $ "Repository directory successfully initialized for " <> repoPath <> "." + +-- | Git repositories generated as a side-effect of generating tests cases are +-- | added to semantic-diff's git index as submodules. If the submodule initialization +-- | fails (usually because the submodule was already initialized), operations will +-- | continue. +runAddSubmodule :: String -> FilePath -> IO () +runAddSubmodule repoUrl repoPath = do + result <- try $ readCreateProcess (shell $ addSubmoduleCommand repoUrl repoPath) "" + case (result :: Either Prelude.IOError String) of + Left error -> Prelude.putStrLn $ "Initializing the submodule repository at " <> repoPath <> " failed with: " <> show error <> ". " <> "Possible reason: submodule already initialized. \nProceeding to the next step." + _ -> Prelude.putStrLn $ "Submodule successfully initialized for " <> repoPath <> "." + +-- | Performs the system calls for generating the commits and test cases. +-- | Also appends the JSONTestCases generated to the test case file defined by +-- | the syntaxes. +runCommitsAndTestCasesGeneration :: GeneratorArgs -> JSONMetaRepo -> IO () +runCommitsAndTestCasesGeneration opts metaRepo@JSONMetaRepo{..} = + for_ syntaxes generate + where + generate :: JSONMetaSyntax -> IO () + generate metaSyntax = do + _ <- runInitialCommitForSyntax metaRepo metaSyntax + let testCaseFilePath' = testCaseFilePath language opts metaSyntax + runSetupTestCaseFile testCaseFilePath' + runCommitAndTestCaseGeneration opts metaRepo metaSyntax testCaseFilePath' + runCloseTestCaseFile testCaseFilePath' + + testCaseFilePath :: String -> GeneratorArgs -> JSONMetaSyntax -> FilePath + testCaseFilePath language GeneratorArgs{..} JSONMetaSyntax{..} = case generateFormat of + GenerateSummaries -> "test/corpus/diff-summaries/" <> language <> "/" <> syntax <> ".json" + GenerateJSON -> "test/corpus/json/" <> language <> "/" <> syntax <> ".json" + +-- | For a syntax, we want the initial commit to be an empty file. +-- | This function performs a touch and commits the empty file. +runInitialCommitForSyntax :: JSONMetaRepo -> JSONMetaSyntax -> IO () +runInitialCommitForSyntax metaRepo@JSONMetaRepo{..} metaSyntax@JSONMetaSyntax{..} = do + Prelude.putStrLn $ "Generating initial commit for " <> syntax <> " syntax." + + let repoFilePath' = repoFilePath metaRepo metaSyntax + + result <- try . executeCommand (repoPath language) $ touchCommand repoFilePath' <> commitCommand syntax "Initial commit" + case ( result :: Either Prelude.IOError String) of + Left error -> Prelude.putStrLn $ "Initializing the " <> repoFilePath metaRepo metaSyntax <> " failed with: " <> show error <> ". " <> "Possible reason: file already initialized. \nProceeding to the next step." + Right _ -> runAddTemplateForSyntax metaRepo metaSyntax + +runAddTemplateForSyntax :: JSONMetaRepo -> JSONMetaSyntax -> IO () +runAddTemplateForSyntax metaRepo@JSONMetaRepo{..} metaSyntax@JSONMetaSyntax{..} = case templateText of + Just templateText -> do + let repoFilePath' = repoFilePath metaRepo metaSyntax + _ <- executeCommand (repoPath language) $ fileWriteCommand repoFilePath' templateText <> commitCommand syntax ("Add " <> repoFilePath' <> " template text.") + pure () + Nothing -> pure () + +-- | Initializes the test case file where JSONTestCase examples are written to. +-- | This manually inserts a "[" to open a JSON array. +runSetupTestCaseFile :: FilePath -> IO () +runSetupTestCaseFile testCaseFilePath = do + Prelude.putStrLn $ "Opening " <> testCaseFilePath + DL.writeFile testCaseFilePath "[" + +-- | For each command constructed for a given metaSyntax, execute the system commands. +runCommitAndTestCaseGeneration :: GeneratorArgs -> JSONMetaRepo -> JSONMetaSyntax -> FilePath -> IO () +runCommitAndTestCaseGeneration opts metaRepo metaSyntax testCaseFilePath = + traverse_ (runGenerateCommitAndTestCase opts metaRepo testCaseFilePath) (commands metaRepo metaSyntax) + +-- | Converts a list of Output to a list of Renderer.Summary Map values +maybeMapSummary :: [R.Output] -> [Maybe (Map Text (Map Text [Value]))] +maybeMapSummary = fmap $ \case + R.SummaryOutput output -> Just output + _ -> Nothing + +-- | Converst a list of Output to a list of Renderer.JSON values +maybeMapJSON :: [R.Output] -> [Maybe (Map Text Value)] +maybeMapJSON = fmap $ \case + R.JSONOutput output -> Just output + _ -> Nothing + +-- | This function represents the heart of the test case generation. It keeps track of +-- | the git shas prior to running a command, fetches the git sha after a command, so that +-- | JSONTestCase objects can be created. Finally, it appends the created JSONTestCase +-- | object to the test case file. +runGenerateCommitAndTestCase :: GeneratorArgs -> JSONMetaRepo -> FilePath -> (JSONMetaSyntax, String, String, String) -> IO () +runGenerateCommitAndTestCase opts JSONMetaRepo{..} testCaseFilePath (JSONMetaSyntax{..}, description, seperator, command) = do + Prelude.putStrLn $ "Executing " <> syntax <> " " <> description <> " commit." + + beforeSha <- executeCommand (repoPath language) getLastCommitShaCommand + _ <- executeCommand (repoPath language) command + afterSha <- executeCommand (repoPath language) getLastCommitShaCommand + + patch <- executeCommand (repoPath language) (gitDiffCommand beforeSha afterSha) + + expectedResult' <- runExpectedResult (repoPath language) beforeSha afterSha (syntax <> fileExt) opts + + let jsonTestCase = encodePretty JSONTestCase { + gitDir = extractGitDir (repoPath language), + testCaseDescription = language <> "-" <> syntax <> "-" <> description <> "-" <> "test", + filePaths = [syntax <> fileExt], + shas = beforeSha <> ".." <> afterSha, + patch = lines patch, + expectedResult = expectedResult' + } + + Prelude.putStrLn $ "Generating test case for " <> language <> ": " <> syntax <> " " <> description <> "." + + DL.appendFile testCaseFilePath $ jsonTestCase <> DL.fromStrict (DC.pack seperator) + where extractGitDir :: String -> String + extractGitDir fullRepoPath = DC.unpack $ snd $ DC.breakSubstring (DC.pack "test") (DC.pack fullRepoPath) + +-- | This constructs an Eff and runs it to return the appropriate IO ExpectedResult. +runExpectedResult :: FilePath -> String -> String -> FilePath -> GeneratorArgs -> IO ExpectedResult +runExpectedResult repoPath beforeSha afterSha repoFilePath GeneratorArgs{..} = + case generateFormat of + GenerateSummaries -> Main.run $ constructSummariesEff repoPath beforeSha afterSha repoFilePath + GenerateJSON -> Main.run $ constructJSONEff repoPath beforeSha afterSha repoFilePath + +data GenerateEff a where + GenerateSummaries' :: Arguments -> GenerateEff ExpectedResult + GenerateJSON' :: Arguments -> GenerateEff ExpectedResult + +-- | Construct an Eff whose queue includes only GenerateEff effects. +constructSummariesEff :: FilePath -> String -> String -> FilePath -> Eff '[GenerateEff] ExpectedResult +constructSummariesEff repoPath beforeSha afterSha repoFilePath = send $ GenerateSummaries' (args repoPath beforeSha afterSha [repoFilePath] R.Summary) + +-- | Construct an Eff whose queue includes only GenerateEff effects. +constructJSONEff :: FilePath -> String -> String -> FilePath -> Eff '[GenerateEff] ExpectedResult +constructJSONEff repoPath beforeSha afterSha repoFilePath = send $ GenerateJSON' (args repoPath beforeSha afterSha [repoFilePath] R.JSON) + +-- | Evaluate the Effs and return the IO ExpectedResult. +run :: Eff '[GenerateEff] ExpectedResult -> IO ExpectedResult +run (Val x) = pure x +run (E u queue) = case decompose u of + (Right (GenerateSummaries' args)) -> generateSummaries args >>= \s -> Main.run (apply queue s) + (Right (GenerateJSON' args)) -> generateJSON args >>= \s -> Main.run (apply queue s) + (Left _) -> pure $ SummaryResult ( Map.fromList [ ("changes", Map.singleton mempty mempty), ("errors", Map.singleton mempty mempty) ] ) + +-- | Produces DiffSummary results for the given Arguments. +generateSummaries :: Arguments -> IO ExpectedResult +generateSummaries args@Arguments{..} = do + diffs <- fetchDiffs args + let headResult = Prelude.head $ maybeMapSummary diffs + let changes = fromMaybe (fromList [("changes", mempty)]) headResult ! "changes" + let errors = fromMaybe (fromList [("errors", mempty)]) headResult ! "errors" + pure $ SummaryResult ( Map.fromList [ ("changes", changes), ("errors", errors) ] ) + +-- | Produces JSON output for the given Arguments. +generateJSON :: Arguments -> IO ExpectedResult +generateJSON args = do + diffs <- fetchDiffs args + let headResult = Prelude.head $ maybeMapJSON diffs + let oids = fromMaybe (fromList [("oids", "")]) headResult ! "oids" + let paths = fromMaybe (fromList [("output", "")]) headResult ! "paths" + let rows = fromMaybe (fromList [("rows", "")]) headResult ! "rows" + pure $ JSONResult ( Map.fromList [ ("oids", oids), ("paths", paths), ("rows", rows) ] ) + + +repoFilePath :: JSONMetaRepo -> JSONMetaSyntax -> String +repoFilePath metaRepo metaSyntax = syntax metaSyntax <> fileExt metaRepo + +-- | Commands represent the various combination of patches (insert, delete, replacement) +-- | for a given syntax. +commands :: JSONMetaRepo -> JSONMetaSyntax -> [(JSONMetaSyntax, String, String, String)] +commands JSONMetaRepo{..} metaSyntax@JSONMetaSyntax{..} = case template of + (Just _) -> [ (metaSyntax, "setup", commaSeperator, fileWriteCommand repoFilePath (withTemplate "") <> commitCommand syntax "setup") + , (metaSyntax, "insert", commaSeperator, fileWriteCommand repoFilePath (withTemplate insert) <> commitCommand syntax "insert") + , (metaSyntax, "replacement", commaSeperator, fileWriteCommand repoFilePath (withTemplate replacement) <> commitCommand syntax "replacement") + , (metaSyntax, "delete-replacement", commaSeperator, fileWriteCommand repoFilePath (withTemplate insert) <> commitCommand syntax "delete replacement") + , (metaSyntax, "delete-insert", commaSeperator, fileWriteCommand repoFilePath (withTemplate "") <> commitCommand syntax "delete insert") + , (metaSyntax, "teardown", spaceSeperator, removeCommand repoFilePath <> touchCommand repoFilePath <> commitCommand syntax "teardown") + ] + Nothing -> [ (metaSyntax, "insert", commaSeperator, fileWriteCommand repoFilePath insert <> commitCommand syntax "insert") + , (metaSyntax, "replacement-insert", commaSeperator, fileWriteCommand repoFilePath (Prologue.intercalate "\n" [replacement, insert, insert]) <> commitCommand syntax "replacement + insert + insert") + , (metaSyntax, "delete-insert", commaSeperator, fileWriteCommand repoFilePath (Prologue.intercalate "\n" [insert, insert, insert]) <> commitCommand syntax "delete + insert") + , (metaSyntax, "replacement", commaSeperator, fileWriteCommand repoFilePath (Prologue.intercalate "\n" [replacement, insert, insert]) <> commitCommand syntax "replacement") + , (metaSyntax, "delete-replacement", commaSeperator, fileWriteCommand repoFilePath (Prologue.intercalate "\n" [insert, replacement]) <> commitCommand syntax "delete + replacement") + , (metaSyntax, "delete", commaSeperator, fileWriteCommand repoFilePath replacement <> commitCommand syntax "delete") + , (metaSyntax, "delete-rest", spaceSeperator, removeCommand repoFilePath <> touchCommand repoFilePath <> commitCommand syntax "delete rest") + ] + where commaSeperator = "\n," + spaceSeperator = "" + repoFilePath = syntax <> fileExt + withTemplate = contentsWithTemplate template + contentsWithTemplate :: Maybe String -> String -> String + contentsWithTemplate (Just template) contents = DT.unpack $ DT.replace "{0}" (toS contents) (toS template) + contentsWithTemplate Nothing contents = contents + +-- | Attempts to pull from the git repository's remote repository. +-- | If the pull fails, the exception is caught and continues to the next step. +runPullGitRemote :: String -> FilePath -> IO () +runPullGitRemote repoUrl repoPath = do + Prelude.putStrLn "Attempting to fetch from the remote repository." + _ <- executeCommand repoPath checkoutMasterCommand + result <- attempt + handle result next errorMessage + where attempt :: IO (Either Prelude.IOError String) + attempt = try $ executeCommand repoPath pullFromRemoteCommand + + handle :: Either Prelude.IOError String -> IO () -> (Prelude.IOError -> IO ()) -> IO () + handle result success err = case (result :: Either Prelude.IOError String) of + Left error -> err error + Right _ -> success + next :: IO () + next = Prelude.putStrLn "Remote repository successfully fetched.\n" + + errorMessage :: Prelude.IOError -> IO () + errorMessage err = Prelude.putStrLn $ "Pulling from the remote repository at " <> repoUrl <> " failed with: " <> show err <> ". Proceeding to the next step.\n" + +-- | Pushes git commits to the submodule repository's remote. +runPushGitRemote :: FilePath -> IO () +runPushGitRemote repoPath = do + Prelude.putStrLn "Updating git remote." + result <- try $ executeCommand repoPath pushToGitRemoteCommand + case (result :: Either Prelude.IOError String) of + Left err -> die $ "Failed to push to remote repository: " <> show err + Right _ -> Prelude.putStrLn "Successfully updated git remote." + +-- | Closes the JSON array and closes the test case file. +runCloseTestCaseFile :: FilePath -> IO () +runCloseTestCaseFile testCaseFilePath = do + Prelude.putStrLn $ "Closing " <> testCaseFilePath + DL.appendFile testCaseFilePath "]\n" + +initializeRepoCommand :: String -> String +initializeRepoCommand repoUrl = "rm -rf *; rm -rf .git; git init .; git remote add origin " <> repoUrl <> ";" + +addSubmoduleCommand :: String -> FilePath -> String +addSubmoduleCommand repoUrl repoPath = "git submodule add " <> repoUrl <> " " <> " ./" <> repoPath <> ";" + +getLastCommitShaCommand :: String +getLastCommitShaCommand = "git log --pretty=format:\"%H\" -n 1;" + +gitDiffCommand :: String -> String -> String +gitDiffCommand sha1 sha2 = "git diff " <> sha1 <> ".." <> sha2 <> ";" + +checkoutMasterCommand :: String +checkoutMasterCommand = "git checkout master;" + +pullFromRemoteCommand :: String +pullFromRemoteCommand = "git pull origin master;" + +touchCommand :: FilePath -> String +touchCommand repoFilePath = "touch " <> repoFilePath <> ";" + +-- | In order to correctly record syntax examples that include backticks (like JavaScript template strings) +-- | we must first escape them for bash (due to the use of the `echo` system command). Additionally, +-- | we must also escape the escape character `\` in Haskell, hence the double `\\`. +fileWriteCommand :: FilePath -> String -> String +fileWriteCommand repoFilePath contents = "echo \"" <> (escapeBackticks . escapeDoubleQuotes) contents <> "\" > " <> repoFilePath <> ";" + where + escapeBackticks = DSUtils.replace "`" "\\`" + escapeDoubleQuotes = DSUtils.replace "\"" "\\\"" + +fileAppendCommand :: FilePath -> String -> String +fileAppendCommand repoFilePath contents = "echo \"" <> (escapeBackticks . escapeDoubleQuotes) contents <> "\" >> " <> repoFilePath <> ";" + where + escapeBackticks = DSUtils.replace "`" "\\`" + escapeDoubleQuotes = DSUtils.replace "\"" "\\\"" + +commitCommand :: String -> String -> String +commitCommand syntax commitMessage = "git add .; git commit -m \"" <> syntax <> ": " <> commitMessage <> "\"" <> ";" + +removeCommand :: FilePath -> String +removeCommand repoFilePath = "rm " <> repoFilePath <> ";" + +pushToGitRemoteCommand :: String +pushToGitRemoteCommand = "git push origin HEAD;" + +mkDirCommand :: FilePath -> String +mkDirCommand repoPath = "mkdir " <> repoPath <> ";" + +executeCommand :: FilePath -> String -> IO String +executeCommand repoPath command = readCreateProcess (shell command) { cwd = Just repoPath } "" diff --git a/app/Main.hs b/app/Main.hs new file mode 100644 index 000000000..f913510b8 --- /dev/null +++ b/app/Main.hs @@ -0,0 +1,3 @@ +module Main (main) +where +import SemanticDiff (main) diff --git a/bench/Main.hs b/bench/Main.hs new file mode 100644 index 000000000..ae5260f29 --- /dev/null +++ b/bench/Main.hs @@ -0,0 +1,67 @@ +{-# LANGUAGE DeriveAnyClass, FlexibleInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} +module Main where + +import Arguments +import Criterion.Main +import Data.Function +import Data.List (genericLength) +import Data.String +import Patch +import Prologue +import qualified Renderer as R +import SemanticDiff (fetchDiffs) +import qualified SemanticDiffPar +import SES +import System.Directory (makeAbsolute) + +main :: IO () +main = defaultMain + [ bgroup "ses" + [ bench "0,0" (nf (uncurry benchmarkSES) ([], [])) + , bench "1,1, =" (nf (uncurry benchmarkSES) ([lower], [lower])) + , bench "1,1, ≠" (nf (uncurry benchmarkSES) ([lower], [upper])) + , bench "10,10, =" (nf (uncurry benchmarkSES) (replicate 10 lower, replicate 10 lower)) + , bench "10,10, ≠" (nf (uncurry benchmarkSES) (replicate 10 lower, replicate 10 upper)) + , bench "100,100, =" (nf (uncurry benchmarkSES) (replicate 100 lower, replicate 100 lower)) + , bench "100,100, ≠" (nf (uncurry benchmarkSES) (replicate 100 lower, replicate 100 upper)) + ] + , syncAsyncBenchmark + ] + where lower = ['a'..'z'] + upper = ['A'..'Z'] + +benchmarkSES :: [String] -> [String] -> [Either String (Patch String)] +benchmarkSES = ses compare cost + where compare a b = if a == b then Just (Left a) else Nothing + cost = either (const 0) (sum . fmap genericLength) + +instance NFData a => NFData (Patch a) + +syncAsyncBenchmark :: Benchmark +syncAsyncBenchmark = + bgroup "async vs par" [ + bench "async" . whnfIO $ SemanticDiff.fetchDiffs =<< theArgs, + bench "par" . whnfIO $ SemanticDiffPar.fetchDiffs =<< theArgs + ] + +theArgs :: IO Arguments +theArgs = do + jqueryPath <- makeAbsolute "test/repos/jquery" + pure $ args jqueryPath sha1 sha2 files R.Patch + where + sha1 = "70526981916945dc4093e116a3de61b1777d4718" + sha2 = "e5ffcb0838c894e26f4ff32dfec162cf624d8d7d" + files = [ + "src/manipulation/getAll.js", + "src/manipulation/support.js", + "src/manipulation/wrapMap.js", + "src/offset.js", + "test/unit/css.js", + "test/unit/deferred.js", + "test/unit/deprecated.js", + "test/unit/effects.js", + "test/unit/event.js", + "test/unit/offset.js", + "test/unit/wrap.js" + ] diff --git a/bench/SemanticDiffPar.hs b/bench/SemanticDiffPar.hs new file mode 100644 index 000000000..cfa440087 --- /dev/null +++ b/bench/SemanticDiffPar.hs @@ -0,0 +1,12 @@ +module SemanticDiffPar where + +import Arguments +import qualified Control.Monad.Par.IO as ParIO +import Control.Monad.Reader +import qualified Data.Text as T +import Prologue +import qualified Renderer as R +import SemanticDiff + +fetchDiffs :: Arguments -> IO [T.Text] +fetchDiffs args@Arguments{..} = pure . pure . R.concatOutputs =<< (ParIO.runParIO . liftIO $ for filePaths (fetchDiff args)) diff --git a/languages/c/Setup.hs b/languages/c/Setup.hs new file mode 100644 index 000000000..9a994af67 --- /dev/null +++ b/languages/c/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/languages/c/c.cabal b/languages/c/c.cabal new file mode 100644 index 000000000..cda8b6b69 --- /dev/null +++ b/languages/c/c.cabal @@ -0,0 +1,24 @@ +name: c +version: 0.1.0 +synopsis: tree-sitter c language bindings +description: Please see README.md +homepage: https://github.com/github/semantic-diff#readme +author: semantic-code +maintainer: tclem@github.com +copyright: 2017 GitHub +category: Web +build-type: Simple +-- extra-source-files: +cabal-version: >=1.10 + +library + hs-source-dirs: src + exposed-modules: Text.Parser.TreeSitter.C + build-depends: base >= 4.7 && < 5 + , haskell-tree-sitter + default-language: Haskell2010 + c-sources: vendor/tree-sitter-c/src/parser.c + +source-repository head + type: git + location: https://github.com/github/semantic-diff diff --git a/languages/c/src/Text/Parser/TreeSitter/C.hs b/languages/c/src/Text/Parser/TreeSitter/C.hs new file mode 100644 index 000000000..50f4154d3 --- /dev/null +++ b/languages/c/src/Text/Parser/TreeSitter/C.hs @@ -0,0 +1,6 @@ +module Text.Parser.TreeSitter.C where + +import Text.Parser.TreeSitter +import Foreign.Ptr + +foreign import ccall "vendor/tree-sitter-c/src/parser.c tree_sitter_c" tree_sitter_c :: Ptr Language diff --git a/languages/c/vendor/tree-sitter-c b/languages/c/vendor/tree-sitter-c new file mode 160000 index 000000000..1e46713a2 --- /dev/null +++ b/languages/c/vendor/tree-sitter-c @@ -0,0 +1 @@ +Subproject commit 1e46713a228508ae83e2513b194647f6c508a17c diff --git a/languages/go/Setup.hs b/languages/go/Setup.hs new file mode 100644 index 000000000..9a994af67 --- /dev/null +++ b/languages/go/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/languages/go/go.cabal b/languages/go/go.cabal new file mode 100644 index 000000000..f600acfdc --- /dev/null +++ b/languages/go/go.cabal @@ -0,0 +1,24 @@ +name: go +version: 0.1.0 +synopsis: tree-sitter go language bindings +description: Please see README.md +homepage: https://github.com/github/semantic-diff#readme +author: semantic-code +maintainer: tclem@github.com +copyright: 2017 GitHub +category: Web +build-type: Simple +-- extra-source-files: +cabal-version: >=1.10 + +library + hs-source-dirs: src + exposed-modules: Text.Parser.TreeSitter.Go + build-depends: base >= 4.7 && < 5 + , haskell-tree-sitter + default-language: Haskell2010 + c-sources: vendor/tree-sitter-go/src/parser.c + +source-repository head + type: git + location: https://github.com/github/semantic-diff diff --git a/languages/go/src/Text/Parser/TreeSitter/Go.hs b/languages/go/src/Text/Parser/TreeSitter/Go.hs new file mode 100644 index 000000000..334347c50 --- /dev/null +++ b/languages/go/src/Text/Parser/TreeSitter/Go.hs @@ -0,0 +1,6 @@ +module Text.Parser.TreeSitter.Go where + +import Text.Parser.TreeSitter +import Foreign.Ptr + +foreign import ccall "vendor/tree-sitter-go/src/parser.c tree_sitter_go" tree_sitter_go :: Ptr Language diff --git a/languages/go/vendor/tree-sitter-go b/languages/go/vendor/tree-sitter-go new file mode 160000 index 000000000..ca3d2de4b --- /dev/null +++ b/languages/go/vendor/tree-sitter-go @@ -0,0 +1 @@ +Subproject commit ca3d2de4bdeebba0a408fc5936883045981880cf diff --git a/languages/javascript/Setup.hs b/languages/javascript/Setup.hs new file mode 100644 index 000000000..9a994af67 --- /dev/null +++ b/languages/javascript/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/languages/javascript/javascript.cabal b/languages/javascript/javascript.cabal new file mode 100644 index 000000000..6122994d4 --- /dev/null +++ b/languages/javascript/javascript.cabal @@ -0,0 +1,24 @@ +name: javascript +version: 0.1.0 +synopsis: tree-sitter javascript language bindings +description: Please see README.md +homepage: https://github.com/github/semantic-diff#readme +author: semantic-code +maintainer: tclem@github.com +copyright: 2017 GitHub +category: Web +build-type: Simple +-- extra-source-files: +cabal-version: >=1.10 + +library + hs-source-dirs: src + exposed-modules: Text.Parser.TreeSitter.JavaScript + build-depends: base >= 4.7 && < 5 + , haskell-tree-sitter + default-language: Haskell2010 + c-sources: vendor/tree-sitter-javascript/src/parser.c + +source-repository head + type: git + location: https://github.com/github/semantic-diff diff --git a/languages/javascript/src/Text/Parser/TreeSitter/JavaScript.hs b/languages/javascript/src/Text/Parser/TreeSitter/JavaScript.hs new file mode 100644 index 000000000..9a3402b93 --- /dev/null +++ b/languages/javascript/src/Text/Parser/TreeSitter/JavaScript.hs @@ -0,0 +1,6 @@ +module Text.Parser.TreeSitter.JavaScript where + +import Text.Parser.TreeSitter +import Foreign.Ptr + +foreign import ccall "vendor/tree-sitter-javascript/src/parser.c tree_sitter_javascript" tree_sitter_javascript :: Ptr Language diff --git a/languages/javascript/vendor/tree-sitter-javascript b/languages/javascript/vendor/tree-sitter-javascript new file mode 160000 index 000000000..4a819fc08 --- /dev/null +++ b/languages/javascript/vendor/tree-sitter-javascript @@ -0,0 +1 @@ +Subproject commit 4a819fc084092db1ea75978efa5371fe39312aab diff --git a/languages/ruby/Setup.hs b/languages/ruby/Setup.hs new file mode 100644 index 000000000..9a994af67 --- /dev/null +++ b/languages/ruby/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/languages/ruby/ruby.cabal b/languages/ruby/ruby.cabal new file mode 100644 index 000000000..5f99d16f1 --- /dev/null +++ b/languages/ruby/ruby.cabal @@ -0,0 +1,26 @@ +name: ruby +version: 0.1.0 +synopsis: tree-sitter ruby language bindings +description: Please see README.md +homepage: https://github.com/github/semantic-diff#readme +author: semantic-code +maintainer: tclem@github.com +copyright: 2017 GitHub +category: Web +build-type: Simple +-- extra-source-files: +cabal-version: >=1.10 + +library + hs-source-dirs: src + exposed-modules: Text.Parser.TreeSitter.Ruby + build-depends: base >= 4.7 && < 5 + , haskell-tree-sitter + default-language: Haskell2010 + c-sources: vendor/tree-sitter-ruby/src/parser.c + , vendor/tree-sitter-ruby/src/scanner.cc + extra-libraries: stdc++ + +source-repository head + type: git + location: https://github.com/github/semantic-diff diff --git a/languages/ruby/src/Text/Parser/TreeSitter/Ruby.hs b/languages/ruby/src/Text/Parser/TreeSitter/Ruby.hs new file mode 100644 index 000000000..e2b419559 --- /dev/null +++ b/languages/ruby/src/Text/Parser/TreeSitter/Ruby.hs @@ -0,0 +1,6 @@ +module Text.Parser.TreeSitter.Ruby where + +import Text.Parser.TreeSitter +import Foreign.Ptr + +foreign import ccall "vendor/tree-sitter-ruby/src/parser.c tree_sitter_ruby" tree_sitter_ruby :: Ptr Language diff --git a/languages/ruby/vendor/tree-sitter-ruby b/languages/ruby/vendor/tree-sitter-ruby new file mode 160000 index 000000000..b2ca35ffc --- /dev/null +++ b/languages/ruby/vendor/tree-sitter-ruby @@ -0,0 +1 @@ +Subproject commit b2ca35ffc5b1e3eec5ee41fc3d0420788dffa04a diff --git a/semantic-diff.cabal b/semantic-diff.cabal index 06d64ab32..8da7988c6 100644 --- a/semantic-diff.cabal +++ b/semantic-diff.cabal @@ -1,5 +1,5 @@ name: semantic-diff -version: 0.1.0.0 +version: 0.2.0 synopsis: Initial project template from stack description: Please see README.md homepage: http://github.com/github/semantic-diff#readme @@ -15,90 +15,205 @@ library hs-source-dirs: src exposed-modules: Algorithm , Alignment + , Arguments , Category - , Control.Comonad.Cofree - , Control.Monad.Free - , Data.Adjoined - , Data.Align - , Data.Bifunctor.These - , Data.Coalescent - , Data.Copointed + , Data.Align.Generic , Data.Functor.Both - , Data.Option - , Data.OrderedMap + , Data.Functor.Listable + , Data.Mergeable + , Data.Mergeable.Generic + , Data.RandomWalkSimilarity + , Data.Record + , Data.Text.Listable , Diff , Diffing - , DiffOutput + , DiffSummary + , Info , Interpreter , Language - , Line - , Operation + , Language.C + , Language.JavaScript + , Language.Markdown + , Language.Go + , Language.Ruby + , Parse , Parser , Patch + , Paths_semantic_diff + , Prologue , Range , Renderer , Renderer.JSON , Renderer.Patch , Renderer.Split + , Renderer.Summary + , Renderer.SExpression + , Renderer.TOC + , SemanticDiff , SES , Source + , SourceSpan , SplitDiff , Syntax , Term , TreeSitter - build-depends: aeson - , base >= 4.8 && < 5 + , FDoc.Term + , FDoc.RecursionSchemes + , FDoc.NatExample + build-depends: base >= 4.8 && < 5 + , aeson + , aeson-pretty + , array + , async-pool + , bifunctors , blaze-html , blaze-markup , bytestring + , cmark + , comonad , containers , directory + , dlist , filepath + , free + , gitlib + , gitlib-libgit2 + , gitrev + , hashable + , kdt + , leancheck + , mersenne-random-pure64 + , MonadRandom , mtl + , optparse-applicative + , pointed + , protolude + , recursion-schemes + , regex-compat + , semigroups , text >= 1.2.1.3 , text-icu - , tree-sitter-parsers + , these + , haskell-tree-sitter , vector + , wl-pprint-text + , c + , go + , ruby + , javascript default-language: Haskell2010 - default-extensions: DeriveFunctor, DeriveFoldable, DeriveTraversable, DeriveGeneric, OverloadedStrings - ghc-options: -Wall -fno-warn-name-shadowing -O2 -threaded -fprof-auto "-with-rtsopts=-N -p -s -h -i0.1" -j + default-extensions: DeriveFunctor, DeriveFoldable, DeriveTraversable, DeriveGeneric, FlexibleContexts, FlexibleInstances, OverloadedStrings, NoImplicitPrelude, RecordWildCards, LambdaCase, StrictData + ghc-options: -Wall -fno-warn-name-shadowing -O2 -j + ghc-prof-options: -fprof-auto -test-suite semantic-diff-test +executable semantic-diff + hs-source-dirs: app + main-is: Main.hs + ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O2 -pgml=script/g++ + cc-options: -DU_STATIC_IMPLEMENTATION=1 + cpp-options: -DU_STATIC_IMPLEMENTATION=1 + build-depends: base + , semantic-diff + default-language: Haskell2010 + default-extensions: FlexibleInstances, OverloadedStrings, NoImplicitPrelude, RecordWildCards + +executable generate-test-cases + hs-source-dirs: app, test + main-is: GenerateTestCases.hs + ghc-options: -threaded -rtsopts -with-rtsopts=-N -static -j -pgml=script/g++ + cc-options: -DU_STATIC_IMPLEMENTATION=1 + cpp-options: -DU_STATIC_IMPLEMENTATION=1 + other-modules: JSONTestCase + build-depends: base + , aeson + , aeson-pretty + , bytestring + , containers + , Glob + , MissingH + , optparse-applicative + , process + , semantic-diff + , text >= 1.2.1.3 + , effects + , unordered-containers + default-language: Haskell2010 + default-extensions: DeriveFunctor, DeriveFoldable, DeriveTraversable, DeriveGeneric, FlexibleContexts, FlexibleInstances, OverloadedStrings, NoImplicitPrelude, RecordWildCards, LambdaCase + +benchmark semantic-diff-bench + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: bench + other-modules: SemanticDiffPar + build-depends: base + , criterion + , directory + , leancheck + , monad-par + , mtl + , semantic-diff + , text >= 1.2.1.3 + ghc-options: -threaded -rtsopts -with-rtsopts=-N -j -O2 -static -pgml=script/g++ + default-language: Haskell2010 + default-extensions: FlexibleInstances, OverloadedStrings, NoImplicitPrelude, RecordWildCards + +test-suite test type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs other-modules: AlignmentSpec - , ArbitraryTerm , CorpusSpec - , Data.Adjoined.Spec - , Data.Functor.Both.Spec + , Data.Mergeable.Spec + , Data.RandomWalkSimilarity.Spec + , Diff.Spec + , DiffSummarySpec , InterpreterSpec - , OrderedMapSpec , PatchOutputSpec + , RangeSpec + , Source.Spec , TermSpec - build-depends: base - , bytestring - , containers + , Test.Hspec.LeanCheck + build-depends: array + , base + , bifunctors , deepseq , filepath , Glob , hspec >= 2.1.10 - , QuickCheck >= 2.8.1 - , quickcheck-text + , hspec-core + , hspec-expectations-pretty-diff + , leancheck + , mtl + , protolude + , recursion-schemes >= 4.1 , semantic-diff , text >= 1.2.1.3 - if os(darwin) - ghc-options: -threaded -rtsopts -with-rtsopts=-N -j - else - ghc-options: -threaded -rtsopts -with-rtsopts=-N -j -pgml=script/g++ + , these + , vector + ghc-options: -threaded -rtsopts -with-rtsopts=-N -j -pgml=script/g++ default-language: Haskell2010 - default-extensions: DeriveFunctor, DeriveGeneric, OverloadedStrings - if os(darwin) - extra-libraries: stdc++ icuuc icudata icui18n - if os(darwin) - extra-lib-dirs: /usr/local/opt/icu4c/lib - if os(darwin) - include-dirs: /usr/local/opt/icu4c/include + default-extensions: DeriveFunctor, DeriveGeneric, FlexibleContexts, FlexibleInstances, OverloadedStrings, NoImplicitPrelude, RecordWildCards + +test-suite integration-test + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: SpecIntegration.hs + other-modules: IntegrationFormatSpec + , JSONTestCase + build-depends: base + , aeson + , bytestring + , containers + , Glob + , hspec >= 2.1.10 + , hspec-expectations-pretty-diff + , semantic-diff + , split + , MissingH + , unordered-containers + ghc-options: -threaded -rtsopts -with-rtsopts=-N -j -pgml=script/g++ + default-language: Haskell2010 + default-extensions: DeriveGeneric, FlexibleInstances, OverloadedStrings, NoImplicitPrelude, RecordWildCards source-repository head type: git diff --git a/src/Algorithm.hs b/src/Algorithm.hs index 7bd357e6d..ee225193f 100644 --- a/src/Algorithm.hs +++ b/src/Algorithm.hs @@ -1,7 +1,42 @@ module Algorithm where -import Control.Monad.Free -import Operation +import Control.Applicative.Free +import Prologue hiding (Pure) --- | A lazily-produced AST for diffing. -type Algorithm a annotation = Free (Operation a annotation) +-- | A single step in a diffing algorithm. +-- +-- 'term' is the type of terms. +-- 'diff' is the type of diffs. +-- 'f' represents the continuation after diffing. Often 'Algorithm'. +data AlgorithmF term diff f + -- | Recursively diff two terms and pass the result to the continuation. + = Recursive term term (diff -> f) + -- | Diff two lists by each element’s position, and pass the resulting list of diffs to the continuation. + | ByIndex [term] [term] ([diff] -> f) + -- | Diff two lists by each element’s similarity and pass the resulting list of diffs to the continuation. + | BySimilarity [term] [term] ([diff] -> f) + deriving Functor + +-- | The free applicative for 'AlgorithmF'. This enables us to construct diff values using <$> and <*> notation. +type Algorithm term diff = Ap (AlgorithmF term diff) + +-- | Tear down an Ap by iteration. +iterAp :: Functor g => (g a -> a) -> Ap g a -> a +iterAp algebra = go + where go (Pure a) = a + go (Ap underlying apply) = algebra (go . (apply <*>) . pure <$> underlying) + + +-- DSL + +-- | Constructs a 'Recursive' diff of two terms. +recursively :: term -> term -> Algorithm term diff diff +recursively a b = liftAp (Recursive a b identity) + +-- | Constructs a 'ByIndex' diff of two lists of terms. +byIndex :: [term] -> [term] -> Algorithm term diff [diff] +byIndex a b = liftAp (ByIndex a b identity) + +-- | Constructs a 'BySimilarity' diff of two lists of terms. +bySimilarity :: [term] -> [term] -> Algorithm term diff [diff] +bySimilarity a b = liftAp (BySimilarity a b identity) diff --git a/src/Alignment.hs b/src/Alignment.hs index 681fcfa42..b37b521bf 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -1,106 +1,152 @@ -{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE RankNTypes, ScopedTypeVariables #-} module Alignment ( hasChanges -, linesInRangeOfSource , numberedRows -, splitAbstractedTerm -, splitDiffByLines -, Row +, alignDiff +, alignBranch +, applyThese +, modifyJoin ) where -import Control.Arrow -import Control.Comonad.Cofree -import Control.Monad -import Control.Monad.Free -import Data.Adjoined +import Prologue hiding (fst, snd) import Data.Align -import Data.Bifunctor.These -import Data.Coalescent -import Data.Copointed -import Data.Foldable -import Data.Functor.Both as Both -import Data.Functor.Identity -import Data.Maybe -import Data.Monoid -import qualified Data.OrderedMap as Map -import qualified Data.Text as T +import Data.Bifunctor.Join +import Data.Functor.Both +import Data.List (partition) +import Data.Maybe (fromJust) +import Data.Record +import Data.These import Diff -import Line +import Info import Patch -import Prelude hiding (fst, snd) -import qualified Prelude import Range -import Source hiding (fromList, uncons) +import Source hiding (break, fromList, uncons) import SplitDiff import Syntax import Term -- | Assign line numbers to the lines on each side of a list of rows. -numberedRows :: [Row a] -> [Both (Int, Line a)] -numberedRows = countUp (pure 1) - where countUp from (row : rows) = ((,) <$> from <*> row) : countUp ((+) <$> from <*> (lineIncrement <$> row)) rows - countUp _ [] = [] +numberedRows :: [Join These a] -> [Join These (Int, a)] +numberedRows = countUp (both 1 1) + where countUp _ [] = [] + countUp from (row : rows) = numberedLine from row : countUp (nextLineNumbers from row) rows + numberedLine from row = fromJust ((,) <$> modifyJoin (uncurry These) from `applyThese` row) + nextLineNumbers from row = modifyJoin (fromThese identity identity) (succ <$ row) <*> from -- | Determine whether a line contains any patches. -hasChanges :: Line (SplitDiff leaf Info) -> Bool -hasChanges = or . fmap (or . (True <$)) +hasChanges :: (Foldable f, Functor f) => SplitDiff f annotation -> Bool +hasChanges = or . (True <$) --- | Split a diff, which may span multiple lines, into rows of split diffs paired with the Range of characters spanned by that Row on each side of the diff. -splitDiffByLines :: Both (Source Char) -> Diff leaf Info -> [Row (SplitDiff leaf Info, Range)] -splitDiffByLines sources = toList . iter (\ (Annotated infos syntax) -> splitAbstractedTerm ((Free .) . Annotated) sources infos syntax) . fmap (splitPatchByLines sources) +-- | Align a Diff into a list of Join These SplitDiffs representing the (possibly blank) lines on either side. +alignDiff :: HasField fields Range => Both (Source Char) -> SyntaxDiff leaf fields -> [Join These (SplitSyntaxDiff leaf fields)] +alignDiff sources diff = iter (alignSyntax (runBothWith ((Join .) . These)) wrap getRange sources) (alignPatch sources <$> diff) --- | Split a patch, which may span multiple lines, into rows of split diffs. -splitPatchByLines :: Both (Source Char) -> Patch (Term leaf Info) -> Adjoined (Both (Line (SplitDiff leaf Info, Range))) -splitPatchByLines sources patch = wrapTermInPatch <$> splitAndFoldTerm (unPatch patch) - where splitAndFoldTerm (This deleted) = tsequenceL mempty $ both (runIdentity <$> cata (splitAbstractedTerm (:<) (Identity $ fst sources)) (Identity <$> deleted)) nil - splitAndFoldTerm (That inserted) = tsequenceL mempty $ both nil (runIdentity <$> cata (splitAbstractedTerm (:<) (Identity $ snd sources)) (Identity <$> inserted)) - splitAndFoldTerm (These deleted inserted) = tsequenceL mempty $ both (runIdentity <$> cata (splitAbstractedTerm (:<) (Identity $ fst sources)) (Identity <$> deleted)) (runIdentity <$> cata (splitAbstractedTerm (:<) (Identity $ snd sources)) (Identity <$> inserted)) - wrapTermInPatch = fmap (fmap (first (Pure . constructor patch))) - constructor (Replace _ _) = SplitReplace - constructor (Insert _) = SplitInsert - constructor (Delete _) = SplitDelete +-- | Align the contents of a patch into a list of lines on the corresponding side(s) of the diff. +alignPatch :: forall fields leaf. HasField fields Range => Both (Source Char) -> Patch (SyntaxTerm leaf fields) -> [Join These (SplitSyntaxDiff leaf fields)] +alignPatch sources patch = case patch of + Delete term -> fmap (pure . SplitDelete) <$> alignSyntax' this (fst sources) term + Insert term -> fmap (pure . SplitInsert) <$> alignSyntax' that (snd sources) term + Replace term1 term2 -> fmap (pure . SplitReplace) <$> alignWith (fmap (these identity identity const . runJoin) . Join) + (alignSyntax' this (fst sources) term1) + (alignSyntax' that (snd sources) term2) + where getRange = characterRange . extract + alignSyntax' :: (forall a. Identity a -> Join These a) -> Source Char -> SyntaxTerm leaf fields -> [Join These (SyntaxTerm leaf fields)] + alignSyntax' side source term = hylo (alignSyntax side cofree getRange (Identity source)) runCofree (Identity <$> term) + this = Join . This . runIdentity + that = Join . That . runIdentity --- | Split a term comprised of an Info & Syntax up into one `outTerm` (abstracted by an alignment function & constructor) per line in `Source`. -splitAbstractedTerm :: (Applicative f, Coalescent (f (Line (Maybe (Identity outTerm), Range))), Coalescent (f (Line (Maybe (T.Text, outTerm), Range))), Foldable f, TotalCrosswalk f) => (Info -> Syntax leaf outTerm -> outTerm) -> f (Source Char) -> f Info -> Syntax leaf (Adjoined (f (Line (outTerm, Range)))) -> Adjoined (f (Line (outTerm, Range))) -splitAbstractedTerm makeTerm sources infos syntax = case syntax of - Leaf a -> tsequenceL (pure mempty) $ fmap <$> ((\ categories -> fmap (\ range -> (makeTerm (Info range categories) (Leaf a), range))) <$> (Diff.categories <$> infos)) <*> (linesInRangeOfSource <$> (characterRange <$> infos) <*> sources) - Indexed children -> adjoinChildren sources infos (constructor (Indexed . fmap runIdentity)) (Identity <$> children) - Fixed children -> adjoinChildren sources infos (constructor (Fixed . fmap runIdentity)) (Identity <$> children) - Keyed children -> adjoinChildren sources infos (constructor (Keyed . Map.fromList)) (Map.toList children) - where constructor with info = makeTerm info . with +-- | The Applicative instance f is either Identity or Both. Identity is for Terms in Patches, Both is for Diffs in unchanged portions of the diff. +alignSyntax :: (Applicative f, HasField fields Range) => (forall a. f a -> Join These a) -> (SyntaxTermF leaf fields term -> term) -> (term -> Range) -> f (Source Char) -> TermF (Syntax leaf) (f (Record fields)) [Join These term] -> [Join These term] +alignSyntax toJoinThese toNode getRange sources (infos :< syntax) = catMaybes $ case syntax of + Leaf s -> wrapInBranch (const (Leaf s)) <$> alignBranch getRange [] bothRanges + Syntax.Comment a -> wrapInBranch (const (Syntax.Comment a)) <$> alignBranch getRange [] bothRanges + Fixed children -> wrapInBranch Fixed <$> alignBranch getRange (join children) bothRanges + _ -> wrapInBranch Indexed <$> alignBranch getRange (join (toList syntax)) bothRanges + where bothRanges = modifyJoin (fromThese [] []) lineRanges + lineRanges = toJoinThese $ actualLineRanges <$> (characterRange <$> infos) <*> sources + wrapInBranch constructor = applyThese $ toJoinThese ((\ info (range, children) -> toNode (setCharacterRange info range :< constructor children)) <$> infos) --- | Adjoin a branch term’s lines, wrapping children & context in branch nodes using a constructor. -adjoinChildren :: (Copointed c, Functor c, Applicative f, Coalescent (f (Line (Maybe (c a), Range))), Foldable f, TotalCrosswalk f) => f (Source Char) -> f Info -> (Info -> [c a] -> outTerm) -> [c (Adjoined (f (Line (a, Range))))] -> Adjoined (f (Line (outTerm, Range))) -adjoinChildren sources infos constructor children = wrap <$> leadingContext <> lines - where (lines, next) = foldr (childLines sources) (mempty, end <$> ranges) children - ranges = characterRange <$> infos - categories = Diff.categories <$> infos - leadingContext = tsequenceL (pure mempty) $ makeContextLines <$> (linesInRangeOfSource <$> (Range <$> (start <$> ranges) <*> next) <*> sources) - wrap = (wrapLineContents <$> (makeBranchTerm constructor <$> categories <*> next) <*>) - makeBranchTerm constructor categories next children = let range = unionRangesFrom (rangeAt next) $ Prelude.snd <$> children in - (constructor (Info range categories) . catMaybes . toList $ Prelude.fst <$> children, range) +-- | Given a function to get the range, a list of already-aligned children, and the lists of ranges spanned by a branch, return the aligned lines. +alignBranch :: (term -> Range) -> [Join These term] -> Both [Range] -> [Join These (Range, [term])] +-- There are no more ranges, so we’re done. +alignBranch _ _ (Join ([], [])) = [] +-- There are no more children, so we can just zip the remaining ranges together. +alignBranch _ [] ranges = runBothWith (alignWith Join) (fmap (flip (,) []) <$> ranges) +-- There are both children and ranges, so we need to proceed line by line +alignBranch getRange children ranges = case intersectingChildren of + -- No child intersects the current ranges on either side, so advance. + [] -> (flip (,) [] <$> headRanges) : alignBranch getRange children (drop 1 <$> ranges) + -- At least one child intersects on at least one side. + _ -> case intersectionsWithHeadRanges <$> listToMaybe symmetricalChildren of + -- At least one child intersects on both sides, so align symmetrically. + Just (True, True) -> let (line, remaining) = lineAndRemaining intersectingChildren (Just headRanges) in + line $ alignBranch getRange (remaining <> nonIntersectingChildren) (drop 1 <$> ranges) + -- A symmetrical child intersects on the right, so align asymmetrically on the left. + Just (False, True) -> alignAsymmetrically leftRange first + -- A symmetrical child intersects on the left, so align asymmetrically on the right. + Just (True, False) -> alignAsymmetrically rightRange second + -- No symmetrical child intersects, so align asymmetrically, picking the left side first to match the deletion/insertion order convention in diffs. + _ -> if any (isThis . runJoin) asymmetricalChildren + then alignAsymmetrically leftRange first + else alignAsymmetrically rightRange second + where (intersectingChildren, nonIntersectingChildren) = partition (or . intersects getRange headRanges) children + (symmetricalChildren, asymmetricalChildren) = partition (isThese . runJoin) intersectingChildren + intersectionsWithHeadRanges = fromThese True True . runJoin . intersects getRange headRanges + Just headRanges = Join <$> bisequenceL (runJoin (listToMaybe <$> Join (runBothWith These ranges))) + (leftRange, rightRange) = splitThese headRanges + alignAsymmetrically range advanceBy = let (line, remaining) = lineAndRemaining asymmetricalChildren range in + line $ alignBranch getRange (remaining <> symmetricalChildren <> nonIntersectingChildren) (modifyJoin (advanceBy (drop 1)) ranges) + lineAndRemaining _ Nothing = (identity, []) + lineAndRemaining children (Just ranges) = let (intersections, remaining) = alignChildren getRange children ranges in + ((:) $ (,) <$> ranges `applyToBoth` (sortBy (compare `on` getRange) <$> intersections), remaining) --- | Accumulate the lines of and between a branch term’s children. -childLines :: (Copointed c, Functor c, Applicative f, Coalescent (f (Line (Maybe (c a), Range))), Foldable f, TotalCrosswalk f) => f (Source Char) -> c (Adjoined (f (Line (a, Range)))) -> (Adjoined (f (Line (Maybe (c a), Range))), f Int) -> (Adjoined (f (Line (Maybe (c a), Range))), f Int) --- We depend on source ranges increasing monotonically. If a child invalidates that, e.g. if it’s a move in a Keyed node, we don’t output rows for it in this iteration. (It will still show up in the diff as context rows.) This works around https://github.com/github/semantic-diff/issues/488. -childLines sources child (nextLines, next) | or ((>) . end <$> childRanges <*> next) = (nextLines, next) - | otherwise = ((makeChildLines <$> copoint child) - <> tsequenceL (pure mempty) (makeContextLines <$> trailingContextLines) - <> nextLines, start <$> childRanges) - where makeChildLines = fmap (fmap (first (Just . (<$ child)))) - trailingContextLines = linesInRangeOfSource <$> (Range <$> (end <$> childRanges) <*> next) <*> sources - childRanges = unionRangesFrom <$> (rangeAt <$> next) <*> (concat . fmap (fmap Prelude.snd . unLine) <$> sequenceA (copoint child)) +-- | Given a list of aligned children, produce lists of their intersecting first lines, and a list of the remaining lines/nonintersecting first lines. +alignChildren :: (term -> Range) -> [Join These term] -> Join These Range -> (Both [term], [Join These term]) +alignChildren _ [] _ = (both [] [], []) +alignChildren getRange (first:rest) headRanges + | ~(l, r) <- splitThese first + = case intersectionsWithHeadRanges first of + -- It intersects on both sides, so we can just take the first line whole. + (True, True) -> ((<>) <$> toTerms first <*> firstRemaining, restRemaining) + -- It only intersects on the left, so split it up. + (True, False) -> ((<>) <$> toTerms (fromJust l) <*> firstRemaining, maybe identity (:) r restRemaining) + -- It only intersects on the right, so split it up. + (False, True) -> ((<>) <$> toTerms (fromJust r) <*> firstRemaining, maybe identity (:) l restRemaining) + -- It doesn’t intersect at all, so skip it and move along. + (False, False) -> (firstRemaining, first:restRemaining) + | otherwise = alignChildren getRange rest headRanges + where (firstRemaining, restRemaining) = alignChildren getRange rest headRanges + toTerms line = modifyJoin (fromThese [] []) (pure <$> line) + intersectionsWithHeadRanges = fromThese False False . runJoin . intersects getRange headRanges -makeContextLines :: Adjoined (Line Range) -> Adjoined (Line (Maybe a, Range)) -makeContextLines = fmap (fmap ((,) Nothing)) +-- | Test ranges and terms for intersection on either or both sides. +intersects :: (term -> Range) -> Join These Range -> Join These term -> Join These Bool +intersects getRange ranges line = intersectsRange <$> ranges `applyToBoth` modifyJoin (fromThese (Range (-1) (-1)) (Range (-1) (-1))) (getRange <$> line) --- | Produce open/closed lines for the portion of the source spanned by a range. -linesInRangeOfSource :: Range -> Source Char -> Adjoined (Line Range) -linesInRangeOfSource range source = fromList $ pureBy (openRange source) <$> actualLineRanges range source +-- | Split a These value up into independent These values representing the left and right sides, if any. +splitThese :: Join These a -> (Maybe (Join These a), Maybe (Join These a)) +splitThese these = fromThese Nothing Nothing $ bimap (Just . Join . This) (Just . Join . That) (runJoin these) --- | Does this Range in this Source end with a newline? -openRange :: Source Char -> Range -> Bool -openRange source range = (at source <$> maybeLastIndex range) /= Just '\n' +infixl 4 `applyThese` --- | A row in a split diff, composed of a before line and an after line. -type Row a = Both (Line a) +-- | Like `<*>`, but it returns its result in `Maybe` since the result is the intersection of the shapes of the inputs. +applyThese :: Join These (a -> b) -> Join These a -> Maybe (Join These b) +applyThese (Join fg) (Join ab) = fmap Join . uncurry maybeThese $ uncurry (***) (bimap (<*>) (<*>) (unpack fg)) (unpack ab) + where unpack = fromThese Nothing Nothing . bimap Just Just + +infixl 4 `applyToBoth` + +-- | Like `<*>`, but it takes a `Both` on the right to ensure that it can always return a value. +applyToBoth :: Join These (a -> b) -> Both a -> Join These b +applyToBoth (Join fg) (Join (a, b)) = Join $ these (This . ($ a)) (That . ($ b)) (\ f g -> These (f a) (g b)) fg + +-- Map over the bifunctor inside a Join, producing another Join. +modifyJoin :: (p a a -> q b b) -> Join p a -> Join q b +modifyJoin f = Join . f . runJoin + +-- | Given a pair of Maybes, produce a These containing Just their values, or Nothing if they haven’t any. +maybeThese :: Maybe a -> Maybe b -> Maybe (These a b) +maybeThese (Just a) (Just b) = Just (These a b) +maybeThese (Just a) _ = Just (This a) +maybeThese _ (Just b) = Just (That b) +maybeThese _ _ = Nothing diff --git a/src/Arguments.hs b/src/Arguments.hs new file mode 100644 index 000000000..b3c349487 --- /dev/null +++ b/src/Arguments.hs @@ -0,0 +1,111 @@ +{-# OPTIONS_GHC -funbox-strict-fields #-} +module Arguments (Arguments(..), CmdLineOptions(..), DiffMode(..), ExtraArg(..), RunMode(..), programArguments, args) where + +import Data.Functor.Both +import Data.Maybe +import Data.Text +import Prologue hiding ((<>)) +import Prelude +import System.Environment +import System.Directory +import System.IO.Error (IOError) + +import qualified Renderer as R + +data ExtraArg = ShaPair (Both (Maybe String)) + | FileArg FilePath + deriving (Show) + +data DiffMode = PathDiff (Both FilePath) + | CommitDiff + deriving (Show) + +data RunMode = Diff + | Parse + deriving (Show) + +-- | The command line options to the application (arguments for optparse-applicative). +data CmdLineOptions = CmdLineOptions + { outputFormat :: R.Format + , maybeTimeout :: Maybe Float + , outputFilePath :: Maybe FilePath + , noIndex :: Bool + , extraArgs :: [ExtraArg] + , developmentMode' :: Bool + , runMode' :: RunMode + } + +-- | Arguments for the program (includes command line, environment, and defaults). +data Arguments = Arguments + { gitDir :: FilePath + , alternateObjectDirs :: [Text] + , format :: R.Format + , timeoutInMicroseconds :: Int + , output :: Maybe FilePath + , diffMode :: DiffMode + , runMode :: RunMode + , shaRange :: Both (Maybe String) + , filePaths :: [FilePath] + , developmentMode :: Bool + } deriving (Show) + +-- | Returns Arguments for the program from parsed command line arguments. +programArguments :: CmdLineOptions -> IO Arguments +programArguments CmdLineOptions{..} = do + pwd <- getCurrentDirectory + gitDir <- fromMaybe pwd <$> lookupEnv "GIT_DIR" + eitherObjectDirs <- try $ parseObjectDirs . toS <$> getEnv "GIT_ALTERNATE_OBJECT_DIRECTORIES" + let alternateObjectDirs = case (eitherObjectDirs :: Either IOError [Text]) of + (Left _) -> [] + (Right objectDirs) -> objectDirs + + let filePaths = fetchPaths extraArgs + pure Arguments + { gitDir = gitDir + , alternateObjectDirs = alternateObjectDirs + , format = outputFormat + , timeoutInMicroseconds = maybe defaultTimeout toMicroseconds maybeTimeout + , output = outputFilePath + , diffMode = case (noIndex, filePaths) of + (True, [fileA, fileB]) -> PathDiff (both fileA fileB) + (_, _) -> CommitDiff + , runMode = runMode' + , shaRange = fetchShas extraArgs + , filePaths = filePaths + , developmentMode = developmentMode' + } + where + fetchPaths :: [ExtraArg] -> [FilePath] + fetchPaths [] = [] + fetchPaths (FileArg x:xs) = x : fetchPaths xs + fetchPaths (_:xs) = fetchPaths xs + + fetchShas :: [ExtraArg] -> Both (Maybe String) + fetchShas [] = both Nothing Nothing + fetchShas (ShaPair x:_) = x + fetchShas (_:xs) = fetchShas xs + +-- | Quickly assemble an Arguments data record with defaults. +args :: FilePath -> String -> String -> [String] -> R.Format -> Arguments +args gitDir sha1 sha2 filePaths format = Arguments + { gitDir = gitDir + , alternateObjectDirs = [] + , format = format + , timeoutInMicroseconds = defaultTimeout + , output = Nothing + , diffMode = CommitDiff + , runMode = Diff + , shaRange = Just <$> both sha1 sha2 + , filePaths = filePaths + , developmentMode = False + } + +-- | 7 seconds +defaultTimeout :: Int +defaultTimeout = 7 * 1000000 + +toMicroseconds :: Float -> Int +toMicroseconds num = floor $ num * 1000000 + +parseObjectDirs :: Text -> [Text] +parseObjectDirs = split (== ':') diff --git a/src/Category.hs b/src/Category.hs index d60f68556..0db8996d1 100644 --- a/src/Category.hs +++ b/src/Category.hs @@ -1,43 +1,356 @@ -{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# OPTIONS_GHC -funbox-strict-fields #-} module Category where -import Term -import Control.Comonad.Cofree -import Data.Set +import Prologue +import Data.Functor.Listable +import Data.Text (pack) +import Data.Text.Listable -- | A standardized category of AST node. Used to determine the semantics for -- | semantic diffing and define comparability of nodes. -data Category = - -- | An operator with 2 operands. - BinaryOperator +data Category + -- | The top-level branch node. + = Program + -- | A node indicating syntax errors. + | ParseError + -- | A boolean expression. + | Boolean + -- | A bitwise operator. + | BitwiseOperator + -- | A boolean operator (e.g. ||, &&). + | BooleanOperator -- | A literal key-value data structure. | DictionaryLiteral -- | A pair, e.g. of a key & value | Pair -- | A call to a function. | FunctionCall + -- | A function declaration. + | Function + -- | An identifier. + | Identifier + -- | A function's parameters. + | Params + -- | A function's expression statements. + | ExpressionStatements + -- | A method call on an object. + | MethodCall + -- | A method's arguments. + | Args -- | A string literal. | StringLiteral -- | An integer literal. | IntegerLiteral + -- | A regex literal. + | Regex + -- | A return statement. + | Return -- | A symbol literal. | SymbolLiteral + -- | A template string literal. + | TemplateString -- | An array literal. | ArrayLiteral + -- | An assignment expression. + | Assignment + -- | A math assignment expression. + | MathAssignment + -- | A member access expression. + | MemberAccess + -- | A subscript access expression. + | SubscriptAccess + -- | A variable assignment within a variable declaration. + | VarAssignment + -- | A variable declaration. + | VarDecl + -- | A switch expression. + | Switch + -- | A if/else expression. + | If + -- | A for expression. + | For + -- | A while expression. + | While + -- | A do/while expression. + | DoWhile + -- | A ternary expression. + | Ternary + -- | A case expression. + | Case + -- | An expression with an operator. + | Operator + -- | An comma operator expression + | CommaOperator + -- | An object/dictionary/hash literal. + | Object + -- | A throw statement. + | Throw + -- | A constructor statement, e.g. new Foo; + | Constructor + -- | A try statement. + | Try + -- | A catch statement. + | Catch + -- | A finally statement. + | Finally + -- | A class declaration. + | Class + -- | A class method declaration. + | Method + -- | A comment. + | Comment -- | A non-standard category, which can be used for comparability. - | Other String - deriving (Eq, Show, Ord) + | Other Text + -- | A relational operator (e.g. < or >=) + | RelationalOperator + -- | An empty statement. (e.g. ; in JavaScript) + | Empty + -- | A number literal. + | NumberLiteral + -- | A mathematical operator (e.g. +, -, *, /). + | MathOperator + -- | A module + | Module + -- | An import + | Import + -- | An export + | Export + -- | An anonymous function. + | AnonymousFunction + -- | An interpolation (e.g. "#{bar}" in Ruby) + | Interpolation + -- | A subshell command (e.g. `ls -la` in Ruby) + | Subshell + -- | Operator assignment, e.g. a ||= b, a += 1 in Ruby. + | OperatorAssignment + -- | A yield statement. + | Yield + -- | An until expression. + | Until + -- | A unless/else expression. + | Unless + | Begin + | Else + | Elsif + | Ensure + | Rescue + -- | Formerly used for Ruby’s @x rescue y@ modifier syntax. Deprecated. Use @Modifier Rescue@ instead. Left in place to preserve hashing & RWS results. + | RescueModifier + | RescuedException + | RescueArgs + | When + | Negate + -- | A select expression in Go. + | Select + | Defer + | Go + | Slice + | TypeAssertion + | TypeConversion + -- | An argument pair, e.g. foo(run: true) or foo(:run => true) in Ruby. + | ArgumentPair + -- | A keyword parameter, e.g. def foo(name:) or def foo(name:false) in Ruby. + | KeywordParameter + -- | An optional/default parameter, e.g. def foo(name = nil) in Ruby. + | OptionalParameter + -- | A splat parameter, e.g. def foo(*array) in Ruby. + | SplatParameter + -- | A hash splat parameter, e.g. def foo(**option) in Ruby. + | HashSplatParameter + -- | A block parameter, e.g. def foo(&block) in Ruby. + | BlockParameter + -- | A float literal. + | FloatLiteral + -- | An array type declaration, e.g. [2]string in Go. + | ArrayTy + -- | A dictionary type declaration, e.g. map[string] in Go. + | DictionaryTy + -- | A Struct type declaration, struct Foo {..} in Go. + | StructTy + -- | A Struct constructor, e.g. foo = Foo {..} in Go. + | Struct + -- | A break statement, e.g. break; in JavaScript. + | Break + -- | A continue statement, e.g. continue; in JavaScript. + | Continue + -- | A binary statement, e.g. a | b in Ruby. + | Binary + -- | A unary statement, e.g. !a in Ruby. + | Unary + -- | A constant, e.g `Foo::Bar` in Ruby. + | Constant + -- | A superclass, e.g `< Foo` in Ruby. + | Superclass + -- | A singleton class declaration, e.g. `class << self;end` in Ruby + | SingletonClass + -- | A range expression, e.g. `1..10` in Ruby. + | RangeExpression + -- | A scope resolution operator, e.g. `Foo::bar` in Ruby. + | ScopeOperator + -- | A BEGIN {} block of statements. + | BeginBlock + -- | An END {} block of statements. + | EndBlock + | ParameterDecl + -- | A default case in a switch statement. + | DefaultCase + -- | A type declaration. + | TypeDecl + | PointerTy + -- | A field declaration. + | FieldDecl + -- | A slice type, e.g. []string{"hello"} in Go. + | SliceTy + -- | An element of a slice literal. + | Element + -- | A literal value. + | Literal + -- | A channel type in Go. + | ChannelTy + -- | A send statement in Go. + | Send + -- | An Index expression, e.g. x[1] in Go. + | IndexExpression + -- | A function type. + | FunctionTy + -- | An increment statement, e.g. i++ in Go. + | IncrementStatement + -- | A decrement statement, e.g. i-- in Go. + | DecrementStatement + -- | A qualified identifier, e.g. Module.function in Go. + | QualifiedIdentifier + | FieldDeclarations + -- | A Go rune literal. + | RuneLiteral + -- | A modifier version of another Category, e.g. Ruby’s trailing @if@, @while@, etc. terms, whose subterms are swapped relative to regular @if@, @while@, etc. terms. + | Modifier Category + deriving (Eq, Generic, Ord, Show) --- | The class of types that have categories. -class Categorizable a where - categories :: a -> Set Category +{-# DEPRECATED RescueModifier "Deprecated; use Modifier Rescue instead." #-} -instance Categorizable annotation => Categorizable (Term a annotation) where - categories (annotation :< _) = categories annotation --- | Test whether the categories from the categorizables intersect. -comparable :: Categorizable a => a -> a -> Bool -comparable a b = catsA == catsB || (not . Data.Set.null $ intersection catsA catsB) - where - catsA = categories a - catsB = categories b +-- Instances + +instance Hashable Category + +instance (StringConv Category Text) where + strConv _ = pack . show + +instance Listable Category where + tiers + = cons0 Program + \/ cons0 ParseError + \/ cons0 Boolean + \/ cons0 BooleanOperator + \/ cons0 MathOperator + \/ cons0 DictionaryLiteral + \/ cons0 Pair + \/ cons0 FunctionCall + \/ cons0 Function + \/ cons0 Identifier + \/ cons0 Params + \/ cons0 ExpressionStatements + \/ cons0 MethodCall + \/ cons0 Args + \/ cons0 StringLiteral + \/ cons0 IntegerLiteral + \/ cons0 NumberLiteral + \/ cons0 Regex + \/ cons0 Return + \/ cons0 SymbolLiteral + \/ cons0 TemplateString + \/ cons0 ArrayLiteral + \/ cons0 Assignment + \/ cons0 MathAssignment + \/ cons0 MemberAccess + \/ cons0 SubscriptAccess + \/ cons0 VarAssignment + \/ cons0 VarDecl + \/ cons0 For + \/ cons0 DoWhile + \/ cons0 While + \/ cons0 Switch + \/ cons0 If + \/ cons0 Ternary + \/ cons0 Case + \/ cons0 Operator + \/ cons0 CommaOperator + \/ cons0 Object + \/ cons0 Throw + \/ cons0 Constructor + \/ cons0 Try + \/ cons0 Catch + \/ cons0 Finally + \/ cons0 Class + \/ cons0 Method + \/ cons0 Comment + \/ cons0 RelationalOperator + \/ cons0 Empty + \/ cons0 Module + \/ cons0 Import + \/ cons0 Export + \/ cons0 AnonymousFunction + \/ cons0 Interpolation + \/ cons0 Subshell + \/ cons0 OperatorAssignment + \/ cons0 Yield + \/ cons0 Until + \/ cons0 Unless + \/ cons0 Begin + \/ cons0 Else + \/ cons0 Elsif + \/ cons0 Ensure + \/ cons0 Rescue + \/ cons0 RescueModifier + \/ cons0 RescuedException + \/ cons0 RescueArgs + \/ cons0 When + \/ cons0 Negate + \/ cons0 Select + \/ cons0 Defer + \/ cons0 Go + \/ cons0 Slice + \/ cons0 TypeAssertion + \/ cons0 TypeConversion + \/ cons0 ArgumentPair + \/ cons0 KeywordParameter + \/ cons0 OptionalParameter + \/ cons0 SplatParameter + \/ cons0 HashSplatParameter + \/ cons0 BlockParameter + \/ cons0 FloatLiteral + \/ cons0 ArrayTy + \/ cons0 DictionaryTy + \/ cons0 StructTy + \/ cons0 Struct + \/ cons0 Break + \/ cons0 Continue + \/ cons0 Binary + \/ cons0 Unary + \/ cons0 Constant + \/ cons0 Superclass + \/ cons0 SingletonClass + \/ cons0 RangeExpression + \/ cons0 ScopeOperator + \/ cons0 BeginBlock + \/ cons0 EndBlock + \/ cons0 ParameterDecl + \/ cons0 DefaultCase + \/ cons0 TypeDecl + \/ cons0 PointerTy + \/ cons0 FieldDecl + \/ cons0 SliceTy + \/ cons0 Element + \/ cons0 Literal + \/ cons0 ChannelTy + \/ cons0 Send + \/ cons0 IndexExpression + \/ cons0 FunctionTy + \/ cons0 IncrementStatement + \/ cons0 DecrementStatement + \/ cons0 QualifiedIdentifier + \/ cons0 FieldDeclarations + \/ cons0 RuneLiteral + \/ cons1 (Other . unListableText) + \/ cons1 Modifier diff --git a/src/Control/Comonad/Cofree.hs b/src/Control/Comonad/Cofree.hs deleted file mode 100644 index dfb3b7170..000000000 --- a/src/Control/Comonad/Cofree.hs +++ /dev/null @@ -1,22 +0,0 @@ -{-# LANGUAGE UndecidableInstances #-} -module Control.Comonad.Cofree where - -import Data.Copointed - -data Cofree functor annotation = annotation :< (functor (Cofree functor annotation)) - deriving (Functor, Foldable, Traversable) - -instance (Eq annotation, Eq (functor (Cofree functor annotation))) => Eq (Cofree functor annotation) where - a :< f == b :< g = a == b && f == g - -instance (Show annotation, Show (functor (Cofree functor annotation))) => Show (Cofree functor annotation) where - showsPrec n (a :< f) = showsPrec n a . (" :< " ++) . showsPrec n f - -unwrap :: Cofree functor annotation -> functor (Cofree functor annotation) -unwrap (_ :< f) = f - -unfold :: Functor functor => (seed -> (annotation, functor seed)) -> seed -> Cofree functor annotation -unfold grow seed = case grow seed of (annotation, functor) -> annotation :< (unfold grow <$> functor) - -instance Copointed (Cofree functor) where - copoint (annotation :< _) = annotation diff --git a/src/Control/Monad/Free.hs b/src/Control/Monad/Free.hs deleted file mode 100644 index 4c7a1271c..000000000 --- a/src/Control/Monad/Free.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE UndecidableInstances #-} -module Control.Monad.Free where - -data Free functor pure = Free (functor (Free functor pure)) | Pure pure - deriving (Functor, Foldable, Traversable) - -instance (Eq pure, Eq (functor (Free functor pure))) => Eq (Free functor pure) where - Pure a == Pure b = a == b - Free f == Free g = f == g - _ == _ = False - -instance (Show pure, Show (functor (Free functor pure))) => Show (Free functor pure) where - showsPrec n (Pure a) = ("Pure " ++) . showsPrec n a - showsPrec n (Free f) = ("Free " ++) . showsPrec n f - -iter :: Functor functor => (functor pure -> pure) -> Free functor pure -> pure -iter _ (Pure a) = a -iter f (Free g) = f (iter f <$> g) diff --git a/src/Data/Adjoined.hs b/src/Data/Adjoined.hs deleted file mode 100644 index 8c6b502a6..000000000 --- a/src/Data/Adjoined.hs +++ /dev/null @@ -1,68 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -module Data.Adjoined where - -import Control.Applicative -import Control.Monad -import Data.Align -import Data.Bifunctor.These -import Data.Coalescent -import Data.Sequence as Seq hiding (null) - --- | A collection of elements which can be adjoined onto other such collections associatively. There are two big wins with Data.Adjoined: --- | --- | 1. Efficient adjoining of lines and concatenation, thanks to its use of Data.Sequence’s `Seq` type. --- | 2. The Monoid instance guarantees that adjoining cannot touch any lines other than the outermost. --- | --- | Since aligning diffs proceeds through the diff tree depth-first, adjoining child nodes and context from right to left, the former is crucial for efficiency, and the latter is crucial for correctness. Prior to using Data.Adjoined, repeatedly adjoining the last line in a node into its parent, and then its grandparent, and so forth, would sometimes cause blank lines to “travel” downwards, ultimately shifting blank lines at the end of nodes down proportionately to the depth in the tree at which they were introduced. -newtype Adjoined a = Adjoined { unAdjoined :: Seq a } - deriving (Eq, Foldable, Functor, Show, Traversable) - --- | Construct an Adjoined from a list. -fromList :: [a] -> Adjoined a -fromList = Adjoined . Seq.fromList - --- | Construct Adjoined by adding an element at the left. -cons :: a -> Adjoined a -> Adjoined a -cons a (Adjoined as) = Adjoined (a <| as) - --- | Destructure a non-empty Adjoined into Just the leftmost element and the rightward remainder of the Adjoined, or Nothing otherwise. -uncons :: Adjoined a -> Maybe (a, Adjoined a) -uncons (Adjoined v) | a :< as <- viewl v = Just (a, Adjoined as) - | otherwise = Nothing - --- | Construct Adjoined by adding an element at the right. -snoc :: Adjoined a -> a -> Adjoined a -snoc (Adjoined as) a = Adjoined (as |> a) - --- | Destructure a non-empty Adjoined into Just the rightmost element and the leftward remainder of the Adjoined, or Nothing otherwise. -unsnoc :: Adjoined a -> Maybe (Adjoined a, a) -unsnoc (Adjoined v) | as :> a <- viewr v = Just (Adjoined as, a) - | otherwise = Nothing - -instance Applicative Adjoined where - pure = return - (<*>) = ap - -instance Alternative Adjoined where - empty = Adjoined Seq.empty - Adjoined a <|> Adjoined b = Adjoined (a >< b) - -instance Monad Adjoined where - return = Adjoined . return - a >>= f | Just (a, as) <- uncons a = f a <|> (as >>= f) - | otherwise = Adjoined Seq.empty - -instance Coalescent a => Monoid (Adjoined a) where - mempty = Adjoined Seq.empty - a `mappend` b | Just (as, a) <- unsnoc a, - Just (b, bs) <- uncons b - = as <|> coalesce a b <|> bs - | otherwise = Adjoined (unAdjoined a >< unAdjoined b) - -instance Align Adjoined where - nil = Adjoined Seq.empty - align as bs | Just (as, a) <- unsnoc as, - Just (bs, b) <- unsnoc bs = align as bs `snoc` These a b - | null bs = This <$> as - | null as = That <$> bs - | otherwise = nil diff --git a/src/Data/Align.hs b/src/Data/Align.hs deleted file mode 100644 index 039486fc5..000000000 --- a/src/Data/Align.hs +++ /dev/null @@ -1,37 +0,0 @@ -module Data.Align where - -import Data.Bifunctor.These -import Data.Functor.Identity - --- | A functor which can be aligned, essentially the union of (potentially) asymmetrical values. --- | --- | For example, this allows a zip over lists which pads out the shorter side with a default value. -class Functor f => Align f where - -- | The empty value. The identity value for `align` (modulo the `This` or `That` constructor wrapping the results). - nil :: f a - -- | Combine two structures into a structure of `These` holding pairs of values in `These` where they overlap, and individual values in `This` and `That` elsewhere. - -- | - -- | Analogous with `zip`. - align :: f a -> f b -> f (These a b) - align = alignWith id - -- | Combine two structures into a structure by applying a function to pairs of values in `These` where they overlap, and individual values in `This` and `That` elsewhere. - -- | - -- | Analogous with `zipWith`. - alignWith :: (These a b -> c) -> f a -> f b -> f c - alignWith f a b = f <$> align a b - - --- | A functor which can be traversed through an `Align`able functor, inverting the nesting of one in the other, given some default value. --- | --- | Analogous with `zip`, in that it can e.g. turn a tuple of lists into a list of tuples. -class Functor t => TotalCrosswalk t where - -- | Given some default value, embed a structure into an `Align`able functor by mapping its elements into that functor and convoluting (inverting the embedding). - tcrosswalk :: Align f => t b -> (a -> f b) -> t a -> f (t b) - tcrosswalk d f = tsequenceL d . fmap f - - -- | Given some default value, convolute (invert the embedding of) a structure over an `Align`able functor. - tsequenceL :: Align f => t a -> t (f a) -> f (t a) - tsequenceL d = tcrosswalk d id - -instance TotalCrosswalk Identity where - tcrosswalk _ f = fmap Identity . f . runIdentity diff --git a/src/Data/Align/Generic.hs b/src/Data/Align/Generic.hs new file mode 100644 index 000000000..2940fd058 --- /dev/null +++ b/src/Data/Align/Generic.hs @@ -0,0 +1,68 @@ +{-# LANGUAGE DefaultSignatures, TypeOperators #-} +module Data.Align.Generic where + +import Control.Monad +import Data.Align +import Data.These +import GHC.Generics +import Prologue +import Syntax + +-- | Functors which can be aligned (structure-unioning-ly zipped). The default implementation will operate generically over the constructors in the aligning type. +class Functor f => GAlign f where + galign :: f a -> f b -> Maybe (f (These a b)) + default galign :: (Generic1 f, GAlign (Rep1 f)) => f a -> f b -> Maybe (f (These a b)) + galign a b = to1 <$> galign (from1 a) (from1 b) + + +-- Generically-derived instances + +instance Eq a => GAlign (Syntax a) + + +-- 'Data.Align.Align' instances + +instance GAlign [] where galign = galignAlign +instance GAlign Maybe where galign = galignAlign + +-- | Implements a function suitable for use as the definition of 'galign' for 'Align'able functors. +galignAlign :: Align f => f a -> f b -> Maybe (f (These a b)) +galignAlign a = Just . align a + + +-- Generics + +-- | 'GAlign' over unit constructors. +instance GAlign U1 where + galign _ _ = Just U1 + +-- | 'GAlign' over parameters. +instance GAlign Par1 where + galign (Par1 a) (Par1 b) = Just (Par1 (These a b)) + +-- | 'GAlign' over non-parameter fields. Only equal values are aligned. +instance Eq c => GAlign (K1 i c) where + galign (K1 a) (K1 b) = guard (a == b) >> Just (K1 b) + +-- | 'GAlign' over applications over parameters. +instance GAlign f => GAlign (Rec1 f) where + galign (Rec1 a) (Rec1 b) = Rec1 <$> galign a b + +-- | 'GAlign' over metainformation (constructor names, etc). +instance GAlign f => GAlign (M1 i c f) where + galign (M1 a) (M1 b) = M1 <$> galign a b + +-- | 'GAlign' over sums. Returns 'Nothing' for disjoint constructors. +instance (GAlign f, GAlign g) => GAlign (f :+: g) where + galign a b = case (a, b) of + (L1 a, L1 b) -> L1 <$> galign a b + (R1 a, R1 b) -> R1 <$> galign a b + _ -> Nothing + +-- | 'GAlign' over products. +instance (GAlign f, GAlign g) => GAlign (f :*: g) where + galign (a1 :*: b1) (a2 :*: b2) = (:*:) <$> galign a1 a2 <*> galign b1 b2 + +-- | 'GAlign' over type compositions. +instance (Traversable f, Applicative f, GAlign g) => GAlign (f :.: g) where + galign (Comp1 a) (Comp1 b) = Comp1 <$> sequenceA (galign <$> a <*> b) diff --git a/src/Data/Bifunctor/These.hs b/src/Data/Bifunctor/These.hs deleted file mode 100644 index 935ee7012..000000000 --- a/src/Data/Bifunctor/These.hs +++ /dev/null @@ -1,28 +0,0 @@ -module Data.Bifunctor.These where - -import Data.Bifunctor - -data These a b = This a | That b | These a b - deriving (Eq, Show) - --- | Eliminate These by case analysis. -these :: (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c -these f _ _ (This this) = f this -these _ f _ (That that) = f that -these _ _ f (These this that) = f this that - --- | Return Just the value in This, or the first value in These, if any. -maybeFirst :: These a b -> Maybe a -maybeFirst = these Just (const Nothing) ((Just .) . const) - --- | Return Just the value in That, or the second value in These, if any. -maybeSecond :: These a b -> Maybe b -maybeSecond = these (const Nothing) Just ((Just .) . flip const) - - --- Instances - -instance Bifunctor These where - bimap f _ (This a) = This (f a) - bimap _ g (That b) = That (g b) - bimap f g (These a b) = These (f a) (g b) diff --git a/src/Data/Coalescent.hs b/src/Data/Coalescent.hs deleted file mode 100644 index 774dc573e..000000000 --- a/src/Data/Coalescent.hs +++ /dev/null @@ -1,13 +0,0 @@ -module Data.Coalescent where - -import Control.Applicative -import Data.Align -import Data.Functor.Identity - --- | The class of types which can optionally be coalesced together. -class Coalescent a where - -- | Returns the result of coalescing the operands together in an Alternative context. If they cannot be coalesced, they should each be produced individually. - coalesce :: (Align f, Alternative f) => a -> a -> f a - -instance Coalescent a => Coalescent (Identity a) where - a `coalesce` b = sequenceA (coalesce <$> a <*> b) diff --git a/src/Data/Copointed.hs b/src/Data/Copointed.hs deleted file mode 100644 index d65c0199c..000000000 --- a/src/Data/Copointed.hs +++ /dev/null @@ -1,13 +0,0 @@ -module Data.Copointed where - -import Data.Functor.Identity - --- | A value that can return its content. -class Copointed c where - copoint :: c a -> a - -instance Copointed ((,) a) where - copoint = snd - -instance Copointed Identity where - copoint = runIdentity diff --git a/src/Data/Functor/Both.hs b/src/Data/Functor/Both.hs index c8d4910f9..7c4a928e5 100644 --- a/src/Data/Functor/Both.hs +++ b/src/Data/Functor/Both.hs @@ -1,53 +1,33 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -module Data.Functor.Both where +{-# OPTIONS_GHC -fno-warn-orphans -funbox-strict-fields #-} +module Data.Functor.Both (Both,both, runBothWith, fst, snd, module X) where -import Data.Align -import Data.Bifunctor -import Data.Bifunctor.These -import Data.Maybe -import Prelude hiding (zipWith, fst, snd) -import qualified Prelude +import Data.Bifunctor.Join as X +import Prologue hiding (fst, snd) +import qualified Prologue -- | A computation over both sides of a pair. -newtype Both a = Both { runBoth :: (a, a) } - deriving (Eq, Foldable, Functor, Ord, Show, Traversable) +type Both a = Join (,) a -- | Given two operands returns a functor operating on `Both`. This is a curried synonym for Both. both :: a -> a -> Both a -both = curry Both - --- | Construct Both with These values & defaults. -bothOfThese :: Both a -> These a a -> Both a -bothOfThese a = these (`both` snd a) (both (fst a)) both - --- | Construct Both (Maybe) with These values, defaulting to Nothing. -maybeBothOfThese :: These a a -> Both (Maybe a) -maybeBothOfThese = bothOfThese (pure Nothing) . bimap Just Just +both = curry Join -- | Apply a function to `Both` sides of a computation. runBothWith :: (a -> a -> b) -> Both a -> b -runBothWith f = uncurry f . runBoth +runBothWith f = uncurry f . runJoin -- | Runs the left side of a `Both`. fst :: Both a -> a -fst = Prelude.fst . runBoth +fst = Prologue.fst . runJoin -- | Runs the right side of a `Both`. snd :: Both a -> a -snd = Prelude.snd . runBoth +snd = Prologue.snd . runJoin -unzip :: [Both a] -> Both [a] -unzip = foldr pair (pure []) - where pair (Both (a, b)) (Both (as, bs)) = Both (a : as, b : bs) - -instance Applicative Both where - pure a = Both (a, a) - Both (f, g) <*> Both (a, b) = Both (f a, g b) - -instance Monoid a => Monoid (Both a) where +instance (Semigroup a, Monoid a) => Monoid (Join (,) a) where mempty = pure mempty - mappend a b = mappend <$> a <*> b + mappend = (<>) -instance TotalCrosswalk Both where - tsequenceL d = runBothWith (alignWith (\ these -> fromMaybe <$> d <*> maybeBothOfThese these)) +instance (Semigroup a) => Semigroup (Join (,) a) where + a <> b = Join $ runJoin a <> runJoin b diff --git a/src/Data/Functor/Listable.hs b/src/Data/Functor/Listable.hs new file mode 100644 index 000000000..2f64e93f2 --- /dev/null +++ b/src/Data/Functor/Listable.hs @@ -0,0 +1,135 @@ +module Data.Functor.Listable +( Listable(..) +, mapT +, cons0 +, cons1 +, cons2 +, cons3 +, cons4 +, cons5 +, cons6 +, (\/) +, Tier +, Listable1(..) +, tiers1 +, Listable2(..) +, tiers2 +, liftCons1 +, liftCons2 +, liftCons3 +, liftCons4 +, liftCons5 +, ListableF(..) +) where + +import Data.Bifunctor.Join +import Data.These +import Prologue +import Test.LeanCheck + +type Tier a = [a] + +-- | Lifting of 'Listable' to @* -> *@. +class Listable1 l where + -- | The tiers for @l :: * -> *@, parameterized by the tiers for @a :: *@. + liftTiers :: [Tier a] -> [Tier (l a)] + +-- | A suitable definition of 'tiers' for 'Listable1' type constructors parameterized by 'Listable' types. +tiers1 :: (Listable a, Listable1 l) => [Tier (l a)] +tiers1 = liftTiers tiers + + +-- | Lifting of 'Listable' to @* -> * -> *@. +class Listable2 l where + -- | The tiers for @l :: * -> * -> *@, parameterized by the tiers for @a :: *@ & @b :: *@. + liftTiers2 :: [Tier a] -> [Tier b] -> [Tier (l a b)] + +-- | A suitable definition of 'tiers' for 'Listable2' type constructors parameterized by 'Listable' types. +tiers2 :: (Listable a, Listable b, Listable2 l) => [Tier (l a b)] +tiers2 = liftTiers2 tiers tiers + + +-- | Lifts a unary constructor to a list of tiers, given a list of tiers for its argument. +-- +-- Commonly used in the definition of 'Listable1' and 'Listable2' instances. +liftCons1 :: [Tier a] -> (a -> b) -> [Tier b] +liftCons1 tiers f = mapT f tiers `addWeight` 1 + +-- | Lifts a binary constructor to a list of tiers, given lists of tiers for its arguments. +-- +-- Commonly used in the definition of 'Listable1' and 'Listable2' instances. +liftCons2 :: [Tier a] -> [Tier b] -> (a -> b -> c) -> [Tier c] +liftCons2 tiers1 tiers2 f = mapT (uncurry f) (productWith (,) tiers1 tiers2) `addWeight` 1 + +-- | Lifts a ternary constructor to a list of tiers, given lists of tiers for its arguments. +-- +-- Commonly used in the definition of 'Listable1' and 'Listable2' instances. +liftCons3 :: [Tier a] -> [Tier b] -> [Tier c] -> (a -> b -> c -> d) -> [Tier d] +liftCons3 tiers1 tiers2 tiers3 f = mapT (uncurry3 f) (productWith (\ x (y, z) -> (x, y, z)) tiers1 (liftCons2 tiers2 tiers3 (,)) ) `addWeight` 1 + where uncurry3 f (a, b, c) = f a b c + +-- | Lifts a quaternary constructor to a list of tiers, given lists of tiers for its arguments. +-- +-- Commonly used in the definition of 'Listable1' and 'Listable2' instances. +liftCons4 :: [Tier a] -> [Tier b] -> [Tier c] -> [Tier d] -> (a -> b -> c -> d -> e) -> [Tier e] +liftCons4 tiers1 tiers2 tiers3 tiers4 f = mapT (uncurry4 f) (productWith (\ x (y, z, w) -> (x, y, z, w)) tiers1 (liftCons3 tiers2 tiers3 tiers4 (,,)) ) `addWeight` 1 + where uncurry4 f (a, b, c, d) = f a b c d + +-- | Lifts a quinary constructor to a list of tiers, given lists of tiers for its arguments. +-- +-- Commonly used in the definition of 'Listable1' and 'Listable2' instances. +liftCons5 :: [Tier a] -> [Tier b] -> [Tier c] -> [Tier d] -> [Tier e] -> (a -> b -> c -> d -> e -> f) -> [Tier f] +liftCons5 tiers1 tiers2 tiers3 tiers4 tiers5 f = mapT (uncurry5 f) (productWith (\ x (y, z, w, u) -> (x, y, z, w, u)) tiers1 (liftCons4 tiers2 tiers3 tiers4 tiers5 (,,,)) ) `addWeight` 1 + where uncurry5 f (a, b, c, d, e) = f a b c d e + +-- | Convenient wrapper for 'Listable1' type constructors and 'Listable' types, where a 'Listable' instance would necessarily be orphaned. +newtype ListableF f a = ListableF { unListableF :: f a } + deriving Show + + +-- Instances + +instance Listable1 Maybe where + liftTiers tiers = cons0 Nothing \/ liftCons1 tiers Just + +instance Listable2 (,) where + liftTiers2 = productWith (,) + +instance Listable2 Either where + liftTiers2 leftTiers rightTiers = liftCons1 leftTiers Left \/ liftCons1 rightTiers Right + +instance Listable a => Listable1 ((,) a) where + liftTiers = liftTiers2 tiers + +instance Listable1 [] where + liftTiers tiers = go + where go = cons0 [] \/ liftCons2 tiers go (:) + +instance Listable2 p => Listable1 (Join p) where + liftTiers tiers = liftCons1 (liftTiers2 tiers tiers) Join + +instance Listable2 These where + liftTiers2 this that = liftCons1 this This \/ liftCons1 that That \/ liftCons2 this that These + +instance Listable1 f => Listable2 (CofreeF f) where + liftTiers2 annotationTiers recurTiers = liftCons2 annotationTiers (liftTiers recurTiers) (:<) + +instance (Listable1 f, Listable a) => Listable1 (CofreeF f a) where + liftTiers = liftTiers2 tiers + +instance Listable1 f => Listable1 (Cofree f) where + liftTiers annotationTiers = go + where go = liftCons1 (liftTiers2 annotationTiers go) cofree + +instance Listable1 f => Listable2 (FreeF f) where + liftTiers2 pureTiers recurTiers = liftCons1 pureTiers Pure \/ liftCons1 (liftTiers recurTiers) Free + +instance (Listable1 f, Listable a) => Listable1 (FreeF f a) where + liftTiers = liftTiers2 tiers + +instance Listable1 f => Listable1 (Free f) where + liftTiers pureTiers = go + where go = liftCons1 (liftTiers2 pureTiers go) free + +instance (Listable1 f, Listable a) => Listable (ListableF f a) where + tiers = ListableF `mapT` tiers1 diff --git a/src/Data/Mergeable.hs b/src/Data/Mergeable.hs new file mode 100644 index 000000000..8cf9ae965 --- /dev/null +++ b/src/Data/Mergeable.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE DefaultSignatures #-} +module Data.Mergeable where + +import Data.Functor.Identity +import Data.Mergeable.Generic +import GHC.Generics +import Prologue + +-- Classes + +-- | A 'Mergeable' functor is one which supports pushing itself through an 'Alternative' functor. Note the similarities with 'Traversable' & 'Crosswalk'. +-- +-- This is a kind of distributive law which produces (at least) the union of the two functors’ shapes; i.e. unlike 'Traversable', an 'empty' value in the inner functor does not produce an 'empty' result, and unlike 'Crosswalk', an 'empty' value in the outer functor does not produce an 'empty' result. +-- +-- For example, we can use 'merge' to select one side or the other of a diff node in 'Syntax', while correctly handling the fact that some patches don’t have any content for that side: +-- +-- @ +-- let before = iter (\ (a :< s) -> cofree . (fst a :<) <$> sequenceAlt syntax) . fmap (maybeFst . unPatch) +-- @ +class Functor t => Mergeable t where + -- | Merge a functor by mapping its elements into an 'Alternative' functor, combining them, and pushing the 'Mergeable' functor inside. + merge :: Alternative f => (a -> f b) -> t a -> f (t b) + default merge :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => (a -> f b) -> t a -> f (t b) + merge = genericMerge + + -- | Sequnce a 'Mergeable' functor by 'merge'ing the 'Alternative' values. + sequenceAlt :: Alternative f => t (f a) -> f (t a) + sequenceAlt = merge identity + + +-- Instances + +instance Mergeable [] where merge = gmerge + +instance Mergeable Maybe + +instance Mergeable Identity where merge f = fmap Identity . f . runIdentity diff --git a/src/Data/Mergeable/Generic.hs b/src/Data/Mergeable/Generic.hs new file mode 100644 index 000000000..a9bb83d89 --- /dev/null +++ b/src/Data/Mergeable/Generic.hs @@ -0,0 +1,46 @@ +{-# LANGUAGE TypeOperators #-} +module Data.Mergeable.Generic where + +import GHC.Generics +import Prologue + +-- Classes + +class GMergeable t where + gmerge :: Alternative f => (a -> f b) -> t a -> f (t b) + +genericMerge :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => (a -> f b) -> t a -> f (t b) +genericMerge f = fmap to1 . gmerge f . from1 + + +-- Instances + +instance GMergeable U1 where + gmerge _ _ = pure U1 + +instance GMergeable Par1 where + gmerge f (Par1 a) = Par1 <$> f a + +instance GMergeable (K1 i c) where + gmerge _ (K1 a) = pure (K1 a) + +instance GMergeable f => GMergeable (Rec1 f) where + gmerge f (Rec1 a) = Rec1 <$> gmerge f a + +instance GMergeable f => GMergeable (M1 i c f) where + gmerge f (M1 a) = M1 <$> gmerge f a + +instance (GMergeable f, GMergeable g) => GMergeable (f :+: g) where + gmerge f (L1 a) = L1 <$> gmerge f a + gmerge f (R1 b) = R1 <$> gmerge f b + +instance (GMergeable f, GMergeable g) => GMergeable (f :*: g) where + gmerge f (a :*: b) = (:*:) <$> gmerge f a <*> gmerge f b + +instance GMergeable [] where + gmerge f (x:xs) = ((:) <$> f x <|> pure identity) <*> gmerge f xs + gmerge _ [] = pure [] + +instance GMergeable Maybe where + gmerge f (Just a) = Just <$> f a + gmerge _ Nothing = pure empty diff --git a/src/Data/Option.hs b/src/Data/Option.hs deleted file mode 100644 index 99bd60c2f..000000000 --- a/src/Data/Option.hs +++ /dev/null @@ -1,11 +0,0 @@ -{-# LANGUAGE FlexibleContexts #-} -module Data.Option where - -newtype Option a = Option { getOption :: Maybe a } - -option :: b -> (a -> b) -> Option a -> b -option b f = maybe b f . getOption - --- | Return Just the concatenation of any elements in a Foldable, or Nothing if it is empty. -maybeConcat :: (Foldable f, Monoid (Option a)) => f a -> Maybe a -maybeConcat = getOption . foldMap (Option. Just) diff --git a/src/Data/OrderedMap.hs b/src/Data/OrderedMap.hs deleted file mode 100644 index 345a5b7df..000000000 --- a/src/Data/OrderedMap.hs +++ /dev/null @@ -1,68 +0,0 @@ -module Data.OrderedMap ( - OrderedMap - , fromList - , toList - , keys - , (!) - , Data.OrderedMap.lookup - , size - , empty - , union - , unions - , intersectionWith - , difference - ) where - -import qualified Data.Maybe as Maybe - --- | An ordered map of keys and values. -data OrderedMap key value = OrderedMap { toList :: [(key, value)] } - deriving (Show, Eq, Functor, Foldable, Traversable) - -instance Eq key => Monoid (OrderedMap key value) where - mempty = fromList [] - mappend = union - --- | Construct an ordered map from a list of pairs of keys and values. -fromList :: [(key, value)] -> OrderedMap key value -fromList = OrderedMap - --- | Return a list of keys from the map. -keys :: OrderedMap key value -> [key] -keys (OrderedMap pairs) = fst <$> pairs - -infixl 9 ! - --- | Look up a value in the map by key, erroring if it doesn't exist. -(!) :: Eq key => OrderedMap key value -> key -> value -map ! key = Maybe.fromMaybe (error "no value found for key") $ Data.OrderedMap.lookup key map - --- | Look up a value in the map by key, returning Nothing if it doesn't exist. -lookup :: Eq key => key -> OrderedMap key value -> Maybe value -lookup key = Prelude.lookup key . toList - --- | Return the number of pairs in the map. -size :: OrderedMap key value -> Int -size = length . toList - --- | An empty ordered map. -empty :: OrderedMap key value -empty = OrderedMap [] - --- | Combine `a` and `b`, picking the values from `a` when keys overlap. -union :: Eq key => OrderedMap key value -> OrderedMap key value -> OrderedMap key value -union a b = OrderedMap $ toList a ++ toList (difference b a) - --- | Union a list of ordered maps. -unions :: Eq key => [OrderedMap key value] -> OrderedMap key value -unions = foldl union empty - --- | Return an ordered map by combining the values from `a` and `b` that have --- | the same key, dropping any values that are only in one of the maps. -intersectionWith :: Eq key => (a -> b -> c) -> OrderedMap key a -> OrderedMap key b -> OrderedMap key c -intersectionWith combine (OrderedMap a) (OrderedMap b) = OrderedMap $ a >>= (\ (key, value) -> maybe [] (pure . (,) key . combine value) $ Prelude.lookup key b) - --- | Return an ordered map with the pairs from `a` whose key isn't in `b`. -difference :: Eq key => OrderedMap key a -> OrderedMap key b -> OrderedMap key a -difference (OrderedMap a) (OrderedMap b) = OrderedMap $ filter ((`notElem` extant) . fst) a - where extant = fst <$> b diff --git a/src/Data/RandomWalkSimilarity.hs b/src/Data/RandomWalkSimilarity.hs new file mode 100644 index 000000000..24a92af85 --- /dev/null +++ b/src/Data/RandomWalkSimilarity.hs @@ -0,0 +1,314 @@ +{-# LANGUAGE DataKinds, GADTs, RankNTypes, ScopedTypeVariables, TypeOperators #-} +{-# OPTIONS_GHC -funbox-strict-fields #-} +module Data.RandomWalkSimilarity +( rws +, pqGramDecorator +, defaultFeatureVectorDecorator +, featureVectorDecorator +, editDistanceUpTo +, defaultD +, defaultP +, defaultQ +, stripDiff +, stripTerm +, Gram(..) +, Label +, FeatureVector +) where + +import Control.Applicative +import Control.Monad.Random +import Control.Monad.State +import Data.Align.Generic +import Data.Array +import Data.Functor.Listable +import Data.Hashable +import qualified Data.IntMap as IntMap +import qualified Data.KdTree.Static as KdTree +import Data.Record +import Data.Semigroup (Min(..), Option(..)) +import Data.These +import Diff +import Info +import Patch +import Prologue as P +import qualified SES +import System.Random.Mersenne.Pure64 +import Term (termSize, zipTerms, Term, TermF) + +type Label f fields label = forall b. TermF f (Record fields) b -> label +type DiffTerms f fields = Term f (Record fields) -> Term f (Record fields) -> Maybe (Diff f (Record fields)) + +-- | Given a function comparing two terms recursively, +-- a function to compute a Hashable label from an unpacked term, and two lists of terms, +-- compute the diff of a pair of lists of terms using a random walk similarity metric, +-- which completes in log-linear time. +-- +-- This implementation is based on the paper [_RWS-Diff—Flexible and Efficient Change Detection in Hierarchical Data_](https://github.com/github/semantic-diff/files/325837/RWS-Diff.Flexible.and.Efficient.Change.Detection.in.Hierarchical.Data.pdf). +rws :: forall f fields. + (GAlign f, Traversable f, Eq (f (Term f Category)), HasField fields Category, HasField fields (Maybe FeatureVector)) + => DiffTerms f fields -- ^ A function which compares a pair of terms recursively, returning 'Just' their diffed value if appropriate, or 'Nothing' if they should not be compared. + -> [Term f (Record fields)] -- ^ The list of old terms. + -> [Term f (Record fields)] -- ^ The list of new terms. + -> [Diff f (Record fields)] -- ^ The resulting list of similarity-matched diffs. +rws compare as bs + | null as, null bs = [] + | null as = inserting . eraseFeatureVector <$> bs + | null bs = deleting . eraseFeatureVector <$> as + | otherwise = + -- Construct a State who's final value is a list of (Int, Diff leaf (Record fields)) + -- and who's final state is (Int, IntMap UmappedTerm, IntMap UmappedTerm) + traverse findNearestNeighbourToDiff allDiffs & + fmap catMaybes & + -- Run the state with an initial state + (`runState` (minimumTermIndex featurizedAs, toMap featurizedAs, toMap featurizedBs)) & + uncurry deleteRemaining & + insertMapped countersAndDiffs & + fmap snd + + where + minimumTermIndex = pred . maybe 0 getMin . getOption . foldMap (Option . Just . Min . termIndex) + sesDiffs = SES.ses replaceIfEqual cost as bs + + (featurizedAs, featurizedBs, _, _, countersAndDiffs, allDiffs) = + foldl' (\(as, bs, counterA, counterB, diffs, allDiffs) diff -> case runFree diff of + Pure (Delete term) -> + (as <> pure (featurize counterA term), bs, succ counterA, counterB, diffs, allDiffs <> pure None) + Pure (Insert term) -> + (as, bs <> pure (featurize counterB term), counterA, succ counterB, diffs, allDiffs <> pure (Term (featurize counterB term))) + _ -> + (as, bs, succ counterA, succ counterB, diffs <> pure (These counterA counterB, diff), allDiffs <> pure (Index counterA)) + ) ([], [], 0, 0, [], []) sesDiffs + + findNearestNeighbourToDiff :: TermOrIndexOrNone (UnmappedTerm f fields) + -> State (Int, UnmappedTerms f fields, UnmappedTerms f fields) + (Maybe (These Int Int, Diff f (Record fields))) + findNearestNeighbourToDiff termThing = case termThing of + None -> pure Nothing + Term term -> Just <$> findNearestNeighbourTo term + Index i -> do + (_, unA, unB) <- get + put (i, unA, unB) + pure Nothing + + -- | Construct a diff for a term in B by matching it against the most similar eligible term in A (if any), marking both as ineligible for future matches. + findNearestNeighbourTo :: UnmappedTerm f fields + -> State (Int, UnmappedTerms f fields, UnmappedTerms f fields) + (These Int Int, Diff f (Record fields)) + findNearestNeighbourTo term@(UnmappedTerm j _ b) = do + (previous, unmappedA, unmappedB) <- get + fromMaybe (insertion previous unmappedA unmappedB term) $ do + -- Look up the nearest unmapped term in `unmappedA`. + foundA@(UnmappedTerm i _ a) <- nearestUnmapped (IntMap.filterWithKey (\ k _ -> + isInMoveBounds previous k) + unmappedA) kdas term + -- Look up the nearest `foundA` in `unmappedB` + UnmappedTerm j' _ _ <- nearestUnmapped unmappedB kdbs foundA + -- Return Nothing if their indices don't match + guard (j == j') + compared <- compare a b + pure $! do + put (i, IntMap.delete i unmappedA, IntMap.delete j unmappedB) + pure (These i j, compared) + + -- Returns a state (insertion index, old unmapped terms, new unmapped terms), and value of (index, inserted diff), + -- given a previous index, two sets of umapped terms, and an unmapped term to insert. + insertion :: Int + -> UnmappedTerms f fields + -> UnmappedTerms f fields + -> UnmappedTerm f fields + -> State (Int, UnmappedTerms f fields, UnmappedTerms f fields) + (These Int Int, Diff f (Record fields)) + insertion previous unmappedA unmappedB (UnmappedTerm j _ b) = do + put (previous, unmappedA, IntMap.delete j unmappedB) + pure (That j, inserting b) + + -- | Finds the most-similar unmapped term to the passed-in term, if any. + -- + -- RWS can produce false positives in the case of e.g. hash collisions. Therefore, we find the _l_ nearest candidates, filter out any which have already been mapped, and select the minimum of the remaining by (a constant-time approximation of) edit distance. + -- + -- cf §4.2 of RWS-Diff + nearestUnmapped + :: UnmappedTerms f fields -- ^ A set of terms eligible for matching against. + -> KdTree.KdTree Double (UnmappedTerm f fields) -- ^ The k-d tree to look up nearest neighbours within. + -> UnmappedTerm f fields -- ^ The term to find the nearest neighbour to. + -> Maybe (UnmappedTerm f fields) -- ^ The most similar unmapped term, if any. + nearestUnmapped unmapped tree key = getFirst $ foldMap (First . Just) (sortOn (maybe maxBound (editDistanceUpTo defaultM) . compare (term key) . term) (toList (IntMap.intersection unmapped (toMap (KdTree.kNearest tree defaultL key))))) + + insertMapped diffs into = foldl' (\into (i, mappedTerm) -> + insertDiff (i, mappedTerm) into) + into + diffs + + -- Given a list of diffs, and unmapped terms, deletes any terms that remain in unmappedA. + deleteRemaining diffs (_, unmappedA, _) = foldl' (\into (i, deletion) -> + insertDiff (This i, deletion) into) + diffs + ((termIndex &&& deleting . term) <$> unmappedA) + + -- Possibly replace terms in a diff. + replaceIfEqual :: Term f (Record fields) -> Term f (Record fields) -> Maybe (Diff f (Record fields)) + replaceIfEqual a b + | (category <$> a) == (category <$> b) = hylo wrap runCofree <$> zipTerms (eraseFeatureVector a) (eraseFeatureVector b) + | otherwise = Nothing + + cost = iter (const 0) . (1 <$) + + kdas = KdTree.build (elems . feature) featurizedAs + kdbs = KdTree.build (elems . feature) featurizedBs + + featurize :: Int -> Term f (Record fields) -> UnmappedTerm f fields + featurize index term = UnmappedTerm index (let Just v = getField (extract term) in v) (eraseFeatureVector term) + + eraseFeatureVector :: Term f (Record fields) -> Term f (Record fields) + eraseFeatureVector term = let record :< functor = runCofree term in + cofree (setFeatureVector record Nothing :< functor) + + setFeatureVector :: Record fields -> Maybe FeatureVector -> Record fields + setFeatureVector = setField + + toMap = IntMap.fromList . fmap (termIndex &&& identity) + + + -- | Determines whether an index is in-bounds for a move given the most recently matched index. + isInMoveBounds previous i = previous < i && i < previous + defaultMoveBound + +-- | Inserts an index and diff pair into a list of indices and diffs. +insertDiff :: (These Int Int, diff) -> [(These Int Int, diff)] -> [(These Int Int, diff)] +insertDiff inserted [] = [ inserted ] +insertDiff a@(ij1, _) (b@(ij2, _):rest) = case (ij1, ij2) of + (These i1 i2, These j1 j2) -> if i1 <= j1 && i2 <= j2 then a : b : rest else b : insertDiff a rest + (This i, This j) -> if i <= j then a : b : rest else b : insertDiff a rest + (That i, That j) -> if i <= j then a : b : rest else b : insertDiff a rest + (This i, These j _) -> if i <= j then a : b : rest else b : insertDiff a rest + (That i, These _ j) -> if i <= j then a : b : rest else b : insertDiff a rest + + (This _, That _) -> b : insertDiff a rest + (That _, This _) -> b : insertDiff a rest + + (These i1 i2, _) -> case break (isThese . fst) rest of + (rest, tail) -> let (before, after) = foldr' (combine i1 i2) ([], []) (b : rest) in + case after of + [] -> before <> insertDiff a tail + _ -> before <> (a : after) <> tail + where + combine i1 i2 each (before, after) = case fst each of + This j1 -> if i1 <= j1 then (before, each : after) else (each : before, after) + That j2 -> if i2 <= j2 then (before, each : after) else (each : before, after) + These _ _ -> (before, after) + +-- | Return an edit distance as the sum of it's term sizes, given an cutoff and a syntax of terms 'f a'. +-- | Computes a constant-time approximation to the edit distance of a diff. This is done by comparing at most _m_ nodes, & assuming the rest are zero-cost. +editDistanceUpTo :: (Foldable f, Functor f) => Integer -> Diff f annotation -> Int +editDistanceUpTo m = diffSum (patchSum termSize) . cutoff m + where diffSum patchCost = sum . fmap (maybe 0 patchCost) + +defaultD, defaultL, defaultP, defaultQ, defaultMoveBound :: Int +defaultD = 15 +-- | How many of the most similar terms to consider, to rule out false positives. +defaultL = 2 +defaultP = 2 +defaultQ = 3 +defaultMoveBound = 2 + +-- | How many nodes to consider for our constant-time approximation to tree edit distance. +defaultM :: Integer +defaultM = 10 + +-- | A term which has not yet been mapped by `rws`, along with its feature vector summary & index. +data UnmappedTerm f fields = UnmappedTerm { + termIndex :: Int -- ^ The index of the term within its root term. + , feature :: FeatureVector -- ^ Feature vector + , term :: Term f (Record fields) -- ^ The unmapped term +} + +-- | Either a `term`, an index of a matched term, or nil. +data TermOrIndexOrNone term = Term term | Index Int | None + +-- | An IntMap of unmapped terms keyed by their position in a list of terms. +type UnmappedTerms f fields = IntMap (UnmappedTerm f fields) + +type FeatureVector = Array Int Double + +-- | A `Gram` is a fixed-size view of some portion of a tree, consisting of a `stem` of _p_ labels for parent nodes, and a `base` of _q_ labels of sibling nodes. Collectively, the bag of `Gram`s for each node of a tree (e.g. as computed by `pqGrams`) form a summary of the tree. +data Gram label = Gram { stem :: [Maybe label], base :: [Maybe label] } + deriving (Eq, Show) + +-- | Annotates a term with a feature vector at each node, using the default values for the p, q, and d parameters. +defaultFeatureVectorDecorator + :: (Hashable label, Traversable f) + => Label f fields label + -> Term f (Record fields) + -> Term f (Record (Maybe FeatureVector ': fields)) +defaultFeatureVectorDecorator getLabel = featureVectorDecorator getLabel defaultP defaultQ defaultD + +-- | Annotates a term with a feature vector at each node, parameterized by stem length, base width, and feature vector dimensions. +featureVectorDecorator :: (Hashable label, Traversable f) => Label f fields label -> Int -> Int -> Int -> Term f (Record fields) -> Term f (Record (Maybe FeatureVector ': fields)) +featureVectorDecorator getLabel p q d + = cata collect + . pqGramDecorator getLabel p q + where collect ((gram :. rest) :< functor) = cofree ((foldl' addSubtermVector (Just (unitVector d (hash gram))) functor :. rest) :< functor) + addSubtermVector :: Functor f => Maybe FeatureVector -> Term f (Record (Maybe FeatureVector ': fields)) -> Maybe FeatureVector + addSubtermVector v term = addVectors <$> v <*> rhead (extract term) + + addVectors :: Num a => Array Int a -> Array Int a -> Array Int a + addVectors as bs = listArray (0, d - 1) (fmap (\ i -> as ! i + bs ! i) [0..(d - 1)]) + +-- | Annotates a term with the corresponding p,q-gram at each node. +pqGramDecorator + :: Traversable f + => Label f fields label -- ^ A function computing the label from an arbitrary unpacked term. This function can use the annotation and functor’s constructor, but not any recursive values inside the functor (since they’re held parametric in 'b'). + -> Int -- ^ 'p'; the desired stem length for the grams. + -> Int -- ^ 'q'; the desired base length for the grams. + -> Term f (Record fields) -- ^ The term to decorate. + -> Term f (Record (Gram label ': fields)) -- ^ The decorated term. +pqGramDecorator getLabel p q = cata algebra + where + algebra term = let label = getLabel term in + cofree ((gram label :. headF term) :< assignParentAndSiblingLabels (tailF term) label) + gram label = Gram (padToSize p []) (padToSize q (pure (Just label))) + assignParentAndSiblingLabels functor label = (`evalState` (replicate (q `div` 2) Nothing <> siblingLabels functor)) (for functor (assignLabels label)) + + assignLabels :: label + -> Term f (Record (Gram label ': fields)) + -> State [Maybe label] (Term f (Record (Gram label ': fields))) + assignLabels label a = case runCofree a of + (gram :. rest) :< functor -> do + labels <- get + put (drop 1 labels) + pure $! cofree ((gram { stem = padToSize p (Just label : stem gram), base = padToSize q labels } :. rest) :< functor) + siblingLabels :: Traversable f => f (Term f (Record (Gram label ': fields))) -> [Maybe label] + siblingLabels = foldMap (base . rhead . extract) + padToSize n list = take n (list <> repeat empty) + +-- | Computes a unit vector of the specified dimension from a hash. +unitVector :: Int -> Int -> FeatureVector +unitVector d hash = fmap (/ magnitude) uniform + where + uniform = listArray (0, d - 1) (evalRand components (pureMT (fromIntegral hash))) + magnitude = sqrtDouble (sum (fmap (** 2) uniform)) + components = sequenceA (replicate d (liftRand randomDouble)) + +-- | Strips the head annotation off a term annotated with non-empty records. +stripTerm :: Functor f => Term f (Record (h ': t)) -> Term f (Record t) +stripTerm = fmap rtail + +-- | Strips the head annotation off a diff annotated with non-empty records. +stripDiff + :: (Functor f, Functor g) + => Free (TermF f (g (Record (h ': t)))) (Patch (Term f (Record (h ': t)))) + -> Free (TermF f (g (Record t))) (Patch (Term f (Record t))) +stripDiff = mapAnnotations rtail + + +-- Instances + +instance Hashable label => Hashable (Gram label) where + hashWithSalt _ = hash + hash gram = hash (stem gram <> base gram) + +instance Listable1 Gram where + liftTiers tiers = liftCons2 (liftTiers (liftTiers tiers)) (liftTiers (liftTiers tiers)) Gram + +instance Listable a => Listable (Gram a) where + tiers = tiers1 diff --git a/src/Data/Record.hs b/src/Data/Record.hs new file mode 100644 index 000000000..bb645fb37 --- /dev/null +++ b/src/Data/Record.hs @@ -0,0 +1,96 @@ +{-# LANGUAGE DataKinds, GADTs, KindSignatures, MultiParamTypeClasses, TypeOperators, ConstraintKinds #-} +module Data.Record where + +import Category +import Data.Aeson +import Data.Aeson.Types +import Data.Functor.Listable +import GHC.Show +import Prologue +import Range +import SourceSpan + +-- | A type alias for HasField constraints commonly used throughout semantic-diff. +type DefaultFields fields = (HasField fields Category, HasField fields Range, HasField fields SourceSpan) + +-- | A type-safe, extensible record structure. +-- | +-- | This is heavily inspired by Aaron Levin’s [Extensible Effects in the van Laarhoven Free Monad](http://aaronlevin.ca/post/136494428283/extensible-effects-in-the-van-laarhoven-free-monad). +data Record :: [*] -> * where + Nil :: Record '[] + (:.) :: h -> Record t -> Record (h ': t) + +infixr 0 :. + +-- | Get the first element of a non-empty record. +rhead :: Record (head ': tail) -> head +rhead (head :. _) = head + +-- | Get the first element of a non-empty record. +rtail :: Record (head ': tail) -> Record tail +rtail (_ :. tail) = tail + + +-- Classes + +-- | HasField enables indexing a Record by (phantom) type tags. +class HasField (fields :: [*]) (field :: *) where + getField :: Record fields -> field + setField :: Record fields -> field -> Record fields + + +-- Instances + +-- OVERLAPPABLE is required for the HasField instances so that we can handle the two cases: either the head of the non-empty h-list is the requested field, or it isn’t. The third possible case (the h-list is empty) is rejected at compile-time. + +instance {-# OVERLAPPABLE #-} HasField fields field => HasField (notIt ': fields) field where + getField (_ :. t) = getField t + setField (h :. t) f = h :. setField t f + +instance {-# OVERLAPPABLE #-} HasField (field ': fields) field where + getField (h :. _) = h + setField (_ :. t) f = f :. t + + +instance (Show h, Show (Record t)) => Show (Record (h ': t)) where + showsPrec n (h :. t) = showParen (n > 0) $ showsPrec 1 h . (" :. " <>) . shows t + +instance Show (Record '[]) where + showsPrec n Nil = showParen (n > 0) ("Nil" <>) + +instance (ToJSON h, ToJSONList (Record t)) => ToJSON (Record (h ': t)) where + toJSON r = toJSONList (toJSONValues r) + +instance ToJSON (Record '[]) where + toJSON _ = emptyArray + +class ToJSONList t where + toJSONValues :: t -> [Value] + +instance (ToJSON h, ToJSONList (Record t)) => ToJSONList (Record (h ': t)) where + toJSONValues (h :. t) = toJSON h : toJSONValues t + +instance ToJSONList (Record '[]) where + toJSONValues _ = [] + + +instance (Eq h, Eq (Record t)) => Eq (Record (h ': t)) where + (h1 :. t1) == (h2 :. t2) = h1 == h2 && t1 == t2 + +instance Eq (Record '[]) where + _ == _ = True + + +instance (Ord h, Ord (Record t)) => Ord (Record (h ': t)) where + (h1 :. t1) `compare` (h2 :. t2) = let h = h1 `compare` h2 in + if h == EQ then t1 `compare` t2 else h + +instance Ord (Record '[]) where + _ `compare` _ = EQ + + +instance (Listable head, Listable (Record tail)) => Listable (Record (head ': tail)) where + tiers = cons2 (:.) + +instance Listable (Record '[]) where + tiers = cons0 Nil diff --git a/src/Data/Text/Listable.hs b/src/Data/Text/Listable.hs new file mode 100644 index 000000000..6e6b6e421 --- /dev/null +++ b/src/Data/Text/Listable.hs @@ -0,0 +1,10 @@ +module Data.Text.Listable where + +import Data.Functor.Listable +import Data.Text +import Prologue + +newtype ListableText = ListableText { unListableText :: Text } + +instance Listable ListableText where + tiers = cons1 (ListableText . pack) diff --git a/src/Diff.hs b/src/Diff.hs index e281f944c..a87c6bde0 100644 --- a/src/Diff.hs +++ b/src/Diff.hs @@ -1,34 +1,60 @@ +{-# LANGUAGE TypeFamilies, TypeSynonymInstances, ScopedTypeVariables #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} module Diff where -import Category -import Control.Monad.Free -import Data.Functor.Both -import Data.Set +import Prologue +import Data.Functor.Foldable as F +import Data.Functor.Both as Both +import Data.Mergeable +import Data.Record import Patch -import Range import Syntax import Term --- | An annotated syntax in a diff tree. -data Annotated a annotation f = Annotated { annotation :: !annotation, syntax :: !(Syntax a f) } - deriving (Functor, Eq, Show, Foldable) - --- | An annotation for a source file, including the source range and semantic --- | categories. -data Info = Info { characterRange :: !Range, categories :: !(Set Category) } - deriving (Eq, Show) - -instance Categorizable Info where - categories = Diff.categories - -- | An annotated series of patches of terms. -type Diff a annotation = Free (Annotated a (Both annotation)) (Patch (Term a annotation)) +type DiffF f annotation = FreeF (TermF f (Both annotation)) (Patch (Term f annotation)) +type Diff f annotation = Free (TermF f (Both annotation)) (Patch (Term f annotation)) --- | Sum the result of a transform applied to all the patches in the diff. -diffSum :: (Patch (Term a annotation) -> Integer) -> Diff a annotation -> Integer +type SyntaxDiff leaf fields = Diff (Syntax leaf) (Record fields) + +type instance Base (Free f a) = FreeF f a +instance Functor f => Recursive (Free f a) where project = runFree +instance Functor f => Corecursive (Free f a) where embed = free + +diffSum :: (Foldable f, Functor f) => (Patch (Term f annotation) -> Int) -> Diff f annotation -> Int diffSum patchCost diff = sum $ fmap patchCost diff --- | The total cost of the diff. --- | This is the number of all leaves in all terms in all patches of the diff. -diffCost :: Diff a annotation -> Integer +-- | The sum of the node count of the diff’s patches. +diffCost :: (Foldable f, Functor f) => Diff f annotation -> Int diffCost = diffSum $ patchSum termSize + +-- | Merge a diff using a function to provide the Term (in Maybe, to simplify recovery of the before/after state) for every Patch. +mergeMaybe :: forall f annotation. Mergeable f => (Patch (Term f annotation) -> Maybe (Term f annotation)) -> (Both annotation -> annotation) -> Diff f annotation -> Maybe (Term f annotation) +mergeMaybe transform extractAnnotation = iter algebra . fmap transform + where algebra :: TermF f (Both annotation) (Maybe (Term f annotation)) -> Maybe (Term f annotation) + algebra (annotations :< syntax) = cofree . (extractAnnotation annotations :<) <$> sequenceAlt syntax + +-- | Recover the before state of a diff. +beforeTerm :: Mergeable f => Diff f annotation -> Maybe (Term f annotation) +beforeTerm = mergeMaybe before Both.fst + +-- | Recover the after state of a diff. +afterTerm :: Mergeable f => Diff f annotation -> Maybe (Term f annotation) +afterTerm = mergeMaybe after Both.snd + + +-- | Map a function over the annotations in a diff, whether in diff or term nodes. +-- +-- Typed using Free so as to accommodate Free structures derived from diffs that don’t fit into the Diff type synonym. +mapAnnotations :: (Functor f, Functor g) + => (annotation -> annotation') + -> Free (TermF f (g annotation)) (Patch (Term f annotation)) + -> Free (TermF f (g annotation')) (Patch (Term f annotation')) +mapAnnotations f = iter (\ (h :< functor) -> wrap (fmap f h :< functor)) . fmap (pure . fmap (fmap f)) + + +-- | Map a function over the annotations of a single diff node, if it is in Free. +modifyAnnotations :: (Functor f, Functor g) => (annotation -> annotation) -> Free (TermF f (g annotation)) a -> Free (TermF f (g annotation)) a +modifyAnnotations f r = case runFree r of + Free (ga :< functor) -> wrap (fmap f ga :< functor) + _ -> r diff --git a/src/DiffOutput.hs b/src/DiffOutput.hs deleted file mode 100644 index 6fd0bb386..000000000 --- a/src/DiffOutput.hs +++ /dev/null @@ -1,34 +0,0 @@ -module DiffOutput where - -import qualified Data.ByteString.Lazy as B -import qualified Data.Text.Lazy.IO as TextIO -import Data.Functor.Both -import Diffing -import Parser -import qualified Renderer.JSON as J -import qualified Renderer.Patch as P -import Renderer.Split -import Source -import System.Directory -import System.FilePath -import qualified System.IO as IO - --- | The available types of diff rendering. -data Format = Split | Patch | JSON - -data DiffArguments = DiffArguments { format :: Format, output :: Maybe FilePath, outputPath :: FilePath } - --- | Return a renderer from the command-line arguments that will print the diff. -printDiff :: Parser -> DiffArguments -> Both SourceBlob -> IO () -printDiff parser arguments sources = case format arguments of - Split -> put (output arguments) =<< diffFiles parser split sources - where - put Nothing rendered = TextIO.putStr rendered - put (Just path) rendered = do - isDir <- doesDirectoryExist path - let outputPath = if isDir - then path (takeFileName outputPath -<.> ".html") - else path - IO.withFile outputPath IO.WriteMode (`TextIO.hPutStr` rendered) - Patch -> putStr =<< diffFiles parser P.patch sources - JSON -> B.putStr =<< diffFiles parser J.json sources diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs new file mode 100644 index 000000000..be800102c --- /dev/null +++ b/src/DiffSummary.hs @@ -0,0 +1,504 @@ +{-# LANGUAGE DataKinds, TypeFamilies, ScopedTypeVariables, DeriveAnyClass #-} +{-# OPTIONS_GHC -funbox-strict-fields #-} +{-# OPTIONS_GHC -Wno-deprecations #-} +-- Disabling deprecation warnings due to pattern match against RescueModifier. + +module DiffSummary (diffSummaries, DiffSummary(..), DiffInfo(..), diffToDiffSummaries, isBranchInfo, isErrorSummary, JSONSummary(..)) where + +import Prologue +import Diff +import Patch +import Term +import Info (category, characterRange) +import Range +import Syntax as S +import Category as C +import Data.Functor.Both hiding (fst, snd) +import qualified Data.Functor.Both as Both +import Data.Functor.Listable +import Data.List.NonEmpty (nonEmpty) +import qualified Data.Text as Text +import Data.Text.Listable +import Data.Record +import Data.These +import Text.PrettyPrint.Leijen.Text ((<+>), squotes, space, string, Doc, punctuate, pretty, hsep) +import qualified Text.PrettyPrint.Leijen.Text as P +import SourceSpan +import Source +import Data.Aeson as A + +data Annotatable a = Annotatable a | Unannotatable a + +annotatable :: SyntaxTerm leaf fields -> Annotatable (SyntaxTerm leaf fields) +annotatable term = isAnnotatable (unwrap term) term + where isAnnotatable = \case + S.Class{} -> Annotatable + S.Method{} -> Annotatable + S.Function{} -> Annotatable + S.Module{} -> Annotatable + _ -> Unannotatable + +data Identifiable a = Identifiable a | Unidentifiable a + +identifiable :: SyntaxTerm leaf fields -> Identifiable (SyntaxTerm leaf fields) +identifiable term = isIdentifiable (unwrap term) term + where isIdentifiable = \case + S.FunctionCall{} -> Identifiable + S.MethodCall{} -> Identifiable + S.Function{} -> Identifiable + S.Assignment{} -> Identifiable + S.OperatorAssignment{} -> Identifiable + S.VarAssignment{} -> Identifiable + S.SubscriptAccess{} -> Identifiable + S.Module{} -> Identifiable + S.Class{} -> Identifiable + S.Method{} -> Identifiable + S.Leaf{} -> Identifiable + S.DoWhile{} -> Identifiable + S.Import{} -> Identifiable + S.Export{} -> Identifiable + S.Ternary{} -> Identifiable + S.If{} -> Identifiable + S.Try{} -> Identifiable + S.Switch{} -> Identifiable + S.Rescue{} -> Identifiable + S.Pair{} -> Identifiable + S.Array ty _ -> maybe Unidentifiable (const Identifiable) ty + S.Object ty _ -> maybe Unidentifiable (const Identifiable) ty + S.BlockStatement{} -> Identifiable + S.TypeDecl{} -> Identifiable + S.Ty{} -> Identifiable + _ -> Unidentifiable + +data JSONSummary summary span = JSONSummary { summary :: summary, span :: span } + | ErrorSummary { summary :: summary, span :: span } + deriving (Generic, Eq, Show) + +instance (ToJSON summary, ToJSON span) => ToJSON (JSONSummary summary span) where + toJSON JSONSummary{..} = object [ "summary" .= summary, "span" .= span ] + toJSON ErrorSummary{..} = object [ "summary" .= summary, "span" .= span ] + +isErrorSummary :: JSONSummary summary span -> Bool +isErrorSummary ErrorSummary{} = True +isErrorSummary _ = False + +data DiffInfo = LeafInfo { leafCategory :: Category, termName :: Text, sourceSpan :: SourceSpan } + | BranchInfo { branches :: [ DiffInfo ], branchCategory :: Category, branchType :: Branch } + | ErrorInfo { errorSpan :: SourceSpan, termName :: Text } + | HideInfo -- Hide/Strip from summary output entirely. + deriving (Eq, Show) + +data Branch = BIndexed | BFixed | BCommented | BIf deriving (Show, Eq, Generic) + +data DiffSummary a = DiffSummary { + patch :: Patch a, + parentAnnotation :: [Either (Category, Text) (Category, Text)] +} deriving (Eq, Functor, Show, Generic) + +-- Returns a list of diff summary texts given two source blobs and a diff. +diffSummaries :: (StringConv leaf Text, DefaultFields fields) => Both SourceBlob -> SyntaxDiff leaf fields -> [JSONSummary Text SourceSpans] +diffSummaries blobs diff = summaryToTexts =<< diffToDiffSummaries (source <$> blobs) diff + +-- Takes a 'DiffSummary DiffInfo' and returns a list of JSON Summaries whose text summaries represent the LeafInfo summaries of the 'DiffSummary'. +summaryToTexts :: DiffSummary DiffInfo -> [JSONSummary Text SourceSpans] +summaryToTexts DiffSummary{..} = appendParentContexts <$> summaries patch + where appendParentContexts jsonSummary = + jsonSummary { summary = show $ summary jsonSummary <+> parentContexts parentAnnotation } + +-- Returns a list of 'DiffSummary' given two source blobs and a diff. +diffToDiffSummaries :: (StringConv leaf Text, DefaultFields fields) => Both (Source Char) -> SyntaxDiff leaf fields -> [DiffSummary DiffInfo] +diffToDiffSummaries sources = para $ \diff -> + let + diff' = free (Prologue.fst <$> diff) + annotateWithCategory :: [DiffSummary DiffInfo] -> [DiffSummary DiffInfo] + annotateWithCategory children = case (beforeTerm diff', afterTerm diff') of + (_, Just diff'') -> appendSummary (Both.snd sources) diff'' <$> children + (Just diff'', _) -> appendSummary (Both.fst sources) diff'' <$> children + (Nothing, Nothing) -> [] + in case diff of + -- Skip comments and leaves since they don't have any changes + (Free (_ :< syntax)) -> annotateWithCategory (toList syntax >>= snd) + (Pure patch) -> [ DiffSummary (mapPatch (termToDiffInfo beforeSource) (termToDiffInfo afterSource) patch) [] ] + where + (beforeSource, afterSource) = runJoin sources + +-- Flattens a patch of diff infos into a list of docs, one for every 'LeafInfo' or `ErrorInfo` it contains. +summaries :: Patch DiffInfo -> [JSONSummary Doc SourceSpans] +summaries = \case + p@(Replace i1 i2) -> zipWith (\a b -> + JSONSummary + { + summary = summary (prefixWithPatch p This a) <+> "with" <+> summary b + , span = SourceSpans $ These (span a) (span b) + }) (toLeafInfos i1) (toLeafInfos i2) + p@(Insert info) -> prefixWithPatch p That <$> toLeafInfos info + p@(Delete info) -> prefixWithPatch p This <$> toLeafInfos info + +-- Prefixes a given doc with the type of patch it represents. +prefixWithPatch :: Patch DiffInfo -> (SourceSpan -> These SourceSpan SourceSpan) -> JSONSummary Doc SourceSpan -> JSONSummary Doc SourceSpans +prefixWithPatch patch constructor = prefixWithThe (patchToPrefix patch) + where + prefixWithThe prefix jsonSummary = jsonSummary + { + summary = prefix <+> summary jsonSummary + , span = SourceSpans $ constructor (span jsonSummary) + } + patchToPrefix = \case + (Replace _ _) -> "Replaced" + (Insert _) -> "Added" + (Delete _) -> "Deleted" + +toLeafInfos :: DiffInfo -> [JSONSummary Doc SourceSpan] +toLeafInfos err@ErrorInfo{..} = pure $ ErrorSummary (pretty err) errorSpan +toLeafInfos BranchInfo{..} = branches >>= toLeafInfos +toLeafInfos HideInfo = [] +toLeafInfos LeafInfo{..} = pure $ JSONSummary (summary leafCategory termName) sourceSpan + where + summary :: Category -> Text -> Doc + summary category termName = case category of + C.NumberLiteral -> squotes $ toDoc termName + C.IntegerLiteral -> squotes $ toDoc termName + C.Boolean -> squotes $ toDoc termName + C.StringLiteral -> termAndCategoryName + C.Export -> termAndCategoryName + C.Import -> termAndCategoryName + C.Subshell -> termAndCategoryName + C.AnonymousFunction -> "an" <+> toDoc termName <+> "function" + C.Begin -> categoryName' + C.Select -> categoryName' + C.Else -> categoryName' + C.Ensure -> categoryName' + C.Break -> categoryName' + C.Continue -> categoryName' + C.BeginBlock -> categoryName' + C.EndBlock -> categoryName' + C.Yield | Text.null termName -> categoryName' + C.Return | Text.null termName -> categoryName' + C.Switch | Text.null termName -> categoryName' + _ -> "the" <+> squotes (toDoc termName) <+> toDoc categoryName + where + termAndCategoryName = "the" <+> toDoc termName <+> toDoc categoryName + categoryName = toCategoryName category + categoryName' = case categoryName of + name | startsWithVowel name -> "an" <+> toDoc name + | otherwise -> "a" <+> toDoc name + startsWithVowel text = getAny $ foldMap (Any . flip Text.isPrefixOf text) vowels + vowels = Text.singleton <$> ("aeiouAEIOU" :: [Char]) + +-- Returns a text representing a specific term given a source and a term. +toTermName :: forall leaf fields. (StringConv leaf Text, DefaultFields fields) => Source Char -> SyntaxTerm leaf fields -> Text +toTermName source term = case unwrap term of + S.Send _ _ -> termNameFromSource term + S.Ty _ -> termNameFromSource term + S.TypeDecl id _ -> toTermName' id + S.TypeAssertion _ _ -> termNameFromSource term + S.TypeConversion _ _ -> termNameFromSource term + S.Go expr -> toTermName' expr + S.Defer expr -> toTermName' expr + S.AnonymousFunction params _ -> "anonymous" <> paramsToArgNames params + S.Fixed children -> termNameFromChildren term children + S.Indexed children -> maybe "branch" sconcat (nonEmpty (intersperse ", " (toTermName' <$> children))) + Leaf leaf -> toS leaf + S.Assignment identifier _ -> toTermName' identifier + S.Function identifier _ _ _ -> toTermName' identifier + S.ParameterDecl _ _ -> termNameFromSource term + S.FunctionCall i args -> case unwrap i of + S.AnonymousFunction params _ -> + -- Omit a function call's arguments if it's arguments match the underlying + -- anonymous function's arguments. + if (category . extract <$> args) == (category . extract <$> params) + then toTermName' i + else "(" <> toTermName' i <> ")" <> paramsToArgNames args + _ -> toTermName' i <> paramsToArgNames args + S.MemberAccess base property -> case (unwrap base, unwrap property) of + (S.FunctionCall{}, S.FunctionCall{}) -> toTermName' base <> "()." <> toTermName' property <> "()" + (S.FunctionCall{}, _) -> toTermName' base <> "()." <> toTermName' property + (_, S.FunctionCall{}) -> toTermName' base <> "." <> toTermName' property <> "()" + (_, _) -> toTermName' base <> "." <> toTermName' property + S.MethodCall targetId methodId methodParams -> toTermName' targetId <> sep <> toTermName' methodId <> paramsToArgNames methodParams + where sep = case unwrap targetId of + S.FunctionCall{} -> "()." + _ -> "." + S.SubscriptAccess base element -> case (unwrap base, unwrap element) of + (S.FunctionCall{}, S.FunctionCall{}) -> toTermName' base <> "()." <> toTermName' element <> "()" + (S.FunctionCall{}, _) -> toTermName' base <> "()." <> toTermName' element + (_, S.FunctionCall{}) -> toTermName' base <> "[" <> toTermName' element <> "()" <> "]" + (S.Indexed _, _) -> case category . extract $ base of + SliceTy -> termNameFromSource base <> toTermName' element + _ -> toTermName' base <> "[" <> toTermName' element <> "]" + (_, _) -> toTermName' base <> "[" <> toTermName' element <> "]" + S.VarAssignment varId _ -> toTermName' varId + S.VarDecl decl _ -> toTermName' decl + -- TODO: We should remove Case from Syntax since I don't think we should ever + -- evaluate Case as a single toTermName Text - joshvera + S.Case expr _ -> termNameFromSource expr + S.Switch exprs _ -> maybe "" toTermName' (fmap snd (unsnoc exprs)) + S.Ternary expr _ -> toTermName' expr + S.OperatorAssignment id _ -> toTermName' id + S.Operator _ -> termNameFromSource term + S.Object ty kvs -> maybe ("{ " <> Text.intercalate ", " (toTermName' <$> kvs) <> " }") termNameFromSource ty + S.Pair k v -> toKeyName k <> toArgName v + S.Return children -> Text.intercalate ", " (termNameFromSource <$> children) + S.Yield children -> Text.intercalate ", " (termNameFromSource <$> children) + S.ParseError _ -> termNameFromSource term + S.If expr _ -> termNameFromSource expr + S.For clauses _ -> termNameFromChildren term clauses + S.While expr _ -> toTermName' expr + S.DoWhile _ expr -> toTermName' expr + S.Throw expr -> termNameFromSource expr + S.Constructor expr -> toTermName' expr + S.Try clauses _ _ _ -> termNameFromChildren term clauses + S.Select clauses -> termNameFromChildren term clauses + S.Array ty _ -> maybe (termNameFromSource term) termNameFromSource ty + S.Class identifier _ _ -> toTermName' identifier + S.Method identifier (Just receiver) _ args _ -> termNameFromSource receiver <> "." <> toTermName' identifier <> paramsToArgNames args + S.Method identifier Nothing _ args _ -> toTermName' identifier <> paramsToArgNames args + S.Comment a -> toS a + S.Commented _ _ -> termNameFromChildren term (toList $ unwrap term) + S.Module identifier _ -> toTermName' identifier + S.Import identifier [] -> termNameFromSource identifier + S.Import identifier exprs -> termNameFromChildren term exprs <> " from " <> toTermName' identifier + S.Export Nothing expr -> "{ " <> Text.intercalate ", " (termNameFromSource <$> expr) <> " }" + S.Export (Just identifier) [] -> "{ " <> toTermName' identifier <> " }" + S.Export (Just identifier) expr -> "{ " <> Text.intercalate ", " (termNameFromSource <$> expr) <> " }" <> " from " <> toTermName' identifier + S.Negate expr -> toTermName' expr + S.Struct ty _ -> maybe (termNameFromSource term) termNameFromSource ty + S.Rescue args _ -> Text.intercalate ", " $ toTermName' <$> args + S.Break expr -> maybe "" toTermName' expr + S.Continue expr -> maybe "" toTermName' expr + S.BlockStatement children -> termNameFromChildren term children + S.DefaultCase children -> termNameFromChildren term children + S.FieldDecl id expr tag -> termNameFromSource id <> maybe "" (\expr' -> " " <> termNameFromSource expr') expr <> maybe "" ((" " <>) . termNameFromSource) tag + where toTermName' = toTermName source + termNameFromChildren term children = termNameFromRange (unionRangesFrom (range term) (range <$> children)) + termNameFromSource term = termNameFromRange (range term) + termNameFromRange range = toText $ Source.slice range source + range = characterRange . extract + paramsToArgNames params = "(" <> Text.intercalate ", " (toArgName <$> params) <> ")" + toArgName :: SyntaxTerm leaf fields -> Text + toArgName arg = case identifiable arg of + Identifiable arg -> toTermName' arg + Unidentifiable _ -> "…" + toKeyName key = case toTermName' key of + n | Text.head n == ':' -> n <> " => " + n -> n <> ": " + +parentContexts :: [Either (Category, Text) (Category, Text)] -> Doc +parentContexts contexts = hsep $ either identifiableDoc annotatableDoc <$> contexts + where + identifiableDoc (c, t) = case c of + C.Assignment -> "in an" <+> catName c <+> "to" <+> termName t + C.Select -> "in a" <+> catName c + C.Begin -> "in a" <+> catName c + C.Else -> "in an" <+> catName c + C.Elsif -> "in the" <+> squotes (termName t) <+> catName c + C.Method -> "in the" <+> squotes (termName t) <+> catName c + C.Ternary -> "in the" <+> squotes (termName t) <+> catName c + C.Ensure -> "in an" <+> catName c + C.Rescue -> case t of + "" -> "in a" <+> catName c + _ -> "in the" <+> squotes (termName t) <+> catName c + C.Modifier C.Rescue -> "in the" <+> squotes ("rescue" <+> termName t) <+> "modifier" + C.If -> "in the" <+> squotes (termName t) <+> catName c + C.Case -> "in the" <+> squotes (termName t) <+> catName c + C.Break -> case t of + "" -> "in a" <+> catName c + _ -> "in the" <+> squotes (termName t) <+> catName c + C.Continue -> case t of + "" -> "in a" <+> catName c + _ -> "in the" <+> squotes (termName t) <+> catName c + C.Switch -> case t of + "" -> "in a" <+> catName c + _ -> "in the" <+> squotes (termName t) <+> catName c + C.When -> "in a" <+> catName c + C.BeginBlock -> "in a" <+> catName c + C.EndBlock -> "in an" <+> catName c + C.DefaultCase -> "in a" <+> catName c + C.TypeDecl -> "in the" <+> squotes (termName t) <+> catName c + _ -> "in the" <+> termName t <+> catName c + annotatableDoc (c, t) = "of the" <+> squotes (termName t) <+> catName c + catName = toDoc . toCategoryName + termName = toDoc + +toDoc :: Text -> Doc +toDoc = string . toS + +termToDiffInfo :: (StringConv leaf Text, DefaultFields fields) => Source Char -> SyntaxTerm leaf fields -> DiffInfo +termToDiffInfo blob term = case unwrap term of + S.Indexed children -> BranchInfo (termToDiffInfo' <$> children) (category $ extract term) BIndexed + S.Fixed children -> BranchInfo (termToDiffInfo' <$> children) (category $ extract term) BFixed + S.AnonymousFunction _ _ -> LeafInfo C.AnonymousFunction (toTermName' term) (getField $ extract term) + S.Comment _ -> HideInfo + S.Commented cs leaf -> BranchInfo (termToDiffInfo' <$> cs <> maybeToList leaf) (category $ extract term) BCommented + S.ParseError _ -> ErrorInfo (getField $ extract term) (toTermName' term) + _ -> toLeafInfo term + where toTermName' = toTermName blob + termToDiffInfo' = termToDiffInfo blob + toLeafInfo term = LeafInfo (category $ extract term) (toTermName' term) (getField $ extract term) + +-- | Append a parentAnnotation to the current DiffSummary instance. +-- | For a DiffSummary without a parentAnnotation, we append a parentAnnotation with the first identifiable term. +-- | For a DiffSummary with a parentAnnotation, we append the next annotatable term to the extant parentAnnotation. +-- | If a DiffSummary already has a parentAnnotation, and a (grand) parentAnnotation, then we return the summary without modification. +appendSummary :: (StringConv leaf Text, DefaultFields fields) => Source Char -> SyntaxTerm leaf fields -> DiffSummary DiffInfo -> DiffSummary DiffInfo +appendSummary source term summary = + case (parentAnnotation summary, identifiable term, annotatable term) of + ([], Identifiable _, _) -> appendParentAnnotation Left + ([_], _, Annotatable _) -> appendParentAnnotation Right + (_, _, _) -> summary + where + appendParentAnnotation constructor = summary + { parentAnnotation = parentAnnotation summary <> [ constructor (category (extract term), toTermName source term) ] } + +isBranchInfo :: DiffInfo -> Bool +isBranchInfo info = case info of + BranchInfo{} -> True + _ -> False + +-- The user-facing category name of 'a'. +class HasCategory a where + toCategoryName :: a -> Text + +-- Instances + +instance HasCategory Text where + toCategoryName = identity + +instance HasCategory Category where + toCategoryName = \case + ArrayLiteral -> "array" + BooleanOperator -> "boolean operator" + MathOperator -> "math operator" + BitwiseOperator -> "bitwise operator" + RelationalOperator -> "relational operator" + Boolean -> "boolean" + DictionaryLiteral -> "dictionary" + C.Comment -> "comment" + C.ParseError -> "error" + ExpressionStatements -> "expression statements" + C.Assignment -> "assignment" + C.Function -> "function" + C.FunctionCall -> "function call" + C.MemberAccess -> "member access" + C.MethodCall -> "method call" + C.Args -> "arguments" + C.VarAssignment -> "var assignment" + C.VarDecl -> "variable" + C.Switch -> "switch statement" + C.Case -> "case statement" + C.SubscriptAccess -> "subscript access" + C.MathAssignment -> "math assignment" + C.Ternary -> "ternary expression" + C.Operator -> "operator" + Identifier -> "identifier" + IntegerLiteral -> "integer" + NumberLiteral -> "number" + FloatLiteral -> "float" + Other s -> s + C.Pair -> "pair" + C.Params -> "params" + Program -> "top level" + Regex -> "regex" + StringLiteral -> "string" + SymbolLiteral -> "symbol" + TemplateString -> "template string" + C.For -> "for statement" + C.While -> "while statement" + C.DoWhile -> "do/while statement" + C.Object -> "object" + C.Return -> "return statement" + C.Throw -> "throw statement" + C.Constructor -> "constructor" + C.Catch -> "catch statement" + C.Try -> "try statement" + C.Finally -> "finally statement" + C.Class -> "class" + C.Method -> "method" + C.If -> "if statement" + C.CommaOperator -> "comma operator" + C.Empty -> "empty statement" + C.Module -> "module" + C.Import -> "import statement" + C.Export -> "export statement" + C.AnonymousFunction -> "anonymous function" + C.Interpolation -> "interpolation" + C.Subshell -> "subshell command" + C.OperatorAssignment -> "operator assignment" + C.Yield -> "yield statement" + C.Until -> "until statement" + C.Unless -> "unless statement" + C.Begin -> "begin statement" + C.Else -> "else block" + C.Elsif -> "elsif block" + C.Ensure -> "ensure block" + C.Rescue -> "rescue block" + C.RescueModifier -> "rescue modifier" + C.When -> "when comparison" + C.RescuedException -> "last exception" + C.RescueArgs -> "arguments" + C.Negate -> "negate" + C.Select -> "select statement" + C.Go -> "go statement" + C.Slice -> "slice literal" + C.Defer -> "defer statement" + C.TypeAssertion -> "type assertion statement" + C.TypeConversion -> "type conversion expression" + C.ArgumentPair -> "argument" + C.KeywordParameter -> "parameter" + C.OptionalParameter -> "parameter" + C.SplatParameter -> "parameter" + C.HashSplatParameter -> "parameter" + C.BlockParameter -> "parameter" + C.ArrayTy -> "array type" + C.DictionaryTy -> "dictionary type" + C.StructTy -> "struct type" + C.Struct -> "struct" + C.Break -> "break statement" + C.Continue -> "continue statement" + C.Binary -> "binary statement" + C.Unary -> "unary statement" + C.Constant -> "constant" + C.Superclass -> "superclass" + C.SingletonClass -> "singleton class" + C.RangeExpression -> "range" + C.ScopeOperator -> "scope operator" + C.BeginBlock -> "BEGIN block" + C.EndBlock -> "END block" + C.ParameterDecl -> "parameter declaration" + C.DefaultCase -> "default statement" + C.TypeDecl -> "type declaration" + C.PointerTy -> "pointer type" + C.FieldDecl -> "field declaration" + C.SliceTy -> "slice type" + C.Element -> "element" + C.Literal -> "literal" + C.ChannelTy -> "channel type" + C.Send -> "send statement" + C.IndexExpression -> "index expression" + C.FunctionTy -> "function type" + C.IncrementStatement -> "increment statement" + C.DecrementStatement -> "decrement statement" + C.QualifiedIdentifier -> "qualified identifier" + C.FieldDeclarations -> "field declarations" + C.RuneLiteral -> "rune literal" + C.Modifier C.Rescue -> "rescue modifier" + C.Modifier c -> toCategoryName c + +instance HasField fields Category => HasCategory (SyntaxTerm leaf fields) where + toCategoryName = toCategoryName . category . extract + +instance Listable Branch where + tiers = cons0 BIndexed \/ cons0 BFixed \/ cons0 BCommented \/ cons0 BIf + +instance Listable1 DiffSummary where + liftTiers termTiers = liftCons2 (liftTiers termTiers) (liftTiers (eitherTiers (liftTiers (mapT unListableText tiers)))) DiffSummary + where eitherTiers tiers = liftTiers2 tiers tiers + +instance Listable a => Listable (DiffSummary a) where + tiers = tiers1 + +instance P.Pretty DiffInfo where + pretty LeafInfo{..} = squotes (string $ toSL termName) <+> string (toSL (toCategoryName leafCategory)) + pretty BranchInfo{..} = mconcat $ punctuate (string "," P.<> space) (pretty <$> branches) + pretty ErrorInfo{..} = squotes (string $ toSL termName) <+> "at" <+> (string . toSL $ displayStartEndPos errorSpan) + pretty HideInfo = "" diff --git a/src/Diffing.hs b/src/Diffing.hs index 60d92d053..6f684b34d 100644 --- a/src/Diffing.hs +++ b/src/Diffing.hs @@ -1,78 +1,128 @@ +{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} module Diffing where -import Diff -import Interpreter -import Language -import Parser -import Range -import Renderer -import Source hiding ((++)) -import Syntax -import Term -import TreeSitter -import Text.Parser.TreeSitter.Language - -import Control.Comonad.Cofree +import Prologue hiding (fst, snd) +import Category import Data.Functor.Both -import qualified Data.ByteString.Char8 as B1 -import Data.Foldable -import qualified Data.Text as T -import qualified Data.Text.ICU.Detect as Detect -import qualified Data.Text.ICU.Convert as Convert +import Data.RandomWalkSimilarity (defaultFeatureVectorDecorator, stripDiff) +import Data.Record +import qualified Data.Text.IO as TextIO +import Data.These +import Diff +import Info +import Interpreter +import Patch +import Parser +import Renderer +import Renderer.JSON +import Renderer.Patch +import Renderer.Split +import Renderer.Summary +import Renderer.SExpression +import Renderer.TOC +import Source +import Syntax +import System.Directory import System.FilePath - --- | Return a parser based on the file extension (including the "."). -parserForType :: T.Text -> Parser -parserForType mediaType = case languageForType mediaType of - Just C -> treeSitterParser C ts_language_c - Just JavaScript -> treeSitterParser JavaScript ts_language_javascript - Just Ruby -> treeSitterParser Ruby ts_language_ruby - _ -> lineByLineParser - --- | A fallback parser that treats a file simply as rows of strings. -lineByLineParser :: Parser -lineByLineParser input = return . root . Indexed $ case foldl' annotateLeaves ([], 0) lines of - (leaves, _) -> leaves - where - lines = actualLines input - root syntax = Info (Range 0 $ length input) mempty :< syntax - leaf charIndex line = Info (Range charIndex $ charIndex + T.length line) mempty :< Leaf line - annotateLeaves (accum, charIndex) line = - (accum ++ [ leaf charIndex (toText line) ] - , charIndex + length line) - toText = T.pack . Source.toString - --- | Return the parser that should be used for a given path. -parserForFilepath :: FilePath -> Parser -parserForFilepath = parserForType . T.pack . takeExtension - --- | Replace every string leaf with leaves of the words in the string. -breakDownLeavesByWord :: Source Char -> Term T.Text Info -> Term T.Text Info -breakDownLeavesByWord source = cata replaceIn - where - replaceIn info@(Info range categories) (Leaf _) | ranges <- rangesAndWordsInSource range, length ranges > 1 = info :< Indexed (makeLeaf categories <$> ranges) - replaceIn info syntax = info :< syntax - rangesAndWordsInSource range = rangesAndWordsFrom (start range) (toString $ slice range source) - makeLeaf categories (range, substring) = Info range categories :< Leaf (T.pack substring) - --- | Transcode a file to a unicode source. -transcode :: B1.ByteString -> IO (Source Char) -transcode text = fromText <$> do - match <- Detect.detectCharset text - converter <- Convert.open match Nothing - return $ Convert.toUnicode converter text - --- | Read the file and convert it to Unicode. -readAndTranscodeFile :: FilePath -> IO (Source Char) -readAndTranscodeFile path = do - text <- B1.readFile path - transcode text +import qualified System.IO as IO +import System.Environment (lookupEnv) +import Term +import Data.Aeson (ToJSON, toJSON, toEncoding) +import Data.Aeson.Encoding (encodingToLazyByteString) -- | Given a parser and renderer, diff two sources and return the rendered -- | result. -diffFiles :: Parser -> Renderer T.Text b -> Both SourceBlob -> IO b -diffFiles parser renderer sourceBlobs = do - let sources = source <$> sourceBlobs - terms <- sequence $ parser <$> sources - let replaceLeaves = breakDownLeavesByWord <$> sources - return $ renderer (runBothWith diffTerms $ replaceLeaves <*> terms) sourceBlobs +-- | Returns the rendered result strictly, so it's always fully evaluated +-- | with respect to other IO actions. +diffFiles :: (HasField fields Category, HasField fields Cost) + => Parser (Syntax Text) (Record fields) + -> Renderer (Record fields) + -> Both SourceBlob + -> IO Output +diffFiles parse render sourceBlobs = do + terms <- traverse (fmap (defaultFeatureVectorDecorator getLabel) . parse) sourceBlobs + pure $! render sourceBlobs (stripDiff (diffTerms' terms)) + + where + diffTerms' terms = case runBothWith areNullOids sourceBlobs of + (True, False) -> pure $ Insert (snd terms) + (False, True) -> pure $ Delete (fst terms) + (_, _) -> + runBothWith (diffTerms construct compareCategoryEq diffCostWithCachedTermCosts) terms + areNullOids a b = (hasNullOid a, hasNullOid b) + hasNullOid blob = oid blob == nullOid || null (source blob) + construct (info :< syntax) = free (Free ((setCost <$> info <*> sumCost syntax) :< syntax)) + sumCost = fmap getSum . foldMap (fmap Sum . getCost) + getCost diff = case runFree diff of + Free (info :< _) -> cost <$> info + Pure patch -> uncurry both (fromThese 0 0 (unPatch (cost . extract <$> patch))) + +getLabel :: HasField fields Category => CofreeF (Syntax leaf) (Record fields) b -> (Category, Maybe leaf) +getLabel (h :< t) = (category h, case t of + Leaf s -> Just s + _ -> Nothing) + +-- | Determine whether two terms are comparable based on the equality of their categories. +compareCategoryEq :: Functor f => HasField fields Category => Term f (Record fields) -> Term f (Record fields) -> Bool +compareCategoryEq = (==) `on` category . extract + +-- | The sum of the node count of the diff’s patches. +diffCostWithCachedTermCosts :: Functor f => HasField fields Cost => Diff f (Record fields) -> Int +diffCostWithCachedTermCosts diff = unCost $ case runFree diff of + Free (info :< _) -> sum (cost <$> info) + Pure patch -> sum (cost . extract <$> patch) + +-- | Returns a rendered diff given a parser, diff arguments and two source blobs. +textDiff :: (ToJSON (Record fields), DefaultFields fields, HasField fields Cost) => Parser (Syntax Text) (Record fields) -> DiffArguments -> Both SourceBlob -> IO Output +textDiff parser arguments = diffFiles parser $ case format arguments of + Split -> split + Patch -> patch + SExpression -> sExpression + JSON -> json + Summary -> summary + TOC -> toc + +-- | Returns a truncated diff given diff arguments and two source blobs. +truncatedDiff :: DiffArguments -> Both SourceBlob -> IO Output +truncatedDiff arguments sources = pure $ case format arguments of + Split -> SplitOutput mempty + Patch -> PatchOutput (truncatePatch arguments sources) + SExpression -> SExpressionOutput mempty + JSON -> JSONOutput mempty + Summary -> SummaryOutput mempty + TOC -> TOCOutput mempty + +-- | Prints a rendered diff to stdio or a filepath given a parser, diff arguments and two source blobs. +printDiff :: (ToJSON (Record fields), DefaultFields fields, HasField fields Cost) => Parser (Syntax Text) (Record fields) -> DiffArguments -> Both SourceBlob -> IO () +printDiff parser arguments sources = do + rendered <- textDiff parser arguments sources + writeToOutput (output arguments) $ + case rendered of + SplitOutput text -> text + PatchOutput text -> text + SExpressionOutput text -> text + JSONOutput series -> encodingToText (toJSON series) + SummaryOutput summaries -> encodingToText (toJSON summaries) + TOCOutput summaries -> encodingToText (toJSON summaries) + where + -- TODO: Don't go from Value to Text? + encodingToText = toS . encodingToLazyByteString . toEncoding + +-- | Writes text to an output file or stdout. +writeToOutput :: Maybe FilePath -> Text -> IO () +writeToOutput output text = + case output of + Nothing -> do + lang <- lookupEnv "LANG" + case lang of + -- If LANG is set and isn't the empty string, leave the encoding. + Just x | x /= "" -> pure () + -- Otherwise default to utf8. + _ -> IO.hSetEncoding IO.stdout IO.utf8 + TextIO.hPutStrLn IO.stdout text + Just path -> do + isDir <- doesDirectoryExist path + let outputPath = if isDir + then path (takeFileName outputPath -<.> ".html") + else path + IO.withFile outputPath IO.WriteMode (`TextIO.hPutStr` text) diff --git a/src/FDoc/NatExample.hs b/src/FDoc/NatExample.hs new file mode 100644 index 000000000..c94eeb414 --- /dev/null +++ b/src/FDoc/NatExample.hs @@ -0,0 +1,60 @@ +module FDoc.NatExample where + +import Prologue +import Data.Functor.Foldable + +-- Our base Functor. The recursive bit is parameterized by r. +data NatF r = + ZeroF + | SuccF r + deriving (Show, Functor) + +-- Fix represents the "fixed point" for the NatF Functor, and enables recursion. +-- Important to note this has kind * -> *. +type Nat = Fix NatF + +-- This is a fully applied type (Has kind *). +zero' :: Nat +zero' = Fix ZeroF + +-- This is a partially applied type (has kind * -> *). The recursive bit is used +-- by recursion schemes and is referred to as the "carrier" functor. +succ' :: Nat -> Nat +succ' = Fix . SuccF + +-- Catamorphism: "tear down" a recursive structure in the shape of Nat. +natToIntCata :: Nat -> Int +natToIntCata nats = cata algebra nats + where + algebra term = case term of + ZeroF -> 0 + SuccF value -> 1 + value + +-- Anamorphism: "build up" a recursive structure in the shape of Nat. +intToNatAna :: Int -> Nat +intToNatAna num = ana coalgebra num + where + coalgebra num = case num of + 0 -> ZeroF + _ -> SuccF (num - 1) + +-- Hylomorphism: first apply an anamorphism and then a catamorphism in the shape +-- of Nat. +natHylo :: Int -> Int +natHylo num = hylo algebra coalgebra num + where + algebra term = case term of + ZeroF -> 0 + SuccF value -> 1 + value + coalgebra num = case num of + 0 -> ZeroF + _ -> SuccF (num - 1) + +-- Paramorphism: primitive recursion maintaining the original value along with +-- its computed value. +natPara :: Nat -> Int +natPara nats = para algebra nats + where + algebra value = case value of + ZeroF -> 0 + (SuccF (_, value')) -> 1 + value' diff --git a/src/FDoc/RecursionSchemes.hs b/src/FDoc/RecursionSchemes.hs new file mode 100644 index 000000000..772c6677c --- /dev/null +++ b/src/FDoc/RecursionSchemes.hs @@ -0,0 +1,186 @@ +{-# LANGUAGE DataKinds, ScopedTypeVariables, TypeFamilies, TypeOperators #-} +module FDoc.RecursionSchemes where + +import Data.Record +import Range +import Category +import Term +import Syntax +import Prologue +import Prelude +import FDoc.Term + +data NewField = NewField deriving (Show) + +{- +Anamorphism -- add a new field to each term's Record fields + +ana :: (a -> Base t a) -- a (Base t)-coalgebra + -> a -- seed + -> t -- resulting fixed point + +Anamorphism as a recursion scheme "builds up" a recursive structure. +Anamorphisms work by using a coalgebra, which maps a seed value to a fixed point +structure. + +The example below adds a new field to the `Record` fields. +-} +indexedTermAna :: [leaf] -> Term (Syntax leaf) (Record '[NewField, Range, Category]) +indexedTermAna childrenLeaves = ana coalgebra (indexedTerm childrenLeaves) + where + coalgebra term = (NewField :. (extract term)) :< unwrap term + +{- +Catamorphism example -- add a new field to each term's Record fields + +cata :: (Base t a -> a) -- a (Base t)-algebra + -> t -- fixed point + -> a -- result + +Catamorphism as a recursion scheme "tears down" a recursive structure. +Catamorphisms work by using an algebra, which maps a shape in our fixed point +structure to a new shape. + +The example below adds a new field to the `Record` fields. +-} +indexedTermCata :: [leaf] -> Term (Syntax leaf) (Record '[NewField, Range, Category]) +indexedTermCata childrenLeaves = cata algebra (indexedTerm childrenLeaves) + where + algebra :: CofreeF f (Record t) (Cofree f (Record (NewField : t))) -> Cofree f (Record (NewField : t)) + algebra term = cofree $ (NewField :. (headF term)) :< tailF term + +{- +Anamorphism -- construct a Term from a string + +The example below shows how to build up a recursive Term structure from a string +representation. + +Example usage: + +stringToTermAna "indexed" => + CofreeT (Identity ( (Range {start = 1, end = 10} :. MethodCall :. Nil) + :< + Indexed + [ CofreeT (Identity ( (Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf1" ) ) + , CofreeT (Identity ( (Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf2" ) ) + , CofreeT (Identity ( (Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf3" ) ) + ] )) + + First step is to match against the "indexed" string and begin building up a Cofree Indexed structure: + + CofreeT (Identity ( (Range 1 10 :. Category.MethodCall :. Nil) :< Indexed ["leaf1", "leaf2", "leaf3"] ) ) + + While building up the `Indexed` structure, we continue to recurse over the + `Indexed` terms ["leaf1", "leaf2", "leaf3"]. These are pattern matched using + the catch all `_` and default to `Leaf` Syntax shapes: + + CofreeT (Identity ( (Range 1 10 :. Category.MethodCall :. Nil) :< Leaf "leaf1" ) ) + CofreeT (Identity ( (Range 1 10 :. Category.MethodCall :. Nil) :< Leaf "leaf2" ) ) + CofreeT (Identity ( (Range 1 10 :. Category.MethodCall :. Nil) :< Leaf "leaf3" ) ) + + These structures are substituted in place of ["leaf1", "leaf2", "leaf3"] in + the new cofree `Indexed` structure, resulting in a expansion of all possible + string terms. +-} +stringToTermAna :: String -> Term (Syntax String) (Record '[Range, Category]) +stringToTermAna = ana coalgebra + where + coalgebra representation = case representation of + "indexed" -> (Range 1 10 :. Category.MethodCall :. Nil) :< Indexed ["leaf1", "leaf2", "leaf3"] + _ -> (Range 1 10 :. Category.MethodCall :. Nil) :< Leaf representation + +{- +Catamorphism -- construct a list of Strings from a recursive Term structure. + +The example below shows how to tear down a recursive Term structure into a list +of String representation. +-} +termToStringCata :: Term (Syntax String) (Record '[Range, Category]) -> [String] +termToStringCata = cata algebra + where + algebra term = case term of + (_ :< Leaf value) -> [value] + (_ :< Indexed values) -> ["indexed"] <> Prologue.concat values + _ -> ["unknown"] + +{- +Hylomorphism -- An anamorphism followed by a catamorphism + +hylo :: Functor f => (f b -> b) -- an algebra + -> (a -> f a) -- a coalgebra + -> a -- seed value + -> b -- result + +Hylomorphisms work by first applying a coalgebra (anamorphism) to build up a +structure. An algebra (catamorphism) is then applied to this structure. Because +of fusion the anamorphism and catamorphism occur in a single pass rather than +two separate traversals. + +The example below shows how our algebra and coalgebra defined in the +termToStringCata and stringToTermAna can be utilized as a hylomorphism. + +Example Usage: +stringTermHylo "indexed" => ["indexed", "leaf1", "leaf2", "leaf3"] + +-} +stringTermHylo :: String -> [String] +stringTermHylo = hylo algebra coalgebra + where + algebra term = case term of + (_ :< Leaf value) -> [value] + (_ :< Indexed values) -> ["indexed"] <> Prologue.concat values + _ -> ["unknown"] + coalgebra stringRepresentation = case stringRepresentation of + "indexed" -> (Range 1 10 :. Category.MethodCall :. Nil) :< Indexed ["leaf1", "leaf2", "leaf3"] + _ -> (Range 1 10 :. Category.MethodCall :. Nil) :< Leaf stringRepresentation + +{- +Paramorphism -- primitive recursion that maintains a reference to the original value and its computed value. + +para :: (Base t (t, a) -> a) -- an algebra that takes a tuple of the last input + -> t -- fixed point + -> a -- result + +Paramorphisms, like all recursion schemes, work via a bottom up traversal +(leaves to root), in which an algebra is applied to every node in the recursive +structure. The difference between paramorphisms and catamorphisms is the algebra +receives a tuple of the original subobject and its computed value (t, a) where +`t` is the original suboject and `a` is the computed value. + +The example implementation below calculates a string representation for each +Syntax type, flattening the recursive structure into a one dimensional list to +tuples. The tuple contains the original syntax subobject, and its computed +string representation. This example aims to showcase how paramorphisms work by +returning a final list of tuples that mimics the intermediate tuple shapes the +algebra receives throughout the bottom up traversal. + +Example Usage: +let terms = indexedTerm ["leaf1", "leaf2", "leaf3"] +termPara terms = Recurse over the structure to start at the leaves (bottom up traversal): + +tuple3 = ( CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf3")), "leaf3" ) : [] + +Continue the traversal from leaves to root: + +tuple2:3 = ( CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf2")), "leaf2") : tuple3 + +tuple1:2:3 = ( CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf1" )), "leaf1") : tuple2:3 + +Compute the root: +tupleIndexed:1:2:3 = ( CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Indexed [])), "indexed" ) : tuple1:2:3 + +Final shape: +[ (CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Indexed [])) , "indexed") +, (CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf1")), "leaf1") +, (CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf2")), "leaf2") +, (CofreeT (Identity ((Range {start = 1, end = 10} :. MethodCall :. Nil) :< Leaf "leaf3")), "leaf3") +] + +-} +termPara :: Term (Syntax String) (Record '[Range, Category]) -> [(Term (Syntax String) (Record '[Range, Category]), String)] +termPara = para algebra + where + algebra term = case term of + (annotation :< Leaf representation) -> [(cofree (annotation :< Leaf representation), representation)] + (annotation :< Indexed values) -> [(cofree (annotation :< Indexed []), "indexed")] <> (values >>= Prelude.snd) + _ -> [(cofree ((Range 1 10 :. Category.MethodCall :. Nil) :< Leaf "unknown"), "unknown")] diff --git a/src/FDoc/Term.hs b/src/FDoc/Term.hs new file mode 100644 index 000000000..5f894f486 --- /dev/null +++ b/src/FDoc/Term.hs @@ -0,0 +1,67 @@ +{-# LANGUAGE DataKinds, TypeOperators #-} +module FDoc.Term where + +import Data.Record +import Range +import Category +import Term +import Syntax +import Prologue + +{- + +Constructs a Syntax.Leaf using the polymorphic type variable `leaf`. + +This is in the TermF shape: CofreeF f a b where + f is the functor (Syntax.Leaf `leaf`) + a is the annotation (Record '[Range, Category]) + b is the same type of functor defined by f + +Two common convenience operations when working with CofreeF (for docs, see +Control.Comonad.Trans.Cofree.Types.CofreeF) are `headF` and `tailF`. `headF` +return the annotation portion of the CofreeF structure, and `tailF` returns the +functor portion (Syntax). + +Example (from GHCi): + +> let leaf = leafTermF "example" +> headF leaf +> Range {start = 1, end = 10} :. MethodCall :. Nil +> tailF leaf +> Leaf "example" + +-} + +leafTermF :: leaf -> TermF (Syntax leaf) (Record '[Range, Category]) b +leafTermF leaf = (Range 1 10 :. Category.MethodCall :. Nil) :< Leaf leaf + +{- + +Constructs a Syntax.Leaf using the polymorphic type variable `leaf`. + +This is in the Term shape: Cofree f a where + f is the functor (Syntax.Leaf `leaf`) + a is the annotation (Record '[Range, Category]) + +Two common convenience operations when working with Cofree (for docs, see +Control.Comonad.Trans.Cofree.Types.Cofree) are `extract` and `unwrap`. `extract` +returns the annotation portion of the Cofree structure, and `unwrap` returns the +functor portion (Syntax). + +Example (from GHCi): + +> let leaf = leafTerm "example" +> extract leaf +> Range {start = 1, end = 10} :. MethodCall :. Nil +> unwrap leaf +> Leaf "example" + +-} +leafTerm :: leaf -> Cofree (Syntax leaf) (Record '[Range, Category]) +leafTerm = cofree . leafTermF + +indexedTermF :: [leaf] -> TermF (Syntax leaf) (Record '[Range, Category]) (Term (Syntax leaf) (Record '[Range, Category])) +indexedTermF leaves = (Range 1 10 :. Category.MethodCall :. Nil) :< (Indexed (leafTerm <$> leaves)) + +indexedTerm :: [leaf] -> Term (Syntax leaf) (Record '[Range, Category]) +indexedTerm leaves = cofree $ indexedTermF leaves diff --git a/src/Info.hs b/src/Info.hs new file mode 100644 index 000000000..a0db54f6b --- /dev/null +++ b/src/Info.hs @@ -0,0 +1,65 @@ +{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving #-} +module Info +( Range(..) +, characterRange +, setCharacterRange +, Category(..) +, category +, setCategory +, Cost(..) +, cost +, setCost +, SourceSpan(..) +, SourcePos(..) +, SourceSpans(..) +, sourceSpan +, setSourceSpan +, SourceText(..) +, sourceText +) where + +import Data.Functor.Listable +import Data.Record +import Prologue +import Category +import Range +import SourceSpan +import Data.Aeson + +newtype Cost = Cost { unCost :: Int } + deriving (Eq, Num, Ord, Show, ToJSON) + +newtype SourceText = SourceText { unText :: Text } + deriving (Show, ToJSON) + +characterRange :: HasField fields Range => Record fields -> Range +characterRange = getField + +setCharacterRange :: HasField fields Range => Record fields -> Range -> Record fields +setCharacterRange = setField + +category :: HasField fields Category => Record fields -> Category +category = getField + +setCategory :: HasField fields Category => Record fields -> Category -> Record fields +setCategory = setField + +cost :: HasField fields Cost => Record fields -> Cost +cost = getField + +setCost :: HasField fields Cost => Record fields -> Cost -> Record fields +setCost = setField + +sourceText :: HasField fields SourceText => Record fields -> SourceText +sourceText = getField + +sourceSpan :: HasField fields SourceSpan => Record fields -> SourceSpan +sourceSpan = getField + +setSourceSpan :: HasField fields SourceSpan => Record fields -> SourceSpan -> Record fields +setSourceSpan = setField + +-- Instances + +instance Listable Cost where + tiers = cons1 Cost diff --git a/src/Interpreter.hs b/src/Interpreter.hs index 3d237c7f2..7ab0e1c0b 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -1,79 +1,113 @@ -module Interpreter (interpret, Comparable, diffTerms) where +{-# LANGUAGE RankNTypes #-} +module Interpreter (Comparable, DiffConstructor, diffTerms) where import Algorithm -import Category -import Control.Arrow -import Control.Comonad.Cofree -import Control.Monad.Free -import Data.Copointed +import Data.Align.Generic +import Data.Functor.Foldable import Data.Functor.Both -import qualified Data.OrderedMap as Map -import qualified Data.List as List -import Data.List ((\\)) -import Data.Maybe -import Data.OrderedMap ((!)) +import Data.RandomWalkSimilarity as RWS +import Data.Record +import Data.These import Diff -import Operation +import Info import Patch -import Prelude hiding (lookup) +import Prologue hiding (lookup) import SES -import Syntax +import Syntax as S import Term -- | Returns whether two terms are comparable -type Comparable a annotation = Term a annotation -> Term a annotation -> Bool +type Comparable f annotation = Term f annotation -> Term f annotation -> Bool --- | Diff two terms, given the default Categorizable.comparable function. -diffTerms :: (Eq a, Eq annotation, Categorizable annotation) => Term a annotation -> Term a annotation -> Diff a annotation -diffTerms = interpret comparable +-- | Constructs a diff from the CofreeF containing its annotation and syntax. This function has the opportunity to, for example, cache properties in the annotation. +type DiffConstructor f annotation = TermF f (Both annotation) (Diff f annotation) -> Diff f annotation --- | Diff two terms, given a function that determines whether two terms can be compared. -interpret :: (Eq a, Eq annotation) => Comparable a annotation -> Term a annotation -> Term a annotation -> Diff a annotation -interpret comparable a b = fromMaybe (Pure $ Replace a b) $ constructAndRun comparable a b +-- | Diff two terms recursively, given functions characterizing the diffing. +diffTerms :: (Eq leaf, HasField fields Category, HasField fields (Maybe FeatureVector)) + => DiffConstructor (Syntax leaf) (Record fields) -- ^ A function to wrap up & possibly annotate every produced diff. + -> Comparable (Syntax leaf) (Record fields) -- ^ A function to determine whether or not two terms should even be compared. + -> SES.Cost (SyntaxDiff leaf fields) -- ^ A function to compute the cost of a given diff node. + -> SyntaxTerm leaf fields -- ^ A term representing the old state. + -> SyntaxTerm leaf fields -- ^ A term representing the new state. + -> SyntaxDiff leaf fields +diffTerms construct comparable cost a b = fromMaybe (replacing a b) $ diffComparableTerms construct comparable cost a b --- | A hylomorphism. Given an `a`, unfold and then refold into a `b`. -hylo :: Functor f => (t -> f b -> b) -> (a -> (t, f a)) -> a -> b -hylo down up a = down annotation $ hylo down up <$> syntax where - (annotation, syntax) = up a +-- | Diff two terms recursively, given functions characterizing the diffing. If the terms are incomparable, returns 'Nothing'. +diffComparableTerms :: (Eq leaf, HasField fields Category, HasField fields (Maybe FeatureVector)) + => DiffConstructor (Syntax leaf) (Record fields) + -> Comparable (Syntax leaf) (Record fields) + -> SES.Cost (SyntaxDiff leaf fields) + -> SyntaxTerm leaf fields + -> SyntaxTerm leaf fields + -> Maybe (SyntaxDiff leaf fields) +diffComparableTerms construct comparable cost = recur + where recur a b + | (category <$> a) == (category <$> b) = hylo construct runCofree <$> zipTerms a b + | comparable a b = runAlgorithm construct recur cost (Just <$> algorithmWithTerms construct a b) + | otherwise = Nothing --- | Constructs an algorithm and runs it -constructAndRun :: (Eq a, Eq annotation) => Comparable a annotation -> Term a annotation -> Term a annotation -> Maybe (Diff a annotation) -constructAndRun _ a b | a == b = hylo (curry $ Free . uncurry Annotated) (copoint &&& unwrap) <$> zipTerms a b where +-- | Construct an algorithm to diff a pair of terms. +algorithmWithTerms :: Applicative diff + => (TermF (Syntax leaf) (Both a) (diff (Patch (Term (Syntax leaf) a))) -> diff (Patch (Term (Syntax leaf) a))) + -> Term (Syntax leaf) a + -> Term (Syntax leaf) a + -> Algorithm (Term (Syntax leaf) a) (diff (Patch (Term (Syntax leaf) a))) (diff (Patch (Term (Syntax leaf) a))) +algorithmWithTerms construct t1 t2 = maybe (recursively t1 t2) (fmap annotate) $ case (unwrap t1, unwrap t2) of + (Indexed a, Indexed b) -> + Just $ Indexed <$> bySimilarity a b + (S.Module idA a, S.Module idB b) -> + Just $ S.Module <$> recursively idA idB <*> bySimilarity a b + (S.FunctionCall identifierA argsA, S.FunctionCall identifierB argsB) -> Just $ + S.FunctionCall <$> recursively identifierA identifierB + <*> bySimilarity argsA argsB + (S.Switch exprA casesA, S.Switch exprB casesB) -> Just $ + S.Switch <$> bySimilarity exprA exprB + <*> bySimilarity casesA casesB + (S.Object tyA a, S.Object tyB b) -> Just $ + S.Object <$> maybeRecursively tyA tyB + <*> bySimilarity a b + (Commented commentsA a, Commented commentsB b) -> Just $ + Commented <$> bySimilarity commentsA commentsB + <*> maybeRecursively a b + (Array tyA a, Array tyB b) -> Just $ + Array <$> maybeRecursively tyA tyB + <*> bySimilarity a b + (S.Class identifierA paramsA expressionsA, S.Class identifierB paramsB expressionsB) -> Just $ + S.Class <$> recursively identifierA identifierB + <*> maybeRecursively paramsA paramsB + <*> bySimilarity expressionsA expressionsB + (S.Method identifierA receiverA tyA paramsA expressionsA, S.Method identifierB receiverB tyB paramsB expressionsB) -> Just $ + S.Method <$> recursively identifierA identifierB + <*> maybeRecursively receiverA receiverB + <*> maybeRecursively tyA tyB + <*> bySimilarity paramsA paramsB + <*> bySimilarity expressionsA expressionsB + (S.Function idA paramsA tyA bodyA, S.Function idB paramsB tyB bodyB) -> Just $ + S.Function <$> recursively idA idB + <*> bySimilarity paramsA paramsB + <*> maybeRecursively tyA tyB + <*> bySimilarity bodyA bodyB + _ -> Nothing + where + annotate = construct . (both (extract t1) (extract t2) :<) -constructAndRun comparable a b | not $ comparable a b = Nothing + maybeRecursively :: Applicative f => Maybe a -> Maybe a -> Algorithm a (f (Patch a)) (Maybe (f (Patch a))) + maybeRecursively a b = sequenceA $ case (a, b) of + (Just a, Just b) -> Just $ recursively a b + (Nothing, Just b) -> Just $ pure (inserting b) + (Just a, Nothing) -> Just $ pure (deleting a) + (Nothing, Nothing) -> Nothing -constructAndRun comparable (annotation1 :< a) (annotation2 :< b) = - run comparable $ algorithm a b where - algorithm (Indexed a') (Indexed b') = Free $ ByIndex a' b' (annotate . Indexed) - algorithm (Keyed a') (Keyed b') = Free $ ByKey a' b' (annotate . Keyed) - algorithm (Leaf a') (Leaf b') | a' == b' = annotate $ Leaf b' - algorithm a' b' = Free $ Recursive (annotation1 :< a') (annotation2 :< b') Pure - annotate = Pure . Free . Annotated (Both (annotation1, annotation2)) - --- | Runs the diff algorithm -run :: (Eq a, Eq annotation) => Comparable a annotation -> Algorithm a annotation (Diff a annotation) -> Maybe (Diff a annotation) -run _ (Pure diff) = Just diff - -run comparable (Free (Recursive (annotation1 :< a) (annotation2 :< b) f)) = run comparable . f $ recur a b where - recur (Indexed a') (Indexed b') | length a' == length b' = annotate . Indexed $ zipWith (interpret comparable) a' b' - recur (Fixed a') (Fixed b') | length a' == length b' = annotate . Fixed $ zipWith (interpret comparable) a' b' - recur (Keyed a') (Keyed b') | Map.keys a' == bKeys = annotate . Keyed . Map.fromList . fmap repack $ bKeys - where - bKeys = Map.keys b' - repack key = (key, interpretInBoth key a' b') - interpretInBoth key x y = interpret comparable (x ! key) (y ! key) - recur _ _ = Pure $ Replace (annotation1 :< a) (annotation2 :< b) - - annotate = Free . Annotated (Both (annotation1, annotation2)) - -run comparable (Free (ByKey a b f)) = run comparable $ f byKey where - byKey = Map.fromList $ toKeyValue <$> List.union aKeys bKeys - toKeyValue key | List.elem key deleted = (key, Pure . Delete $ a ! key) - toKeyValue key | List.elem key inserted = (key, Pure . Insert $ b ! key) - toKeyValue key = (key, interpret comparable (a ! key) (b ! key)) - aKeys = Map.keys a - bKeys = Map.keys b - deleted = aKeys \\ bKeys - inserted = bKeys \\ aKeys - -run comparable (Free (ByIndex a b f)) = run comparable . f $ ses (constructAndRun comparable) diffCost a b +-- | Run an algorithm, given functions characterizing the evaluation. +runAlgorithm :: (GAlign f, HasField fields Category, Eq (f (Cofree f Category)), Traversable f, HasField fields (Maybe FeatureVector)) + => (CofreeF f (Both (Record fields)) (Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields)))) -> Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields)))) -- ^ A function to wrap up & possibly annotate every produced diff. + -> (Cofree f (Record fields) -> Cofree f (Record fields) -> Maybe (Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields))))) -- ^ A function to diff two subterms recursively, if they are comparable, or else return 'Nothing'. + -> SES.Cost (Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields)))) -- ^ A function to compute the cost of a given diff node. + -> Algorithm (Cofree f (Record fields)) (Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields)))) a -- ^ The algorithm to run. + -> a +runAlgorithm construct recur cost = iterAp $ \case + Recursive a b f -> f (maybe (replacing a b) (construct . (both (extract a) (extract b) :<)) $ do + aligned <- galign (unwrap a) (unwrap b) + traverse (these (Just . deleting) (Just . inserting) recur) aligned) + ByIndex as bs f -> f (ses recur cost as bs) + BySimilarity as bs f -> f (rws recur as bs) diff --git a/src/Language.hs b/src/Language.hs index c63138bd2..df2e28703 100644 --- a/src/Language.hs +++ b/src/Language.hs @@ -1,10 +1,15 @@ +{-# LANGUAGE DataKinds #-} module Language where -import Data.Text +import Data.Record +import Info +import Prologue +import qualified Syntax as S +import Term -- | A programming language. data Language = - C + C | CoffeeScript | CPlusPlus | CSharp @@ -13,6 +18,7 @@ data Language = | HTML | Java | JavaScript + | Markdown | ObjectiveC | Perl | PHP @@ -20,6 +26,8 @@ data Language = | R | Ruby | Swift + | Go + deriving (Show) -- | Returns a Language based on the file extension (including the "."). languageForType :: Text -> Maybe Language @@ -27,5 +35,16 @@ languageForType mediaType = case mediaType of ".h" -> Just C ".c" -> Just C ".js" -> Just JavaScript + ".md" -> Just Markdown ".rb" -> Just Ruby + ".go" -> Just Language.Go _ -> Nothing + +toVarDecl :: (HasField fields Category) => Term (S.Syntax Text) (Record fields) -> Term (S.Syntax Text) (Record fields) +toVarDecl child = cofree $ setCategory (extract child) VarDecl :< S.VarDecl child Nothing + +toTuple :: Term (S.Syntax Text) (Record fields) -> [Term (S.Syntax Text) (Record fields)] +toTuple child | S.Indexed [key,value] <- unwrap child = [cofree (extract child :< S.Pair key value)] +toTuple child | S.Fixed [key,value] <- unwrap child = [cofree (extract child :< S.Pair key value)] +toTuple child | S.Leaf c <- unwrap child = [cofree (extract child :< S.Comment c)] +toTuple child = pure child diff --git a/src/Language/C.hs b/src/Language/C.hs new file mode 100644 index 000000000..ce759c92a --- /dev/null +++ b/src/Language/C.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE DataKinds #-} +module Language.C where + +import Info +import Prologue +import Source +import qualified Syntax as S +import Term + +termAssignment + :: Source Char -- ^ The source of the term. + -> Category -- ^ The category for the term. + -> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ The child nodes of the term. + -> Maybe (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan])) -- ^ The resulting term, in Maybe. +termAssignment _ _ _ = Nothing + + +categoryForCProductionName :: Text -> Category +categoryForCProductionName = Other diff --git a/src/Language/Go.hs b/src/Language/Go.hs new file mode 100644 index 000000000..6929b5a47 --- /dev/null +++ b/src/Language/Go.hs @@ -0,0 +1,139 @@ +{-# LANGUAGE DataKinds #-} +module Language.Go where + +import Prologue +import Info +import Source +import Term +import qualified Syntax as S + +termAssignment + :: Source Char -- ^ The source of the term. + -> Category -- ^ The category for the term. + -> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ The child nodes of the term. + -> Maybe (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan])) -- ^ The resulting term, in Maybe. +termAssignment source category children = case (category, children) of + (Module, [moduleName]) -> Just $ S.Module moduleName [] + (Import, [importName]) -> Just $ S.Import importName [] + (Function, [id, params, block]) -> Just $ S.Function id (toList (unwrap params)) Nothing (toList (unwrap block)) + (Function, [id, params, ty, block]) -> Just $ S.Function id (toList (unwrap params)) (Just ty) (toList (unwrap block)) + (For, [body]) | Other "block" <- Info.category (extract body) -> Just $ S.For [] (toList (unwrap body)) + (For, [forClause, body]) | Other "for_clause" <- Info.category (extract forClause) -> Just $ S.For (toList (unwrap forClause)) (toList (unwrap body)) + (For, [rangeClause, body]) | Other "range_clause" <- Info.category (extract rangeClause) -> Just $ S.For (toList (unwrap rangeClause)) (toList (unwrap body)) + (TypeDecl, [identifier, ty]) -> Just $ S.TypeDecl identifier ty + (StructTy, _) -> Just (S.Ty children) + (FieldDecl, [idList]) + | [ident] <- toList (unwrap idList) + -> Just (S.FieldDecl ident Nothing Nothing) + (FieldDecl, [idList, ty]) + | [ident] <- toList (unwrap idList) + -> Just $ case Info.category (extract ty) of + StringLiteral -> S.FieldDecl ident Nothing (Just ty) + _ -> S.FieldDecl ident (Just ty) Nothing + (FieldDecl, [idList, ty, tag]) + | [ident] <- toList (unwrap idList) + -> Just (S.FieldDecl ident (Just ty) (Just tag)) + (ParameterDecl, param : ty) -> Just $ S.ParameterDecl (listToMaybe ty) param + (Assignment, [identifier, expression]) -> Just $ S.VarAssignment identifier expression + (Select, _) -> Just $ S.Select (children >>= toList . unwrap) + (Go, [expr]) -> Just $ S.Go expr + (Defer, [expr]) -> Just $ S.Defer expr + (SubscriptAccess, [a, b]) -> Just $ S.SubscriptAccess a b + (IndexExpression, [a, b]) -> Just $ S.SubscriptAccess a b + (Slice, [a, rest]) -> Just $ S.SubscriptAccess a rest + (Other "composite_literal", [ty, values]) + | ArrayTy <- Info.category (extract ty) + -> Just $ S.Array (Just ty) (toList (unwrap values)) + | DictionaryTy <- Info.category (extract ty) + -> Just $ S.Object (Just ty) (toList (unwrap values)) + | SliceTy <- Info.category (extract ty) + -> Just $ S.SubscriptAccess ty values + (Other "composite_literal", []) -> Just $ S.Struct Nothing [] + (Other "composite_literal", [ty]) -> Just $ S.Struct (Just ty) [] + (Other "composite_literal", [ty, values]) -> Just $ S.Struct (Just ty) (toList (unwrap values)) + (TypeAssertion, [a, b]) -> Just $ S.TypeAssertion a b + (TypeConversion, [a, b]) -> Just $ S.TypeConversion a b + -- TODO: Handle multiple var specs + (VarAssignment, [identifier, expression]) -> Just $ S.VarAssignment identifier expression + (VarDecl, [idList, ty]) | Identifier <- Info.category (extract ty) -> Just $ S.VarDecl idList (Just ty) + (FunctionCall, id : rest) -> Just $ S.FunctionCall id rest + (AnonymousFunction, [params, _, body]) + | [params'] <- toList (unwrap params) + -> Just $ S.AnonymousFunction (toList (unwrap params')) (toList (unwrap body)) + (PointerTy, _) -> Just $ S.Ty children + (ChannelTy, _) -> Just $ S.Ty children + (Send, [channel, expr]) -> Just $ S.Send channel expr + (Operator, _) -> Just $ S.Operator children + (FunctionTy, _) -> Just $ S.Ty children + (IncrementStatement, _) -> Just $ S.Leaf (toText source) + (DecrementStatement, _) -> Just $ S.Leaf (toText source) + (QualifiedIdentifier, _) -> Just $ S.Leaf (toText source) + (Method, [receiverParams, name, body]) -> Just (S.Method name (Just receiverParams) Nothing [] (toList (unwrap body))) + (Method, [receiverParams, name, params, body]) + -> Just (S.Method name (Just receiverParams) Nothing (toList (unwrap params)) (toList (unwrap body))) + (Method, [receiverParams, name, params, ty, body]) + -> Just (S.Method name (Just receiverParams) (Just ty) (toList (unwrap params)) (toList (unwrap body))) + _ -> Nothing + +categoryForGoName :: Text -> Category +categoryForGoName = \case + "identifier" -> Identifier + "int_literal" -> NumberLiteral + "float_literal" -> FloatLiteral + "comment" -> Comment + "return_statement" -> Return + "interpreted_string_literal" -> StringLiteral + "raw_string_literal" -> StringLiteral + "binary_expression" -> RelationalOperator + "function_declaration" -> Function + "func_literal" -> AnonymousFunction + "call_expression" -> FunctionCall + "selector_expression" -> SubscriptAccess + "index_expression" -> IndexExpression + "slice_expression" -> Slice + "parameters" -> Args + "short_var_declaration" -> VarDecl + "var_spec" -> VarAssignment + "const_spec" -> VarAssignment + "assignment_statement" -> Assignment + "source_file" -> Program + "package_clause" -> Module + "if_statement" -> If + "for_statement" -> For + "expression_switch_statement" -> Switch + "type_switch_statement" -> Switch + "expression_case_clause" -> Case + "type_case_clause" -> Case + "select_statement" -> Select + "communication_case" -> Case + "defer_statement" -> Defer + "go_statement" -> Go + "type_assertion_expression" -> TypeAssertion + "type_conversion_expression" -> TypeConversion + "keyed_element" -> Pair + "struct_type" -> StructTy + "map_type" -> DictionaryTy + "array_type" -> ArrayTy + "implicit_length_array_type" -> ArrayTy + "parameter_declaration" -> ParameterDecl + "expression_case" -> Case + "type_spec" -> TypeDecl + "field_declaration" -> FieldDecl + "pointer_type" -> PointerTy + "slice_type" -> SliceTy + "element" -> Element + "literal_value" -> Literal + "channel_type" -> ChannelTy + "send_statement" -> Send + "unary_expression" -> Operator + "function_type" -> FunctionTy + "inc_statement" -> IncrementStatement + "dec_statement" -> DecrementStatement + "qualified_identifier" -> QualifiedIdentifier + "break_statement" -> Break + "continue_statement" -> Continue + "rune_literal" -> RuneLiteral + "method_declaration" -> Method + "import_spec" -> Import + "block" -> ExpressionStatements + s -> Other (toS s) diff --git a/src/Language/JavaScript.hs b/src/Language/JavaScript.hs new file mode 100644 index 000000000..9eef03bd0 --- /dev/null +++ b/src/Language/JavaScript.hs @@ -0,0 +1,142 @@ +{-# LANGUAGE DataKinds #-} +module Language.JavaScript where + +import Info +import Prologue +import Source +import Language +import qualified Syntax as S +import Term + +termAssignment + :: Source Char -- ^ The source of the term. + -> Category -- ^ The category for the term. + -> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ The child nodes of the term. + -> Maybe (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan])) -- ^ The resulting term, in Maybe. +termAssignment _ category children + = case (category, children) of + (Assignment, [ identifier, value ]) -> Just $ S.Assignment identifier value + (MathAssignment, [ identifier, value ]) -> Just $ S.OperatorAssignment identifier value + (MemberAccess, [ base, property ]) -> Just $ S.MemberAccess base property + (SubscriptAccess, [ base, element ]) -> Just $ S.SubscriptAccess base element + (CommaOperator, [ a, b ]) + | S.Indexed rest <- unwrap b + -> Just $ S.Indexed $ a : rest + (FunctionCall, member : args) + | S.MemberAccess target method <- unwrap member + -> Just $ S.MethodCall target method (toList . unwrap =<< args) + (FunctionCall, function : args) -> Just $ S.FunctionCall function (toList . unwrap =<< args) + (Ternary, condition : cases) -> Just $ S.Ternary condition cases + (VarAssignment, [ x, y ]) -> Just $ S.VarAssignment x y + (VarDecl, _) -> Just . S.Indexed $ toVarDecl <$> children + (Object, _) -> Just . S.Object Nothing $ foldMap toTuple children + (DoWhile, [ expr, body ]) -> Just $ S.DoWhile expr body + (Constructor, [ expr ]) -> Just $ S.Constructor expr + (Try, [ body ]) -> Just $ S.Try [body] [] Nothing Nothing + (Try, [ body, catch ]) + | Catch <- Info.category (extract catch) + -> Just $ S.Try [body] [catch] Nothing Nothing + (Try, [ body, finally ]) + | Finally <- Info.category (extract finally) + -> Just $ S.Try [body] [] Nothing (Just finally) + (Try, [ body, catch, finally ]) + | Catch <- Info.category (extract catch) + , Finally <- Info.category (extract finally) + -> Just $ S.Try [body] [catch] Nothing (Just finally) + (ArrayLiteral, _) -> Just $ S.Array Nothing children + (Method, [ identifier, params, exprs ]) -> Just $ S.Method identifier Nothing Nothing (toList (unwrap params)) (toList (unwrap exprs)) + (Method, [ identifier, exprs ]) -> Just $ S.Method identifier Nothing Nothing [] (toList (unwrap exprs)) + (Class, [ identifier, superclass, definitions ]) -> Just $ S.Class identifier (Just superclass) (toList (unwrap definitions)) + (Class, [ identifier, definitions ]) -> Just $ S.Class identifier Nothing (toList (unwrap definitions)) + (Import, [ statements, identifier ] ) -> Just $ S.Import identifier (toList (unwrap statements)) + (Import, [ identifier ] ) -> Just $ S.Import identifier [] + (Export, [ statements, identifier] ) -> Just $ S.Export (Just identifier) (toList (unwrap statements)) + (Export, [ statements ] ) + | S.Indexed _ <- unwrap statements + -> Just $ S.Export Nothing (toList (unwrap statements)) + | otherwise -> Just $ S.Export (Just statements) [] + (For, _) + | Just (exprs, body) <- unsnoc children + -> Just $ S.For exprs [body] + (Function, [ body ]) -> Just $ S.AnonymousFunction [] [body] + (Function, [ params, body ]) -> Just $ S.AnonymousFunction (toList (unwrap params)) [body] + (Function, [ id, params, body ]) -> Just $ S.Function id (toList (unwrap params)) Nothing [body] + _ -> Nothing + +categoryForJavaScriptProductionName :: Text -> Category +categoryForJavaScriptProductionName name = case name of + "object" -> Object + "expression_statement" -> ExpressionStatements + "trailing_expression_statement" -> ExpressionStatements + "this_expression" -> Identifier + "null" -> Identifier + "undefined" -> Identifier + "arrow_function" -> Function + "generator_function" -> Function + "math_op" -> MathOperator -- math operator, e.g. +, -, *, /. + "bool_op" -> BooleanOperator -- boolean operator, e.g. ||, &&. + "comma_op" -> CommaOperator -- comma operator, e.g. expr1, expr2. + "delete_op" -> Operator -- delete operator, e.g. delete x[2]. + "type_op" -> Operator -- type operator, e.g. typeof Object. + "void_op" -> Operator -- void operator, e.g. void 2. + "for_statement" -> For + "trailing_for_statement" -> For + "for_in_statement" -> For + "trailing_for_in_statement" -> For + "for_of_statement" -> For + "trailing_for_of_statement" -> For + "new_expression" -> Constructor + "class" -> Class + "catch" -> Catch + "finally" -> Finally + "if_statement" -> If + "trailing_if_statement" -> If + "empty_statement" -> Empty + "program" -> Program + "function_call" -> FunctionCall + "pair" -> Pair + "string" -> StringLiteral + "integer" -> IntegerLiteral + "number" -> NumberLiteral + "float" -> FloatLiteral + "symbol" -> SymbolLiteral + "array" -> ArrayLiteral + "function" -> Function + "identifier" -> Identifier + "formal_parameters" -> Params + "arguments" -> Args + "statement_block" -> ExpressionStatements + "assignment" -> Assignment + "member_access" -> MemberAccess + "op" -> Operator + "subscript_access" -> SubscriptAccess + "regex" -> Regex + "template_string" -> TemplateString + "var_assignment" -> VarAssignment + "var_declaration" -> VarDecl + "trailing_var_declaration" -> VarDecl + "switch_statement" -> Switch + "math_assignment" -> MathAssignment + "case" -> Case + "true" -> Boolean + "false" -> Boolean + "ternary" -> Ternary + "while_statement" -> While + "trailing_while_statement" -> While + "do_statement" -> DoWhile + "trailing_do_statement" -> DoWhile + "return_statement" -> Return + "trailing_return_statement" -> Return + "throw_statement" -> Throw + "trailing_throw_statement" -> Throw + "try_statement" -> Try + "method_definition" -> Method + "comment" -> Comment + "bitwise_op" -> BitwiseOperator + "rel_op" -> RelationalOperator + "import_statement" -> Import + "export_statement" -> Export + "break_statement" -> Break + "continue_statement" -> Continue + "yield_statement" -> Yield + _ -> Other name diff --git a/src/Language/Markdown.hs b/src/Language/Markdown.hs new file mode 100644 index 000000000..3d314459c --- /dev/null +++ b/src/Language/Markdown.hs @@ -0,0 +1,42 @@ +{-# LANGUAGE DataKinds #-} +module Language.Markdown where + +import CMark +import Data.Record +import Data.Text +import Info +import Parser +import Prologue +import Range +import Source +import Syntax + +cmarkParser :: Parser (Syntax Text) (Record '[Range, Category, SourceSpan]) +cmarkParser SourceBlob{..} = pure . toTerm (totalRange source) (rangeToSourceSpan source $ totalRange source) $ commonmarkToNode [ optSourcePos, optSafe ] (toText source) + where toTerm :: Range -> SourceSpan -> Node -> Cofree (Syntax Text) (Record '[Range, Category, SourceSpan]) + toTerm within withinSpan (Node position t children) = + let + range = maybe within (sourceSpanToRange source . toSpan) position + span = maybe withinSpan toSpan position + in + cofree $ (range :. toCategory t :. span :. Nil) :< case t of + -- Leaves + CODE text -> Leaf text + TEXT text -> Leaf text + CODE_BLOCK _ text -> Leaf text + -- Branches + _ -> Indexed (toTerm range span <$> children) + + toCategory :: NodeType -> Category + toCategory (TEXT _) = Other "text" + toCategory (CODE _) = Other "code" + toCategory (HTML_BLOCK _) = Other "html" + toCategory (HTML_INLINE _) = Other "html" + toCategory (HEADING _) = Other "heading" + toCategory (LIST ListAttributes{..}) = Other $ case listType of + BULLET_LIST -> "unordered list" + ORDERED_LIST -> "ordered list" + toCategory LINK{} = Other "link" + toCategory IMAGE{} = Other "image" + toCategory t = Other (show t) + toSpan PosInfo{..} = SourceSpan (SourcePos (pred startLine) (pred startColumn)) (SourcePos (pred endLine) endColumn) diff --git a/src/Language/Ruby.hs b/src/Language/Ruby.hs new file mode 100644 index 000000000..47309b85d --- /dev/null +++ b/src/Language/Ruby.hs @@ -0,0 +1,171 @@ +{-# LANGUAGE DataKinds #-} +module Language.Ruby where + +import Data.List (partition) +import Info +import Prologue +import Source +import Language +import qualified Syntax as S +import Term + +termAssignment + :: Source Char -- ^ The source of the term. + -> Category -- ^ The category for the term. + -> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ The child nodes of the term. + -> Maybe (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan])) -- ^ The resulting term, in Maybe. +termAssignment _ category children + = case (category, children) of + (ArgumentPair, [ k, v ] ) -> Just $ S.Pair k v + (KeywordParameter, [ k, v ] ) -> Just $ S.Pair k v + -- NB: ("keyword_parameter", k) is a required keyword parameter, e.g.: + -- def foo(name:); end + -- Let it fall through to generate an Indexed syntax. + (OptionalParameter, [ k, v ] ) -> Just $ S.Pair k v + (ArrayLiteral, _ ) -> Just $ S.Array Nothing children + (Assignment, [ identifier, value ]) -> Just $ S.Assignment identifier value + (Begin, _ ) -> Just $ case partition (\x -> Info.category (extract x) == Rescue) children of + (rescues, rest) -> case partition (\x -> Info.category (extract x) == Ensure || Info.category (extract x) == Else) rest of + (ensureElse, body) -> case ensureElse of + [ elseBlock, ensure ] + | Else <- Info.category (extract elseBlock) + , Ensure <- Info.category (extract ensure) -> S.Try body rescues (Just elseBlock) (Just ensure) + [ ensure, elseBlock ] + | Ensure <- Info.category (extract ensure) + , Else <- Info.category (extract elseBlock) -> S.Try body rescues (Just elseBlock) (Just ensure) + [ elseBlock ] | Else <- Info.category (extract elseBlock) -> S.Try body rescues (Just elseBlock) Nothing + [ ensure ] | Ensure <- Info.category (extract ensure) -> S.Try body rescues Nothing (Just ensure) + _ -> S.Try body rescues Nothing Nothing + (Class, constant : superclass : body) + | Superclass <- Info.category (extract superclass) + -> Just $ S.Class constant (Just superclass) body + (Class, constant : rest) -> Just $ S.Class constant Nothing rest + (SingletonClass, identifier : rest) -> Just $ S.Class identifier Nothing rest + (Case, _) -> Just $ uncurry S.Switch (Prologue.break ((== When) . Info.category . extract) children) + (When, expr : body) -> Just $ S.Case expr body + (Ternary, condition : cases) -> Just $ S.Ternary condition cases + (Constant, _ ) -> Just $ S.Fixed children + (MethodCall, fn : args) + | MemberAccess <- Info.category (extract fn) + , [target, method] <- toList (unwrap fn) + -> Just $ S.MethodCall target method (toList . unwrap =<< args) + | otherwise + -> Just $ S.FunctionCall fn (toList . unwrap =<< args) + (Other "lambda", first : rest) + | null rest -> Just $ S.AnonymousFunction [] [first] + | otherwise -> Just $ S.AnonymousFunction (toList (unwrap first)) rest + (Object, _ ) -> Just . S.Object Nothing $ foldMap toTuple children + (Modifier If, [ lhs, condition ]) -> Just $ S.If condition [lhs] + (Modifier Unless, [lhs, rhs]) -> Just $ S.If (withRecord (setCategory (extract rhs) Negate) (S.Negate rhs)) [lhs] + (Unless, expr : rest) -> Just $ S.If (withRecord (setCategory (extract expr) Negate) (S.Negate expr)) rest + (Modifier Until, [ lhs, rhs ]) -> Just $ S.While (withRecord (setCategory (extract rhs) Negate) (S.Negate rhs)) [lhs] + (Until, expr : rest) -> Just $ S.While (withRecord (setCategory (extract expr) Negate) (S.Negate expr)) rest + (Elsif, condition : body ) -> Just $ S.If condition body + (SubscriptAccess, [ base, element ]) -> Just $ S.SubscriptAccess base element + (For, lhs : expr : rest ) -> Just $ S.For [lhs, expr] rest + (OperatorAssignment, [ identifier, value ]) -> Just $ S.OperatorAssignment identifier value + (MemberAccess, [ base, property ]) -> Just $ S.MemberAccess base property + (Method, expr : methodName : rest) + | params : body <- rest + , Params <- Info.category (extract params) + -> Just $ S.Method methodName (Just expr) Nothing (toList (unwrap params)) body + | Identifier <- Info.category (extract methodName) + -> Just $ S.Method methodName (Just expr) Nothing [] rest + (Method, identifier : rest) + | params : body <- rest + , Params <- Info.category (extract params) + -> Just $ S.Method identifier Nothing Nothing (toList (unwrap params)) body + | otherwise + -> Just $ S.Method identifier Nothing Nothing [] rest + (Module, constant : body ) -> Just $ S.Module constant body + (Modifier Rescue, [lhs, rhs] ) -> Just $ S.Rescue [lhs] [rhs] + (Rescue, exceptions : exceptionVar : rest) + | RescueArgs <- Info.category (extract exceptions) + , RescuedException <- Info.category (extract exceptionVar) + -> Just $ S.Rescue (toList (unwrap exceptions) <> [exceptionVar]) rest + (Rescue, exceptionVar : rest) + | RescuedException <- Info.category (extract exceptionVar) + -> Just $ S.Rescue [exceptionVar] rest + (Rescue, exceptions : body) + | RescueArgs <- Info.category (extract exceptions) + -> Just $ S.Rescue (toList (unwrap exceptions)) body + (Rescue, body) -> Just $ S.Rescue [] body + (Modifier While, [ lhs, condition ]) -> Just $ S.While condition [lhs] + _ | category `elem` [ BeginBlock, EndBlock ] -> Just $ S.BlockStatement children + _ -> Nothing + where + withRecord record syntax = cofree (record :< syntax) + +categoryForRubyName :: Text -> Category +categoryForRubyName = \case + "argument_list" -> Args + "argument_list_with_parens" -> Args + "argument_pair" -> ArgumentPair + "array" -> ArrayLiteral + "assignment" -> Assignment + "begin_block" -> BeginBlock + "begin" -> Begin + "binary" -> Binary + "block_parameter" -> BlockParameter + "block_parameters" -> Params + "boolean" -> Boolean + "call" -> MemberAccess + "case" -> Case + "class" -> Class + "comment" -> Comment + "conditional" -> Ternary + "constant" -> Constant + "element_reference" -> SubscriptAccess + "else" -> Else + "elsif" -> Elsif + "empty_statement" -> Empty + "end_block" -> EndBlock + "ensure" -> Ensure + "exception_variable" -> RescuedException + "exceptions" -> RescueArgs + "false" -> Boolean + "float" -> NumberLiteral + "for" -> For + "hash_splat_parameter" -> HashSplatParameter + "hash" -> Object + "identifier" -> Identifier + "if_modifier" -> Modifier If + "if" -> If + "instance_variable" -> Identifier + "integer" -> IntegerLiteral + "interpolation" -> Interpolation + "keyword_parameter" -> KeywordParameter + "lambda_parameters" -> Params + "method_call" -> MethodCall + "method_parameters" -> Params + "method" -> Method + "module" -> Module + "nil" -> Identifier + "operator_assignment" -> OperatorAssignment + "optional_parameter" -> OptionalParameter + "pair" -> Pair + "program" -> Program + "range" -> RangeExpression + "regex" -> Regex + "rescue_modifier" -> Modifier Rescue + "rescue" -> Rescue + "return" -> Return + "scope_resolution" -> ScopeOperator + "self" -> Identifier + "singleton_class" -> SingletonClass + "splat_parameter" -> SplatParameter + "string" -> StringLiteral + "subshell" -> Subshell + "superclass" -> Superclass + "symbol" -> SymbolLiteral + "true" -> Boolean + "unary" -> Unary + "unless_modifier" -> Modifier Unless + "unless" -> Unless + "until_modifier" -> Modifier Until + "until" -> Until + "when" -> When + "while_modifier" -> Modifier While + "while" -> While + "yield" -> Yield + s -> Other s diff --git a/src/Line.hs b/src/Line.hs deleted file mode 100644 index 0f0bf71e7..000000000 --- a/src/Line.hs +++ /dev/null @@ -1,64 +0,0 @@ -{-# LANGUAGE FlexibleInstances #-} -module Line where - -import Control.Applicative -import Data.Align -import Data.Coalescent -import Data.Functor.Both - --- | A line of items or an empty line. -data Line a = Line [a] | Closed [a] - deriving (Eq, Foldable, Functor, Show, Traversable) - --- | Construct a single-element Line with a predicate determining whether the line is open. -pureBy :: (a -> Bool) -> a -> Line a -pureBy predicate a | predicate a = Line [ a ] - | otherwise = Closed [ a ] - -unLine :: Line a -> [a] -unLine (Line as) = as -unLine (Closed as) = as - --- | Is the given line empty? -isEmpty :: Line a -> Bool -isEmpty = null . unLine - --- | Is the given line open? -isOpen :: Line a -> Bool -isOpen (Line _) = True -isOpen _ = False - --- | The increment the given line implies for line numbering. -lineIncrement :: Num n => Line a -> n -lineIncrement line | isEmpty line = 0 - | otherwise = 1 - --- | Transform the line by applying a function to a list of all the items in the --- | line. -wrapLineContents :: ([a] -> b) -> Line a -> Line b -wrapLineContents transform line = lineMap (if isEmpty line then const [] else pure . transform) line - --- | Map the elements of a line, preserving closed lines. -lineMap :: ([a] -> [b]) -> Line a -> Line b -lineMap f (Line ls) = Line (f ls) -lineMap f (Closed cs) = Closed (f cs) - --- | Return the first item in the Foldable, or Nothing if it's empty. -maybeFirst :: Foldable f => f a -> Maybe a -maybeFirst = foldr (const . Just) Nothing - -instance Applicative Line where - pure = Line . pure - as <*> bs | isOpen as && isOpen bs = Line (unLine as <*> unLine bs) - | otherwise = Closed (unLine as <*> unLine bs) - -instance Monoid (Line a) where - mempty = Line [] - mappend xs ys = lineMap (mappend (unLine xs)) ys - -instance Coalescent (Line a) where - coalesce a b | isOpen a = pure (a `mappend` b) - | otherwise = pure a <|> pure b - -instance Coalescent (Both (Line a)) where - coalesce as bs = tsequenceL (pure (Line [])) (coalesce <$> as <*> bs) diff --git a/src/Operation.hs b/src/Operation.hs deleted file mode 100644 index bccbbb8bf..000000000 --- a/src/Operation.hs +++ /dev/null @@ -1,20 +0,0 @@ -module Operation where - -import Diff -import Data.OrderedMap -import qualified Data.Text as T -import Term - --- | A single step in a diffing algorithm. -data Operation - a -- ^ The type of leaves in the syntax tree, typically String, but possibly some datatype representing different leaves more precisely. - annotation -- ^ The type of annotations. - f -- ^ The type representing another level of the diffing algorithm. Often Algorithm. - = - -- | Recursively diff two terms and pass the result to the continuation. - Recursive (Term a annotation) (Term a annotation) (Diff a annotation -> f) - -- | Diff two dictionaries and pass the result to the continuation. - | ByKey (OrderedMap T.Text (Term a annotation)) (OrderedMap T.Text (Term a annotation)) (OrderedMap T.Text (Diff a annotation) -> f) - -- | Diff two arrays and pass the result to the continuation. - | ByIndex [Term a annotation] [Term a annotation] ([Diff a annotation] -> f) - deriving Functor diff --git a/src/Parse.hs b/src/Parse.hs new file mode 100644 index 000000000..1276d5975 --- /dev/null +++ b/src/Parse.hs @@ -0,0 +1,128 @@ +{-# LANGUAGE DataKinds, RankNTypes, TypeOperators, DeriveAnyClass #-} +module Parse where + +import Arguments +import Category +import Data.Aeson (ToJSON) +import Data.Aeson.Encode.Pretty +import qualified Data.ByteString.Char8 as B1 +import qualified Data.Text.ICU.Convert as Convert +import qualified Data.Text.ICU.Detect as Detect +import Data.Record +import qualified Data.Text as T +import qualified Data.Text.IO as T +import Info +import Language +import Language.Markdown +import Parser +import Prologue +import Source +import Syntax +import System.FilePath +import Term +import TreeSitter +import Renderer +import Renderer.JSON() +import Renderer.SExpression +import Text.Parser.TreeSitter.C +import Text.Parser.TreeSitter.Go +import Text.Parser.TreeSitter.JavaScript +import Text.Parser.TreeSitter.Ruby + +data ParseJSON = ParseJSON + { category :: Text + , range :: Range + , text :: SourceText + , children :: [ParseJSON] + } deriving (Show, Generic, ToJSON) + +run :: Arguments -> IO () +run Arguments{..} = do + sources <- sequence $ readAndTranscodeFile <$> filePaths + terms <- zipWithM (\parser sourceBlob -> parser sourceBlob) parsers (sourceBlobs sources) + + writeToOutput output $ case format of + SExpression -> [foldr (\t acc -> printTerm t 0 <> acc) "" terms] + _ -> toS . encodePretty . cata algebra <$> terms + + where + sourceBlobs sources = Source.SourceBlob <$> sources <*> pure mempty <*> filePaths <*> pure (Just Source.defaultPlainBlob) + parsers = parserWithSource <$> filePaths + + algebra :: TermF (Syntax leaf) (Record '[SourceText, Range, Category, SourceSpan]) ParseJSON -> ParseJSON + algebra term = case term of + (annotation :< Leaf _) -> ParseJSON (category' annotation) (range' annotation) (text' annotation) [] + (annotation :< syntax) -> ParseJSON (category' annotation) (range' annotation) (text' annotation) (toList syntax) + where + category' = toS . Info.category + range' = characterRange + text' = Info.sourceText + + writeToOutput :: Maybe FilePath -> [Text] -> IO () + writeToOutput output text = + case output of + Nothing -> for_ text putStrLn + Just path -> for_ text (T.writeFile path) + +-- | Return a parser that decorates with the cost of a term and its children. +parserWithCost :: FilePath -> Parser (Syntax Text) (Record '[Cost, Range, Category, SourceSpan]) +parserWithCost path blob = decorateTerm termCostDecorator <$> parserForType (toS (takeExtension path)) blob + +-- | Return a parser that decorates with the source text. +parserWithSource :: FilePath -> Parser (Syntax Text) (Record '[SourceText, Range, Category, SourceSpan]) +parserWithSource path blob = decorateTerm (termSourceDecorator (source blob)) <$> parserForType (toS (takeExtension path)) blob + +-- | Return a parser based on the file extension (including the "."). +parserForType :: Text -> Parser (Syntax Text) (Record '[Range, Category, SourceSpan]) +parserForType mediaType = case languageForType mediaType of + Just C -> treeSitterParser C tree_sitter_c + Just JavaScript -> treeSitterParser JavaScript tree_sitter_javascript + Just Markdown -> cmarkParser + Just Ruby -> treeSitterParser Ruby tree_sitter_ruby + Just Language.Go -> treeSitterParser Language.Go tree_sitter_go + _ -> lineByLineParser + +-- | Decorate a 'Term' using a function to compute the annotation values at every node. +decorateTerm :: (Functor f) => TermDecorator f fields field -> Term f (Record fields) -> Term f (Record (field ': fields)) +decorateTerm decorator = cata $ \ term -> cofree ((decorator (extract <$> term) :. headF term) :< tailF term) + +-- | A function computing a value to decorate terms with. This can be used to cache synthesized attributes on terms. +type TermDecorator f fields field = TermF f (Record fields) (Record (field ': fields)) -> field + +-- | Term decorator computing the cost of an unpacked term. +termCostDecorator :: (Foldable f, Functor f) => TermDecorator f a Cost +termCostDecorator c = 1 + sum (cost <$> tailF c) + +-- | Term decorator extracting the source text for a term. +termSourceDecorator :: (HasField fields Range) => Source Char -> TermDecorator f fields SourceText +termSourceDecorator source c = SourceText . toText $ Source.slice range' source + where range' = characterRange $ headF c + +-- | A fallback parser that treats a file simply as rows of strings. +lineByLineParser :: Parser (Syntax Text) (Record '[Range, Category, SourceSpan]) +lineByLineParser SourceBlob{..} = pure . cofree . root $ case foldl' annotateLeaves ([], 0) lines of + (leaves, _) -> cofree <$> leaves + where + lines = actualLines source + root children = (Range 0 (length source) :. Program :. rangeToSourceSpan source (Range 0 (length source)) :. Nil) :< Indexed children + leaf charIndex line = (Range charIndex (charIndex + T.length line) :. Program :. rangeToSourceSpan source (Range charIndex (charIndex + T.length line)) :. Nil) :< Leaf line + annotateLeaves (accum, charIndex) line = + (accum <> [ leaf charIndex (toText line) ] , charIndex + length line) + toText = T.pack . Source.toString + +-- | Return the parser that should be used for a given path. +parserForFilepath :: FilePath -> Parser (Syntax Text) (Record '[Cost, Range, Category, SourceSpan]) +parserForFilepath path blob = decorateTerm termCostDecorator <$> parserForType (toS (takeExtension path)) blob + +-- | Read the file and convert it to Unicode. +readAndTranscodeFile :: FilePath -> IO (Source Char) +readAndTranscodeFile path = do + text <- B1.readFile path + transcode text + +-- | Transcode a file to a unicode source. +transcode :: B1.ByteString -> IO (Source Char) +transcode text = fromText <$> do + match <- Detect.detectCharset text + converter <- Convert.open match Nothing + pure $ Convert.toUnicode converter text diff --git a/src/Parser.hs b/src/Parser.hs index f6fc2662d..8a5be75e5 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -1,51 +1,9 @@ module Parser where -import Category -import Diff -import Range -import Syntax -import Term -import Control.Comonad.Cofree -import qualified Data.OrderedMap as Map -import qualified Data.Set as Set +import Prologue import Source -import Data.Text as Text --- | A function that takes a source file and returns an annotated AST. +-- | A function that takes a source blob and returns an annotated AST. -- | The return is in the IO monad because some of the parsers are written in C -- | and aren't pure. -type Parser = Source Char -> IO (Term Text Info) - --- | Given a source string, the term's range, production name, and --- | production/child pairs, construct the term. -type Constructor = Source Char -> Range -> String -> [Term Text Info] -> Term Text Info - --- | Categories that are treated as keyed nodes. -keyedCategories :: Set.Set Category -keyedCategories = Set.fromList [ DictionaryLiteral ] - --- | Categories that are treated as fixed nodes. -fixedCategories :: Set.Set Category -fixedCategories = Set.fromList [ BinaryOperator, Pair ] - --- | Should these categories be treated as keyed nodes? -isKeyed :: Set.Set Category -> Bool -isKeyed = not . Set.null . Set.intersection keyedCategories - --- | Should these categories be treated as fixed nodes? -isFixed :: Set.Set Category -> Bool -isFixed = not . Set.null . Set.intersection fixedCategories - --- | Given a function that maps production names to sets of categories, produce --- | a Constructor. -termConstructor :: (String -> Set.Set Category) -> Constructor -termConstructor mapping source range name = (Info range categories :<) . construct - where - categories = mapping name - construct [] = Leaf . pack . toString $ slice range source - construct children | isFixed categories = Fixed children - construct children | isKeyed categories = Keyed . Map.fromList $ assignKey <$> children - construct children = Indexed children - assignKey node@(Info _ categories :< Fixed (key : _)) | Set.member Pair categories = (getSubstring key, node) - assignKey node = (getSubstring node, node) - getSubstring (Info range _ :< _) = pack . toString $ slice range source +type Parser f a = SourceBlob -> IO (Cofree f a) diff --git a/src/Patch.hs b/src/Patch.hs index 21f9632d4..0e976a91c 100644 --- a/src/Patch.hs +++ b/src/Patch.hs @@ -1,21 +1,60 @@ -module Patch where +{-# OPTIONS_GHC -funbox-strict-fields #-} +module Patch +( Patch(..) +, replacing +, inserting +, deleting +, after +, before +, afterOrBefore +, unPatch +, patchSum +, maybeFst +, maybeSnd +, mapPatch +, patchType +) where -import Data.Bifunctor.These +import Data.Functor.Listable +import Data.These +import Prologue -- | An operation to replace, insert, or delete an item. -data Patch a = - Replace a a +data Patch a + = Replace a a | Insert a | Delete a - deriving (Functor, Show, Eq) + deriving (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) + + +-- DSL + +-- | Constructs the replacement of one value by another in an Applicative context. +replacing :: Applicative f => a -> a -> f (Patch a) +replacing = (pure .) . Replace + +-- | Constructs the insertion of a value in an Applicative context. +inserting :: Applicative f => a -> f (Patch a) +inserting = pure . Insert + +-- | Constructs the deletion of a value in an Applicative context. +deleting :: Applicative f => a -> f (Patch a) +deleting = pure . Delete + -- | Return the item from the after side of the patch. after :: Patch a -> Maybe a -after = maybeFirst . unPatch +after = maybeSnd . unPatch -- | Return the item from the before side of the patch. before :: Patch a -> Maybe a -before = maybeSecond . unPatch +before = maybeFst . unPatch + +afterOrBefore :: Patch a -> Maybe a +afterOrBefore patch = case (before patch, after patch) of + (_, Just after) -> Just after + (Just before, _) -> Just before + (_, _) -> Nothing -- | Return both sides of a patch. unPatch :: Patch a -> These a a @@ -23,6 +62,33 @@ unPatch (Replace a b) = These a b unPatch (Insert b) = That b unPatch (Delete a) = This a +mapPatch :: (a -> b) -> (a -> b) -> Patch a -> Patch b +mapPatch f _ (Delete a ) = Delete (f a) +mapPatch _ g (Insert b) = Insert (g b) +mapPatch f g (Replace a b) = Replace (f a) (g b) + -- | Calculate the cost of the patch given a function to compute the cost of a item. -patchSum :: (a -> Integer) -> Patch a -> Integer +patchSum :: (a -> Int) -> Patch a -> Int patchSum termCost patch = maybe 0 termCost (before patch) + maybe 0 termCost (after patch) + +-- | Return Just the value in This, or the first value in These, if any. +maybeFst :: These a b -> Maybe a +maybeFst = these Just (const Nothing) ((Just .) . const) + +-- | Return Just the value in That, or the second value in These, if any. +maybeSnd :: These a b -> Maybe b +maybeSnd = these (const Nothing) Just ((Just .) . flip const) + +patchType :: Patch a -> Text +patchType = \case + Replace{} -> "modified" + Insert{} -> "added" + Delete{} -> "removed" + +-- Instances + +instance Listable1 Patch where + liftTiers t = liftCons1 t Insert \/ liftCons1 t Delete \/ liftCons2 t t Replace + +instance Listable a => Listable (Patch a) where + tiers = tiers1 diff --git a/src/Prologue.hs b/src/Prologue.hs new file mode 100644 index 000000000..61a7687e5 --- /dev/null +++ b/src/Prologue.hs @@ -0,0 +1,21 @@ +module Prologue +( module X +, lookup +, (&&&) +, (***) +, hylo, cata, para, ana +, module Data.Hashable +) where + +import Protolude as X +import Data.List (lookup) + +import Control.Comonad.Trans.Cofree as X +import Control.Monad.Trans.Free as X +import Control.Comonad as X + +import Control.Arrow ((&&&), (***)) + +import Data.Functor.Foldable (hylo, cata, para, ana) + +import Data.Hashable diff --git a/src/Range.hs b/src/Range.hs index 983d2ee64..cdbe313a0 100644 --- a/src/Range.hs +++ b/src/Range.hs @@ -1,14 +1,16 @@ -{-# LANGUAGE FlexibleInstances #-} module Range where -import Control.Applicative ((<|>)) import qualified Data.Char as Char -import Data.Maybe (fromMaybe) -import Data.Option +import Data.List (span) +import Data.List.NonEmpty (nonEmpty) +import Data.Semigroup +import Data.String +import Prologue +import Test.LeanCheck -- | A half-open interval of integers, defined by start & end indices. -data Range = Range { start :: !Int, end :: !Int } - deriving (Eq, Show) +data Range = Range { start :: Int, end :: Int } + deriving (Eq, Show, Generic) -- | Make a range at a given index. rangeAt :: Int -> Range @@ -35,9 +37,9 @@ rangesAndWordsFrom startIndex string = fromMaybe [] $ take isWord <|> take isPun endFor parsed = startIndex + length parsed parse transform predicate = case span predicate string of ([], _) -> Nothing - (parsed, rest) -> Just $ maybe id (:) (transform parsed) $ rangesAndWordsFrom (endFor parsed) rest + (parsed, rest) -> Just . maybe identity (:) (transform parsed) $ rangesAndWordsFrom (endFor parsed) rest -- | Is this a word character? - -- | Word characters are defined as in [Ruby’s `\p{Word}` syntax](http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Character+Properties), i.e.: + -- | Word characters are defined as in [Ruby’s `\p{Word}` syntax](http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Character+Properties), i.e:. -- | > A member of one of the following Unicode general category _Letter_, _Mark_, _Number_, _Connector_Punctuation_ isWord c = Char.isLetter c || Char.isNumber c || Char.isMark c || Char.generalCategory c == Char.ConnectorPunctuation isPunctuation c = not (Char.isSpace c || isWord c) @@ -47,24 +49,30 @@ maybeLastIndex :: Range -> Maybe Int maybeLastIndex (Range start end) | start == end = Nothing maybeLastIndex (Range _ end) = Just $ end - 1 +-- | Test two ranges for intersection. +intersectsRange :: Range -> Range -> Bool +intersectsRange range1 range2 = start range1 < end range2 && start range2 < end range1 + +-- Return the (possibly empty, possibly ill-formed) intersection of two ranges. +intersectionRange :: Range -> Range -> Range +intersectionRange range1 range2 = Range (max (start range1) (start range2)) (min (end range1) (end range2)) + -- | Return a range that contains both the given ranges. unionRange :: Range -> Range -> Range unionRange (Range start1 end1) (Range start2 end2) = Range (min start1 start2) (max end1 end2) --- | Return a range that contains all the ranges in a Foldable, or Range 0 0 if it’s empty. -unionRanges :: Foldable f => f Range -> Range -unionRanges = unionRangesFrom (Range 0 0) - -- | Return a range that contains all the ranges in a Foldable, or the passed Range if the Foldable is empty. unionRangesFrom :: Foldable f => Range -> f Range -> Range -unionRangesFrom range = fromMaybe range . maybeConcat +unionRangesFrom range = maybe range sconcat . nonEmpty . toList -instance Monoid (Option Range) where - mempty = Option Nothing - mappend (Option (Just a)) (Option (Just b)) = Option (Just (unionRange a b)) - mappend a@(Option (Just _)) _ = a - mappend _ b@(Option (Just _)) = b - mappend _ _ = mempty + +-- Instances + +instance Semigroup Range where + a <> b = unionRange a b instance Ord Range where a <= b = start a <= start b + +instance Listable Range where + tiers = cons2 Range diff --git a/src/Renderer.hs b/src/Renderer.hs index ac8dc73c1..8b72c8490 100644 --- a/src/Renderer.hs +++ b/src/Renderer.hs @@ -1,8 +1,76 @@ -module Renderer where +module Renderer (Renderer, DiffArguments(..), Output(..), concatOutputs, toSummaryKey, Format(..)) where +import Data.Aeson (Value, toEncoding) +import Data.Aeson.Encoding (encodingToLazyByteString) import Data.Functor.Both +import Data.Map as Map hiding (null) +import Data.Text as T (intercalate) import Diff -import Source +import Prologue +import Source (SourceBlob) +import Syntax --- | A function that will render a diff, given the two source files. -type Renderer a b = Diff a Info -> Both SourceBlob -> b +-- | A function that will render a diff, given the two source blobs. +type Renderer annotation = Both SourceBlob -> Diff (Syntax Text) annotation -> Output + +data DiffArguments = DiffArguments { format :: Format, output :: Maybe FilePath } + deriving (Show) + +-- | The available types of diff rendering. +data Format = Split | Patch | JSON | Summary | SExpression | TOC + deriving (Show) + +data Output = SplitOutput Text | PatchOutput Text | JSONOutput (Map Text Value) | SummaryOutput (Map Text (Map Text [Value])) | SExpressionOutput Text | TOCOutput (Map Text (Map Text [Value])) + deriving (Show) + +-- Returns a key representing the filename. If the filenames are different, +-- return 'before -> after'. +toSummaryKey :: Both FilePath -> Text +toSummaryKey = runBothWith $ \before after -> + toS $ case (before, after) of + ("", after) -> after + (before, "") -> before + (before, after) | before == after -> after + (before, after) | not (null before) && not (null after) -> before <> " -> " <> after + (_, _) -> mempty + +-- Concatenates a list of 'Output' depending on the output type. +-- For JSON, each file output is merged since they're uniquely keyed by filename. +-- For Summaries, each file output is merged into one 'Object' consisting of lists of +-- changes and errors. +-- Split and Patch output is appended together with newlines. +concatOutputs :: [Output] -> Text +concatOutputs list | isJSON list = toS . encodingToLazyByteString . toEncoding $ concatJSON list + where + concatJSON :: [Output] -> Map Text Value + concatJSON (JSONOutput hash : rest) = Map.union hash (concatJSON rest) + concatJSON _ = mempty +concatOutputs list | isSummary list = toS . encodingToLazyByteString . toEncoding $ concatSummaries list + where + concatSummaries :: [Output] -> Map Text (Map Text [Value]) + concatSummaries (SummaryOutput hash : rest) = Map.unionWith (Map.unionWith (<>)) hash (concatSummaries rest) + concatSummaries (TOCOutput hash : rest) = Map.unionWith (Map.unionWith (<>)) hash (concatSummaries rest) + concatSummaries _ = mempty +concatOutputs list | isText list = T.intercalate "\n" (toText <$> list) +concatOutputs _ = mempty + +isJSON :: [Output] -> Bool +isJSON (JSONOutput _ : _) = True +isJSON _ = False + +isSummary :: [Output] -> Bool +isSummary (SummaryOutput _ : _) = True +isSummary (TOCOutput _ : _) = True +isSummary _ = False + +isText :: [Output] -> Bool +isText (SplitOutput _ : _) = True +isText (PatchOutput _ : _) = True +isText (SExpressionOutput _ : _) = True +isText _ = False + +toText :: Output -> Text +toText (SplitOutput text) = text +toText (PatchOutput text) = text +toText (SExpressionOutput text) = text +toText _ = mempty diff --git a/src/Renderer/JSON.hs b/src/Renderer/JSON.hs index 496d838c3..9e5b6a9f4 100644 --- a/src/Renderer/JSON.hs +++ b/src/Renderer/JSON.hs @@ -1,83 +1,155 @@ -{-# LANGUAGE FlexibleInstances, OverloadedStrings, TypeSynonymInstances #-} +{-# LANGUAGE OverloadedStrings, TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Renderer.JSON ( json ) where +import Prologue hiding (toList) import Alignment import Category -import Control.Comonad.Cofree -import Control.Monad.Free -import Data.Aeson hiding (json) -import Data.ByteString.Builder -import Data.ByteString.Lazy -import Data.Functor.Both -import Data.Monoid -import Data.OrderedMap hiding (fromList) +import Data.Aeson as A hiding (json) +import Data.Bifunctor.Join +import Data.Record import qualified Data.Text as T -import Data.Vector hiding (toList) -import Diff -import Line -import Range +import Data.These +import Data.Vector as Vector hiding (toList) +import Info import Renderer import Source hiding (fromList) import SplitDiff -import Syntax +import Syntax as S import Term +import qualified Data.Map as Map -- | Render a diff to a string representing its JSON. -json :: Renderer a ByteString -json diff sources = toLazyByteString . fromEncoding . pairs $ - "rows" .= annotateRows (splitDiffByLines (source <$> sources) diff) - <> "oids" .= (oid <$> sources) - <> "paths" .= (path <$> sources) - where annotateRows = fmap (fmap NumberedLine) . numberedRows +json :: (ToJSON (Record fields), HasField fields Category, HasField fields Range) => Renderer (Record fields) +json blobs diff = JSONOutput $ Map.fromList [ + ("rows", toJSON (annotateRows (alignDiff (source <$> blobs) diff))), + ("oids", toJSON (oid <$> blobs)), + ("paths", toJSON (path <$> blobs)) ] + where annotateRows :: [Join These a] -> [Join These (NumberedLine a)] + annotateRows = fmap (fmap NumberedLine) . numberedRows -newtype NumberedLine a = NumberedLine (Int, Line a) +-- | A numbered 'a'. +newtype NumberedLine a = NumberedLine (Int, a) + +instance (ToJSON leaf, ToJSON (Record fields), HasField fields Category, HasField fields Range) => ToJSON (NumberedLine (SplitSyntaxDiff leaf fields)) where + toJSON (NumberedLine (n, a)) = object (lineFields n a (getRange a)) + toEncoding (NumberedLine (n, a)) = pairs $ mconcat (lineFields n a (getRange a)) -instance ToJSON (NumberedLine (SplitDiff leaf Info, Range)) where - toJSON (NumberedLine (n, a)) = object (lineFields n a) - toEncoding (NumberedLine (n, a)) = pairs $ mconcat (lineFields n a) instance ToJSON Category where - toJSON (Other s) = String $ T.pack s + toJSON (Other s) = String s toJSON s = String . T.pack $ show s + instance ToJSON Range where - toJSON (Range start end) = Array . fromList $ toJSON <$> [ start, end ] - toEncoding (Range start end) = foldable [ start, end ] -instance ToJSON a => ToJSON (Both a) where - toJSON (Both (a, b)) = Array . fromList $ toJSON <$> [ a, b ] + toJSON (Range start end) = A.Array . Vector.fromList $ toJSON <$> [ start, end ] + toEncoding (Range start end) = foldable [ start, end ] + +instance ToJSON a => ToJSON (Join These a) where + toJSON (Join vs) = A.Array . Vector.fromList $ toJSON <$> these pure pure (\ a b -> [ a, b ]) vs toEncoding = foldable -instance ToJSON (SplitDiff leaf Info) where - toJSON (Free (Annotated info syntax)) = object (termFields info syntax) - toJSON (Pure patch) = object (patchFields patch) - toEncoding (Free (Annotated info syntax)) = pairs $ mconcat (termFields info syntax) - toEncoding (Pure patch) = pairs $ mconcat (patchFields patch) -instance ToJSON value => ToJSON (OrderedMap T.Text value) where - toJSON map = object $ uncurry (.=) <$> toList map - toEncoding map = pairs . mconcat $ uncurry (.=) <$> toList map -instance ToJSON (Term leaf Info) where - toJSON (info :< syntax) = object (termFields info syntax) - toEncoding (info :< syntax) = pairs $ mconcat (termFields info syntax) -lineFields :: KeyValue kv => Int -> Line (SplitDiff leaf Info, Range) -> [kv] -lineFields n line | isEmpty line = [] - | otherwise = [ "number" .= n - , "terms" .= unLine (Prelude.fst <$> line) - , "range" .= unionRanges (Prelude.snd <$> line) - , "hasChanges" .= hasChanges (Prelude.fst <$> line) - ] +instance ToJSON a => ToJSON (Join (,) a) where + toJSON (Join (a, b)) = A.Array . Vector.fromList $ toJSON <$> [ a, b ] -termFields :: (ToJSON recur, KeyValue kv) => Info -> Syntax leaf recur -> [kv] -termFields (Info range categories) syntax = "range" .= range : "categories" .= categories : case syntax of - Leaf _ -> [] - Indexed c -> childrenFields c - Fixed c -> childrenFields c - Keyed c -> childrenFields c - where childrenFields c = [ "children" .= c ] +instance (ToJSON leaf, ToJSON (Record fields), HasField fields Category, HasField fields Range) => ToJSON (SplitSyntaxDiff leaf fields) where + toJSON splitDiff = case runFree splitDiff of + (Free (info :< syntax)) -> object (termFields info syntax) + (Pure patch) -> object (patchFields patch) + toEncoding splitDiff = case runFree splitDiff of + (Free (info :< syntax)) -> pairs $ mconcat (termFields info syntax) + (Pure patch) -> pairs $ mconcat (patchFields patch) -patchFields :: KeyValue kv => SplitPatch (Cofree (Syntax leaf) Info) -> [kv] +instance (ToJSON (Record fields), ToJSON leaf, HasField fields Category, HasField fields Range) => ToJSON (SyntaxTerm leaf fields) where + toJSON term | + (info :< syntax) <- runCofree term = object (termFields info syntax) + toEncoding term | + (info :< syntax) <- runCofree term = pairs $ mconcat (termFields info syntax) + +lineFields :: (ToJSON leaf, ToJSON (Record fields), HasField fields Category, HasField fields Range, KeyValue kv) => + Int -> + SplitSyntaxDiff leaf fields -> + Range -> + [kv] +lineFields n term range = [ "number" .= n + , "terms" .= [ term ] + , "range" .= range + , "hasChanges" .= hasChanges term + ] + +termFields :: (ToJSON recur, KeyValue kv, HasField fields Category, HasField fields Range) => + Record fields -> + Syntax leaf recur -> + [kv] +termFields info syntax = "range" .= characterRange info : "category" .= category info : syntaxToTermField syntax + +patchFields :: (ToJSON (Record fields), ToJSON leaf, KeyValue kv, HasField fields Category, HasField fields Range) => + SplitPatch (SyntaxTerm leaf fields) -> + [kv] patchFields patch = case patch of SplitInsert term -> fields "insert" term SplitDelete term -> fields "delete" term SplitReplace term -> fields "replace" term - where fields kind (info :< syntax) = "patch" .= T.pack kind : termFields info syntax + where + fields kind term | + (info :< syntax) <- runCofree term = "patch" .= T.pack kind : termFields info syntax + +syntaxToTermField :: (ToJSON recur, KeyValue kv) => + Syntax leaf recur -> + [kv] +syntaxToTermField syntax = case syntax of + Leaf _ -> [] + Indexed c -> childrenFields c + Fixed c -> childrenFields c + S.FunctionCall identifier parameters -> [ "identifier" .= identifier ] <> [ "parameters" .= parameters ] + S.Ternary expression cases -> [ "expression" .= expression ] <> [ "cases" .= cases ] + S.AnonymousFunction parameters c -> [ "parameters" .= parameters ] <> childrenFields c + S.Function identifier parameters ty c -> [ "identifier" .= identifier ] <> [ "parameters" .= parameters ] <> [ "type" .= ty ] <> childrenFields c + S.Assignment assignmentId value -> [ "identifier" .= assignmentId ] <> [ "value" .= value ] + S.OperatorAssignment identifier value -> [ "identifier" .= identifier ] <> [ "value" .= value ] + S.MemberAccess identifier value -> [ "identifier" .= identifier ] <> [ "value" .= value ] + S.MethodCall identifier methodIdentifier parameters -> [ "identifier" .= identifier ] <> [ "methodIdentifier" .= methodIdentifier ] <> [ "parameters" .= parameters ] + S.Operator syntaxes -> [ "operatorSyntaxes" .= syntaxes ] + S.VarDecl declaration ty -> [ "declaration" .= declaration ] <> [ "type" .= ty] + S.VarAssignment identifier value -> [ "identifier" .= identifier ] <> [ "value" .= value ] + S.SubscriptAccess identifier property -> [ "identifier" .= identifier ] <> [ "property" .= property ] + S.Switch expression cases -> [ "expression" .= expression ] <> [ "cases" .= cases ] + S.Case expression statements -> [ "expression" .= expression ] <> [ "statements" .= statements ] + S.Object ty keyValuePairs -> [ "type" .= ty ] <> childrenFields keyValuePairs + S.Pair a b -> childrenFields [a, b] + S.Comment _ -> [] + S.Commented comments child -> childrenFields (comments <> maybeToList child) + S.ParseError c -> childrenFields c + S.For expressions body -> [ "expressions" .= expressions ] <> [ "body" .= body ] + S.DoWhile expression body -> [ "expression" .= expression ] <> [ "body" .= body ] + S.While expression body -> [ "expression" .= expression ] <> [ "body" .= body ] + S.Return expression -> [ "expression" .= expression ] + S.Throw c -> [ "expression" .= c ] + S.Constructor expression -> [ "expression" .= expression ] + S.Try body catchExpression elseExpression finallyExpression -> [ "body" .= body ] <> [ "catchExpression" .= catchExpression ] <> [ "elseExpression" .= elseExpression ] <> [ "finallyExpression" .= finallyExpression ] + S.Array ty c -> [ "type" .= ty ] <> childrenFields c + S.Class identifier superclass definitions -> [ "identifier" .= identifier ] <> [ "superclass" .= superclass ] <> [ "definitions" .= definitions ] + S.Method identifier receiver ty parameters definitions -> [ "identifier" .= identifier ] <> [ "receiver" .= receiver ] <> [ "type" .= ty ] <> [ "parameters" .= parameters ] <> [ "definitions" .= definitions ] + S.If expression clauses -> [ "expression" .= expression ] <> childrenFields clauses + S.Module identifier definitions-> [ "identifier" .= identifier ] <> [ "definitions" .= definitions ] + S.Import identifier statements -> [ "identifier" .= identifier ] <> [ "statements" .= statements ] + S.Export identifier statements -> [ "identifier" .= identifier ] <> [ "statements" .= statements ] + S.Yield expr -> [ "yieldExpression" .= expr ] + S.Negate expr -> [ "negate" .= expr ] + S.Rescue args expressions -> [ "args" .= args ] <> childrenFields expressions + S.Select cases -> childrenFields cases + S.Go cases -> childrenFields cases + S.Defer cases -> childrenFields cases + S.TypeAssertion a b -> childrenFields [a, b] + S.TypeConversion a b -> childrenFields [a, b] + S.Struct ty fields -> [ "type" .= ty ] <> childrenFields fields + S.Break expr -> [ "expression" .= expr ] + S.Continue expr -> [ "expression" .= expr ] + S.BlockStatement c -> childrenFields c + S.ParameterDecl ty field -> [ "type" .= ty ] <> [ "identifier" .= field ] + S.DefaultCase c -> childrenFields c + S.TypeDecl id ty -> [ "type" .= ty ] <> [ "identifier" .= id ] + S.FieldDecl id ty tag -> [ "type" .= ty ] <> [ "identifier" .= id ] <> [ "tag" .= tag] + S.Ty ty -> [ "type" .= ty ] + S.Send channel expr -> [ "channel" .= channel ] <> [ "expression" .= expr ] + where childrenFields c = [ "children" .= c ] diff --git a/src/Renderer/Patch.hs b/src/Renderer/Patch.hs index a41d831be..77321c0fe 100644 --- a/src/Renderer/Patch.hs +++ b/src/Renderer/Patch.hs @@ -1,38 +1,43 @@ module Renderer.Patch ( patch, hunks, - Hunk(..) + Hunk(..), + truncatePatch ) where import Alignment +import Data.Bifunctor.Join +import Data.Functor.Both as Both +import Data.List (span, unzip) +import Data.Record +import Data.String +import Data.Text (pack) +import Data.These import Diff -import Line -import Prelude hiding (fst, snd) -import qualified Prelude +import Patch +import Prologue hiding (fst, snd) import Range import Renderer -import Source hiding ((++), break) +import Source hiding (break) import SplitDiff -import Control.Comonad.Cofree -import Control.Monad.Free -import Data.Functor.Both as Both -import Data.List -import Data.Maybe -import Data.Monoid + +-- | Render a timed out file as a truncated diff. +truncatePatch :: DiffArguments -> Both SourceBlob -> Text +truncatePatch _ blobs = pack $ header blobs <> "#timed_out\nTruncating diff: timeout reached.\n" -- | Render a diff in the traditional patch format. -patch :: Renderer a String -patch diff sources = case getLast $ foldMap (Last . Just) string of - Just c | c /= '\n' -> string ++ "\n\\ No newline at end of file\n" +patch :: HasField fields Range => Renderer (Record fields) +patch blobs diff = PatchOutput . pack $ case getLast (foldMap (Last . Just) string) of + Just c | c /= '\n' -> string <> "\n\\ No newline at end of file\n" _ -> string - where string = mconcat $ showHunk sources <$> hunks diff sources + where string = header blobs <> mconcat (showHunk blobs <$> hunks diff blobs) -- | A hunk in a patch, including the offset, changes, and context. -data Hunk a = Hunk { offset :: Both (Sum Int), changes :: [Change a], trailingContext :: [Row a] } +data Hunk a = Hunk { offset :: Both (Sum Int), changes :: [Change a], trailingContext :: [Join These a] } deriving (Eq, Show) -- | A change in a patch hunk, along with its preceding context. -data Change a = Change { context :: [Row a], contents :: [Row a] } +data Change a = Change { context :: [Join These a], contents :: [Join These a] } deriving (Eq, Show) -- | The number of lines in the hunk before and after. @@ -44,87 +49,91 @@ changeLength :: Change a -> Both (Sum Int) changeLength change = mconcat $ (rowIncrement <$> context change) <> (rowIncrement <$> contents change) -- | The increment the given row implies for line numbering. -rowIncrement :: Row a -> Both (Sum Int) -rowIncrement = fmap lineIncrement +rowIncrement :: Join These a -> Both (Sum Int) +rowIncrement = Join . fromThese (Sum 0) (Sum 0) . runJoin . (Sum 1 <$) -- | Given the before and after sources, render a hunk to a string. -showHunk :: Both SourceBlob -> Hunk (SplitDiff a Info) -> String -showHunk blobs hunk = header blobs hunk ++ - concat (showChange sources <$> changes hunk) ++ - showLines (snd sources) ' ' (snd <$> trailingContext hunk) +showHunk :: Functor f => HasField fields Range => Both SourceBlob -> Hunk (SplitDiff f (Record fields)) -> String +showHunk blobs hunk = maybeOffsetHeader <> + concat (showChange sources <$> changes hunk) <> + showLines (snd sources) ' ' (maybeSnd . runJoin <$> trailingContext hunk) where sources = source <$> blobs + maybeOffsetHeader = if lengthA > 0 && lengthB > 0 + then offsetHeader + else mempty + offsetHeader = "@@ -" <> offsetA <> "," <> show lengthA <> " +" <> offsetB <> "," <> show lengthB <> " @@" <> "\n" + (lengthA, lengthB) = runJoin . fmap getSum $ hunkLength hunk + (offsetA, offsetB) = runJoin . fmap (show . getSum) $ offset hunk -- | Given the before and after sources, render a change to a string. -showChange :: Both (Source Char) -> Change (SplitDiff a Info) -> String -showChange sources change = showLines (snd sources) ' ' (snd <$> context change) ++ deleted ++ inserted - where (deleted, inserted) = runBoth $ pure showLines <*> sources <*> Both ('-', '+') <*> Both.unzip (contents change) +showChange :: Functor f => HasField fields Range => Both (Source Char) -> Change (SplitDiff f (Record fields)) -> String +showChange sources change = showLines (snd sources) ' ' (maybeSnd . runJoin <$> context change) <> deleted <> inserted + where (deleted, inserted) = runJoin $ pure showLines <*> sources <*> both '-' '+' <*> Join (unzip (fromThese Nothing Nothing . runJoin . fmap Just <$> contents change)) -- | Given a source, render a set of lines to a string with a prefix. -showLines :: Source Char -> Char -> [Line (SplitDiff leaf Info)] -> String +showLines :: Functor f => HasField fields Range => Source Char -> Char -> [Maybe (SplitDiff f (Record fields))] -> String showLines source prefix lines = fromMaybe "" . mconcat $ fmap prepend . showLine source <$> lines where prepend "" = "" prepend source = prefix : source -- | Given a source, render a line to a string. -showLine :: Source Char -> Line (SplitDiff leaf Info) -> Maybe String -showLine source line | isEmpty line = Nothing - | otherwise = Just . toString . (`slice` source) . unionRanges $ getRange <$> unLine line - --- | Return the range from a split diff. -getRange :: SplitDiff leaf Info -> Range -getRange (Free (Annotated (Info range _) _)) = range -getRange (Pure patch) = let Info range _ :< _ = getSplitTerm patch in range +showLine :: Functor f => HasField fields Range => Source Char -> Maybe (SplitDiff f (Record fields)) -> Maybe String +showLine source line | Just line <- line = Just . toString . (`slice` source) $ getRange line + | otherwise = Nothing -- | Returns the header given two source blobs and a hunk. -header :: Both SourceBlob -> Hunk a -> String -header blobs hunk = intercalate "\n" [filepathHeader, fileModeHeader, beforeFilepath, afterFilepath, maybeOffsetHeader] - where filepathHeader = "diff --git a/" ++ pathA ++ " b/" ++ pathB +header :: Both SourceBlob -> String +header blobs = intercalate "\n" ([filepathHeader, fileModeHeader] <> maybeFilepaths) <> "\n" + where filepathHeader = "diff --git a/" <> pathA <> " b/" <> pathB fileModeHeader = case (modeA, modeB) of - (Nothing, Just mode) -> intercalate "\n" [ "new file mode " ++ modeToDigits mode, blobOidHeader ] - (Just mode, Nothing) -> intercalate "\n" [ "deleted file mode " ++ modeToDigits mode, blobOidHeader ] - (Just mode, Just other) | mode == other -> "index " ++ oidA ++ ".." ++ oidB ++ " " ++ modeToDigits mode + (Nothing, Just mode) -> intercalate "\n" [ "new file mode " <> modeToDigits mode, blobOidHeader ] + (Just mode, Nothing) -> intercalate "\n" [ "deleted file mode " <> modeToDigits mode, blobOidHeader ] + (Just mode, Just other) | mode == other -> "index " <> oidA <> ".." <> oidB <> " " <> modeToDigits mode (Just mode1, Just mode2) -> intercalate "\n" [ - "old mode " ++ modeToDigits mode1, - "new mode " ++ modeToDigits mode2, + "old mode " <> modeToDigits mode1, + "new mode " <> modeToDigits mode2, blobOidHeader ] (Nothing, Nothing) -> "" - blobOidHeader = "index " ++ oidA ++ ".." ++ oidB + blobOidHeader = "index " <> oidA <> ".." <> oidB modeHeader :: String -> Maybe SourceKind -> String -> String modeHeader ty maybeMode path = case maybeMode of - Just _ -> ty ++ "/" ++ path + Just _ -> ty <> "/" <> path Nothing -> "/dev/null" - beforeFilepath = "--- " ++ modeHeader "a" modeA pathA - afterFilepath = "+++ " ++ modeHeader "b" modeB pathB - maybeOffsetHeader = if lengthA > 0 && lengthB > 0 - then offsetHeader - else mempty - offsetHeader = "@@ -" ++ offsetA ++ "," ++ show lengthA ++ " +" ++ offsetB ++ "," ++ show lengthB ++ " @@" ++ "\n" - (lengthA, lengthB) = runBoth . fmap getSum $ hunkLength hunk - (offsetA, offsetB) = runBoth . fmap (show . getSum) $ offset hunk - (pathA, pathB) = runBoth $ path <$> blobs - (oidA, oidB) = runBoth $ oid <$> blobs - (modeA, modeB) = runBoth $ blobKind <$> blobs + maybeFilepaths = if (nullOid == oidA && null (snd sources)) || (nullOid == oidB && null (fst sources)) then [] else [ beforeFilepath, afterFilepath ] + beforeFilepath = "--- " <> modeHeader "a" modeA pathA + afterFilepath = "+++ " <> modeHeader "b" modeB pathB + sources = source <$> blobs + (pathA, pathB) = case runJoin $ path <$> blobs of + ("", path) -> (path, path) + (path, "") -> (path, path) + paths -> paths + (oidA, oidB) = runJoin $ oid <$> blobs + (modeA, modeB) = runJoin $ blobKind <$> blobs + +-- | A hunk representing no changes. +emptyHunk :: Hunk (SplitDiff a annotation) +emptyHunk = Hunk { offset = mempty, changes = [], trailingContext = [] } -- | Render a diff as a series of hunks. -hunks :: Renderer a [Hunk (SplitDiff a Info)] +hunks :: HasField fields Range => SyntaxDiff leaf fields -> Both SourceBlob -> [Hunk (SplitSyntaxDiff leaf fields)] hunks _ blobs | sources <- source <$> blobs , sourcesEqual <- runBothWith (==) sources , sourcesNull <- runBothWith (&&) (null <$> sources) , sourcesEqual || sourcesNull - = [Hunk { offset = mempty, changes = [], trailingContext = [] }] -hunks diff blobs = hunksInRows (Both (1, 1)) $ fmap (fmap Prelude.fst) <$> splitDiffByLines (source <$> blobs) diff + = [emptyHunk] +hunks diff blobs = hunksInRows (pure 1) $ alignDiff (source <$> blobs) diff -- | Given beginning line numbers, turn rows in a split diff into hunks in a -- | patch. -hunksInRows :: Both (Sum Int) -> [Row (SplitDiff a Info)] -> [Hunk (SplitDiff a Info)] +hunksInRows :: (Foldable f, Functor f) => Both (Sum Int) -> [Join These (SplitDiff f annotation)] -> [Hunk (SplitDiff f annotation)] hunksInRows start rows = case nextHunk start rows of Nothing -> [] Just (hunk, rest) -> hunk : hunksInRows (offset hunk <> hunkLength hunk) rest -- | Given beginning line numbers, return the next hunk and the remaining rows -- | of the split diff. -nextHunk :: Both (Sum Int) -> [Row (SplitDiff a Info)] -> Maybe (Hunk (SplitDiff a Info), [Row (SplitDiff a Info)]) +nextHunk :: (Foldable f, Functor f) => Both (Sum Int) -> [Join These (SplitDiff f annotation)] -> Maybe (Hunk (SplitDiff f annotation), [Join These (SplitDiff f annotation)]) nextHunk start rows = case nextChange start rows of Nothing -> Nothing Just (offset, change, rest) -> let (changes, rest') = contiguousChanges rest in Just (Hunk offset (change : changes) $ take 3 rest', drop 3 rest') @@ -136,7 +145,7 @@ nextHunk start rows = case nextChange start rows of -- | Given beginning line numbers, return the number of lines to the next -- | the next change, and the remaining rows of the split diff. -nextChange :: Both (Sum Int) -> [Row (SplitDiff a Info)] -> Maybe (Both (Sum Int), Change (SplitDiff a Info), [Row (SplitDiff a Info)]) +nextChange :: (Foldable f, Functor f) => Both (Sum Int) -> [Join These (SplitDiff f annotation)] -> Maybe (Both (Sum Int), Change (SplitDiff f annotation), [Join These (SplitDiff f annotation)]) nextChange start rows = case changeIncludingContext leadingContext afterLeadingContext of Nothing -> Nothing Just (change, afterChanges) -> Just (start <> mconcat (rowIncrement <$> skippedContext), change, afterChanges) @@ -146,20 +155,12 @@ nextChange start rows = case changeIncludingContext leadingContext afterLeadingC -- | Return a Change with the given context and the rows from the begginning of -- | the given rows that have changes, or Nothing if the first row has no -- | changes. -changeIncludingContext :: [Row (SplitDiff a Info)] -> [Row (SplitDiff a Info)] -> Maybe (Change (SplitDiff a Info), [Row (SplitDiff a Info)]) +changeIncludingContext :: (Foldable f, Functor f) => [Join These (SplitDiff f annotation)] -> [Join These (SplitDiff f annotation)] -> Maybe (Change (SplitDiff f annotation), [Join These (SplitDiff f annotation)]) changeIncludingContext leadingContext rows = case changes of [] -> Nothing _ -> Just (Change leadingContext changes, afterChanges) where (changes, afterChanges) = span rowHasChanges rows -- | Whether a row has changes on either side. -rowHasChanges :: Row (SplitDiff a Info) -> Bool -rowHasChanges lines = or (lineHasChanges <$> lines) - --- | Whether a line has changes. -lineHasChanges :: Line (SplitDiff a Info) -> Bool -lineHasChanges = or . fmap diffHasChanges - --- | Whether a split diff has changes. -diffHasChanges :: SplitDiff a Info -> Bool -diffHasChanges = or . fmap (const True) +rowHasChanges :: (Foldable f, Functor f) => Join These (SplitDiff f annotation) -> Bool +rowHasChanges row = or (hasChanges <$> row) diff --git a/src/Renderer/SExpression.hs b/src/Renderer/SExpression.hs new file mode 100644 index 000000000..1eaf66ed7 --- /dev/null +++ b/src/Renderer/SExpression.hs @@ -0,0 +1,50 @@ +{-# LANGUAGE RankNTypes, ScopedTypeVariables #-} +module Renderer.SExpression (sExpression, printTerm) where + +import Data.Bifunctor.Join +import Data.Foldable +import Data.Record +import Data.Text hiding (foldr, replicate) +import Prologue hiding (toList, intercalate) + +import Category as C +import Diff +import Renderer +import Patch +import Info +import Syntax +import Term + +sExpression :: (HasField fields Category, HasField fields SourceSpan) => Renderer (Record fields) +sExpression _ diff = SExpressionOutput $ printDiff diff 0 + +printDiff :: (HasField fields Category, HasField fields SourceSpan) => Diff (Syntax Text) (Record fields) -> Int -> Text +printDiff diff level = case runFree diff of + (Pure patch) -> case patch of + Insert term -> pad (level - 1) <> "{+" <> printTerm term level <> "+}" + Delete term -> pad (level - 1) <> "{-" <> printTerm term level <> "-}" + Replace a b -> pad (level - 1) <> "{" <> printTerm a level <> "->" <> printTerm b level <> "}" + (Free (Join (_, annotation) :< syntax)) -> pad level <> "(" <> showAnnotation annotation <> foldr (\d acc -> printDiff d (level + 1) <> acc) "" syntax <> ")" + where + pad n | n < 1 = "" + | otherwise = "\n" <> mconcat (replicate n " ") + +printTerm :: (HasField fields Category, HasField fields SourceSpan) => Term (Syntax t) (Record fields) -> Int -> Text +printTerm term level = go term level 0 + where + pad p n | n < 1 = "" + | otherwise = "\n" <> mconcat (replicate (p + n) " ") + go term parentLevel level = case runCofree term of + (annotation :< Leaf _) -> pad parentLevel level <> "(" <> showAnnotation annotation <> ")" + (annotation :< syntax) -> pad parentLevel level <> "(" <> showAnnotation annotation <> foldr (\t acc -> go t parentLevel (level + 1) <> acc) "" syntax <> ")" + +showAnnotation :: (HasField fields Category, HasField fields SourceSpan) => Record fields -> Text +showAnnotation annotation = categoryName annotation <> " " <> showSourceSpan annotation + where + showSourceSpan a = start a <> " - " <> end a + start = showPoint . spanStart . getField + end = showPoint . spanEnd . getField + showPoint SourcePos{..} = "[" <> show line <> ", " <> show column <> "]" + +categoryName :: HasField fields Category => Record fields -> Text +categoryName = toS . category diff --git a/src/Renderer/Split.hs b/src/Renderer/Split.hs index c899de5ec..a48d3cbd3 100644 --- a/src/Renderer/Split.hs +++ b/src/Renderer/Split.hs @@ -1,21 +1,20 @@ -{-# LANGUAGE FlexibleInstances #-} -module Renderer.Split where +{-# OPTIONS_GHC -Wno-deprecations #-} +-- Disabling deprecation warnings due to pattern match against RescueModifier. +module Renderer.Split (split) where import Alignment -import Category -import Control.Comonad.Cofree -import Control.Monad.Free +import Category as C +import Data.Bifunctor.Join import Data.Foldable import Data.Functor.Both -import Data.Monoid +import Data.Record import qualified Data.Text.Lazy as TL -import Diff -import Line -import Prelude hiding (div, head, span, fst, snd) -import qualified Prelude -import Range +import Data.These +import Info +import Prologue hiding (div, head, fst, snd, link, (<>)) +import qualified Prologue import Renderer -import Source hiding ((++)) +import Source import SplitDiff import Syntax import Term @@ -27,44 +26,151 @@ import qualified Text.Blaze.Internal as Blaze -- | Add the first category from a Foldable of categories as a class name as a -- | class name on the markup, prefixed by `category-`. -classifyMarkup :: Foldable f => f Category -> Markup -> Markup -classifyMarkup categories element = maybe element ((element !) . A.class_ . stringValue . styleName) $ maybeFirst categories +classifyMarkup :: Category -> Markup -> Markup +classifyMarkup category element = (element !) . A.class_ . textValue $ styleName category -- | Return the appropriate style name for the given category. -styleName :: Category -> String -styleName category = "category-" ++ case category of - BinaryOperator -> "binary-operator" +styleName :: Category -> Text +styleName category = "category-" <> case category of + Program -> "program" + C.ParseError -> "error" + BooleanOperator -> "boolean_operator" + MathOperator -> "math_operator" + BitwiseOperator -> "bitwise_operator" + RelationalOperator -> "relational_operator" + Boolean -> "boolean" DictionaryLiteral -> "dictionary" - Pair -> "pair" - FunctionCall -> "function_call" + C.Pair -> "pair" StringLiteral -> "string" SymbolLiteral -> "symbol" IntegerLiteral -> "integer" + NumberLiteral -> "number" + FloatLiteral -> "float" + C.Comment -> "comment" + C.FunctionCall -> "function_call" + C.Function -> "function" + C.MethodCall -> "method_call" + C.Args -> "arguments" + C.Assignment -> "assignment" + C.MemberAccess -> "member_access" + C.VarDecl -> "var_declaration" + C.VarAssignment -> "var_assignment" + C.Switch -> "switch" + C.Case -> "case" + TemplateString -> "template_string" + Regex -> "regex" + Identifier -> "identifier" + C.Params -> "parameters" + ExpressionStatements -> "expression_statements" + C.MathAssignment -> "math_assignment" + C.SubscriptAccess -> "subscript_access" + C.Ternary -> "ternary" + C.Operator -> "operator" + C.Object -> "object" + C.For -> "for" + C.While -> "while" + C.DoWhile -> "do_while" + C.Return -> "return_statement" + C.Throw -> "throw_statement" + C.Constructor -> "constructor" + C.Try -> "try_statement" + C.Catch -> "catch_statement" + C.Finally -> "finally_statement" ArrayLiteral -> "array" + C.Class -> "class_statement" + C.Method -> "method" + C.If -> "if_statement" + C.Empty -> "empty_statement" + C.CommaOperator -> "comma_operator" Other string -> string + C.Module -> "module_statement" + C.Import -> "import_statement" + C.Export -> "export_statement" + C.AnonymousFunction -> "anonymous_function" + C.Interpolation -> "interpolation" + C.Subshell -> "subshell" + C.OperatorAssignment -> "operator_assignment" + C.Yield -> "yield_statement" + C.Until -> "until" + C.Unless -> "unless_statement" + C.Begin -> "begin_statement" + C.Else -> "else_block" + C.Elsif -> "elsif_block" + C.Ensure -> "ensure_block" + C.Rescue -> "rescue_block" + C.RescueModifier -> "rescue_modifier" + C.When -> "when_block" + C.RescuedException -> "last_exception" + C.RescueArgs -> "rescue_args" + C.Negate -> "negate" + C.Select -> "select_statement" + C.Go -> "go_statement" + C.Defer -> "defer_statement" + C.Slice -> "slice_expression" + C.TypeAssertion -> "type_assertion" + C.TypeConversion -> "type_conversion" + C.ArgumentPair -> "argument_pair" + C.KeywordParameter -> "keyword_param" + C.OptionalParameter -> "optional_param" + C.SplatParameter -> "splat_param" + C.HashSplatParameter -> "hash_splat_param" + C.BlockParameter -> "block_param" + C.ArrayTy -> "array_type" + C.DictionaryTy -> "dictionary_type" + C.StructTy -> "struct_type" + C.Struct -> "struct" + C.Break -> "break_statement" + C.Continue -> "continue_statement" + C.Binary -> "binary" + C.Unary -> "unary" + C.Constant -> "constant" + C.Superclass -> "superclass" + C.SingletonClass -> "singleton_class" + C.RangeExpression -> "range" + C.ScopeOperator -> "scope_operator" + C.BeginBlock -> "begin_block" + C.EndBlock -> "end_block" + C.ParameterDecl -> "parameter_declaration" + C.DefaultCase -> "default_statement" + C.TypeDecl -> "type_declaration" + C.PointerTy -> "pointer_type" + C.FieldDecl -> "field_declaration" + C.SliceTy -> "slice_type" + C.Element -> "element" + C.Literal -> "literal" + C.ChannelTy -> "channel_type" + C.FunctionTy -> "function_type" + C.Send -> "send_statement" + C.IncrementStatement -> "increment_statement" + C.DecrementStatement -> "decrement_statement" + C.QualifiedIdentifier -> "qualified_identifier" + C.IndexExpression -> "index_expression" + C.FieldDeclarations -> "field_declarations" + C.RuneLiteral -> "rune_literal" + C.Modifier c -> styleName c <> "_modifier" -- | Pick the class name for a split patch. splitPatchToClassName :: SplitPatch a -> AttributeValue -splitPatchToClassName patch = stringValue $ "patch " ++ case patch of +splitPatchToClassName patch = stringValue $ "patch " <> case patch of SplitInsert _ -> "insert" SplitDelete _ -> "delete" SplitReplace _ -> "replace" -- | Render a diff as an HTML split diff. -split :: Renderer leaf TL.Text -split diff blobs = renderHtml +split :: (HasField fields Category, HasField fields Cost, HasField fields Range) => Renderer (Record fields) +split blobs diff = SplitOutput . TL.toStrict . renderHtml . docTypeHtml . ((head $ link ! A.rel "stylesheet" ! A.href "style.css") <>) . body - . (table ! A.class_ (stringValue "diff")) $ + . (table ! A.class_ (stringValue "diff")) . ((colgroup $ (col ! A.width (stringValue . show $ columnWidth)) <> col <> (col ! A.width (stringValue . show $ columnWidth)) <> col) <>) . mconcat $ numberedLinesToMarkup <$> numbered where sources = Source.source <$> blobs - numbered = numberedRows (fmap (fmap Prelude.fst) <$> splitDiffByLines sources diff) + numbered = numberedRows (alignDiff sources diff) maxNumber = case numbered of [] -> 0 - (row : _) -> runBothWith max $ Prelude.fst <$> row + (row : _) -> mergeThese max . runJoin $ Prologue.fst <$> row -- | The number of digits in a number (e.g. 342 has 3 digits). digits :: Int -> Int @@ -74,49 +180,58 @@ split diff blobs = renderHtml columnWidth = max (20 + digits maxNumber * 8) 40 -- | Render a line with numbers as an HTML row. - numberedLinesToMarkup :: Both (Int, Line (SplitDiff a Info)) -> Markup - numberedLinesToMarkup numberedLines = tr $ runBothWith (<>) (renderLine <$> numberedLines <*> sources) <> string "\n" + numberedLinesToMarkup numberedLines = tr $ runBothWith (<>) (renderLine <$> Join (fromThese Nothing Nothing (runJoin (Just <$> numberedLines))) <*> sources) <> string "\n" - renderLine :: (Int, Line (SplitDiff leaf Info)) -> Source Char -> Markup - renderLine (number, line) source = toMarkup $ Renderable (hasChanges line, number, Renderable . (,) source <$> line) + renderLine (Just (number, line)) source = toMarkup $ Cell (hasChanges line) number (Renderable source line) + renderLine _ _ + = (td mempty ! A.class_ (stringValue "blob-num blob-num-empty empty-cell")) + <> (td mempty ! A.class_ (stringValue "blob-code blob-code-empty empty-cell")) + <> string "\n" --- | Something that can be rendered as markup. -newtype Renderable a = Renderable a +-- | A cell in a table, characterized by whether it contains changes & its line number. +data Cell a = Cell !Bool !Int !a -instance ToMarkup f => ToMarkup (Renderable (Source Char, Info, Syntax a (f, Range))) where - toMarkup (Renderable (source, Info range categories, syntax)) = classifyMarkup categories $ case syntax of - Leaf _ -> span . string . toString $ slice range source - Indexed children -> ul . mconcat $ wrapIn li <$> contentElements children - Fixed children -> ul . mconcat $ wrapIn li <$> contentElements children - Keyed children -> dl . mconcat $ wrapIn dd <$> contentElements children - where markupForSeparatorAndChild :: ToMarkup f => ([Markup], Int) -> (f, Range) -> ([Markup], Int) - markupForSeparatorAndChild (rows, previous) (child, range) = (rows ++ [ string (toString $ slice (Range previous $ start range) source), toMarkup child ], end range) +-- | Something that can be rendered as markup with reference to some source. +data Renderable a = Renderable !(Source Char) !a - wrapIn _ l@Blaze.Leaf{} = l - wrapIn _ l@Blaze.CustomLeaf{} = l - wrapIn _ l@Blaze.Content{} = l - wrapIn _ l@Blaze.Comment{} = l - wrapIn f p = f p +contentElements :: (Foldable t, ToMarkup f) => Source Char -> Range -> t (f, Range) -> [Markup] +contentElements source range children = let (elements, next) = foldr' (markupForContextAndChild source) ([], end range) children in + text (toText (slice (Range (start range) (max next (start range))) source)) : elements - contentElements children = let (elements, previous) = foldl' markupForSeparatorAndChild ([], start range) children in - elements ++ [ string . toString $ slice (Range previous $ end range) source ] +markupForContextAndChild :: ToMarkup f => Source Char -> (f, Range) -> ([Markup], Int) -> ([Markup], Int) +markupForContextAndChild source (child, range) (rows, next) = (toMarkup child : text (toText (slice (Range (end range) next) source)) : rows, start range) -instance ToMarkup (Renderable (Source Char, Term a Info)) where - toMarkup (Renderable (source, term)) = Prelude.fst $ cata (\ info@(Info range _) syntax -> (toMarkup $ Renderable (source, info, syntax), range)) term - -instance ToMarkup (Renderable (Source Char, SplitDiff a Info)) where - toMarkup (Renderable (source, diff)) = Prelude.fst $ iter (\ (Annotated info@(Info range _) syntax) -> (toMarkup $ Renderable (source, info, syntax), range)) $ toMarkupAndRange <$> diff - where toMarkupAndRange :: SplitPatch (Term a Info) -> (Markup, Range) - toMarkupAndRange patch = let term@(Info range _ :< _) = getSplitTerm patch in - ((div ! A.class_ (splitPatchToClassName patch) ! A.data_ (stringValue . show $ termSize term)) . toMarkup $ Renderable (source, term), range) +wrapIn :: (Markup -> Markup) -> Markup -> Markup +wrapIn _ l@Blaze.Leaf{} = l +wrapIn _ l@Blaze.CustomLeaf{} = l +wrapIn _ l@Blaze.Content{} = l +wrapIn _ l@Blaze.Comment{} = l +wrapIn f p = f p -instance ToMarkup a => ToMarkup (Renderable (Bool, Int, Line a)) where - toMarkup (Renderable (_, _, line)) | isEmpty line = - td mempty ! A.class_ (stringValue "blob-num blob-num-empty empty-cell") - <> td mempty ! A.class_ (stringValue "blob-code blob-code-empty empty-cell") - <> string "\n" - toMarkup (Renderable (hasChanges, num, line)) = - td (string $ show num) ! A.class_ (stringValue $ if hasChanges then "blob-num blob-num-replacement" else "blob-num") - <> td (mconcat $ toMarkup <$> unLine line) ! A.class_ (stringValue $ if hasChanges then "blob-code blob-code-replacement" else "blob-code") +-- Instances + +instance (ToMarkup f, HasField fields Category, HasField fields Range) => ToMarkup (Renderable (SyntaxTermF leaf fields (f, Range))) where + toMarkup (Renderable source (info :< syntax)) = classifyMarkup (category info) $ case syntax of + Leaf _ -> span . string . toString $ slice (characterRange info) source + _ -> ul . mconcat $ wrapIn li <$> contentElements source (characterRange info) (toList syntax) + +instance (HasField fields Category, HasField fields Range) => ToMarkup (Renderable (SyntaxTerm leaf fields)) where + toMarkup (Renderable source term) = Prologue.fst $ cata (\ t -> (toMarkup $ Renderable source t, characterRange (headF t))) term + +instance (HasField fields Category, HasField fields Cost, HasField fields Range) => ToMarkup (Renderable (SplitSyntaxDiff leaf fields)) where + toMarkup (Renderable source diff) = Prologue.fst . iter (\ t -> (toMarkup $ Renderable source t, characterRange (headF t))) $ toMarkupAndRange <$> diff + where toMarkupAndRange patch = let term@(info :< _) = runCofree $ getSplitTerm patch in + ((div ! patchAttribute patch `withCostAttribute` cost info) . toMarkup $ Renderable source (cofree term), characterRange info) + patchAttribute patch = A.class_ (splitPatchToClassName patch) + withCostAttribute a (Cost c) | c > 0 = a ! A.data_ (stringValue (show c)) + | otherwise = identity + +instance ToMarkup a => ToMarkup (Cell a) where + toMarkup (Cell hasChanges num line) + = (td (string (show num)) ! A.class_ (stringValue $ if hasChanges then "blob-num blob-num-replacement" else "blob-num")) + <> (td (toMarkup line) ! A.class_ (stringValue $ if hasChanges then "blob-code blob-code-replacement" else "blob-code")) <> string "\n" + +(<>) :: Monoid m => m -> m -> m +(<>) = mappend diff --git a/src/Renderer/Summary.hs b/src/Renderer/Summary.hs new file mode 100644 index 000000000..9cbd8b3ac --- /dev/null +++ b/src/Renderer/Summary.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE TupleSections, ScopedTypeVariables #-} +module Renderer.Summary where + +import Prologue +import Renderer +import Data.Record +import DiffSummary +import Data.Map as Map hiding (null) +import Source +import Data.Aeson +import Data.List as List + +summary :: (DefaultFields fields) => Renderer (Record fields) +summary blobs diff = SummaryOutput $ Map.fromList [ + ("changes", changes), + ("errors", errors) + ] + where + changes = if null changes' then mempty else Map.singleton summaryKey (toJSON <$> changes') + errors = if null errors' then mempty else Map.singleton summaryKey (toJSON <$> errors') + (errors', changes') = List.partition isErrorSummary summaries + summaryKey = toSummaryKey (path <$> blobs) + summaries = diffSummaries blobs diff diff --git a/src/Renderer/TOC.hs b/src/Renderer/TOC.hs new file mode 100644 index 000000000..f5bb7ba58 --- /dev/null +++ b/src/Renderer/TOC.hs @@ -0,0 +1,162 @@ +{-# LANGUAGE ScopedTypeVariables #-} +module Renderer.TOC (toc) where + +import Category as C +import Data.Aeson +import Data.Functor.Both hiding (fst, snd) +import qualified Data.Functor.Both as Both +import Data.Record +import Diff +import Info +import Prologue +import qualified Data.List as List +import qualified Data.Map as Map hiding (null) +import Renderer +import Source +import Syntax as S +import Term +import Patch +import Unsafe (unsafeHead) + +data JSONSummary = JSONSummary { info :: Summarizable } + | ErrorSummary { error :: Text, errorSpan :: SourceSpan } + deriving (Generic, Eq, Show) + +instance ToJSON JSONSummary where + toJSON JSONSummary{..} = object $ case info of + InSummarizable{..} -> [ "changeType" .= ("modified" :: Text), "category" .= (show parentCategory :: Text), "term" .= parentTermName, "span" .= parentSourceSpan ] + Summarizable{..} -> [ "changeType" .= summarizableChangeType, "category" .= (show summarizableCategory :: Text), "term" .= summarizableTermName, "span" .= summarizableSourceSpan ] + NotSummarizable -> panic "NotSummarizable should have been pruned" + toJSON ErrorSummary{..} = object [ "error" .= error, "span" .= errorSpan ] + +isErrorSummary :: JSONSummary -> Bool +isErrorSummary ErrorSummary{} = True +isErrorSummary _ = False + +data DiffInfo = LeafInfo { leafCategory :: Category, termName :: Text, leafSourceSpan :: SourceSpan } + | BranchInfo { branches :: [ DiffInfo ], branchCategory :: Category } + | ErrorInfo { infoSpan :: SourceSpan, termName :: Text } + deriving (Eq, Show) + +data TOCSummary a = TOCSummary { + summaryPatch :: Patch a, + parentInfo :: Summarizable + } deriving (Eq, Functor, Show, Generic) + +data Summarizable = Summarizable { summarizableCategory :: Category, summarizableTermName :: Text, summarizableSourceSpan :: SourceSpan, summarizableChangeType :: Text } + | InSummarizable { parentCategory :: Category, parentTermName :: Text, parentSourceSpan :: SourceSpan } + | NotSummarizable + deriving (Eq, Show) + +data SummarizableTerm a = SummarizableTerm a | NotSummarizableTerm a + +toc :: (DefaultFields fields) => Renderer (Record fields) +toc blobs diff = TOCOutput $ Map.fromList [ + ("changes", changes), + ("errors", errors) + ] + where + changes = if null changes' then mempty else Map.singleton summaryKey (toJSON <$> changes') + errors = if null errors' then mempty else Map.singleton summaryKey (toJSON <$> errors') + (errors', changes') = List.partition isErrorSummary summaries + summaryKey = toSummaryKey (path <$> blobs) + summaries = diffTOC blobs diff + +diffTOC :: (StringConv leaf Text, DefaultFields fields) => Both SourceBlob -> SyntaxDiff leaf fields -> [JSONSummary] +diffTOC blobs diff = do + noDupes <- removeDupes (diffToTOCSummaries (source <$> blobs) diff) + toJSONSummaries noDupes + where + removeDupes :: [TOCSummary DiffInfo] -> [TOCSummary DiffInfo] + removeDupes [] = [] + removeDupes xs = (fmap unsafeHead . List.groupBy (\a b -> parentInfo a == parentInfo b)) xs + + diffToTOCSummaries :: (StringConv leaf Text, DefaultFields fields) => Both (Source Char) -> SyntaxDiff leaf fields -> [TOCSummary DiffInfo] + diffToTOCSummaries sources = para $ \diff -> + let + diff' = free (Prologue.fst <$> diff) + patch' = mapPatch (termToDiffInfo beforeSource) (termToDiffInfo afterSource) + (beforeSource, afterSource) = runJoin sources + in case diff of + (Free (_ :< syntax)) -> mapToInSummarizable sources diff' (toList syntax >>= snd) + (Pure patch) -> toTOCSummaries (patch' patch) + +-- Mark which leaves are summarizable. +toTOCSummaries :: Patch DiffInfo -> [TOCSummary DiffInfo] +toTOCSummaries patch = case afterOrBefore patch of + Just diffInfo -> toTOCSummaries' patch diffInfo + Nothing -> panic "No diff" + where + toTOCSummaries' patch' diffInfo = case diffInfo of + ErrorInfo{..} -> pure $ TOCSummary patch' NotSummarizable + BranchInfo{..} -> join $ zipWith toTOCSummaries' (flattenPatch patch') branches + LeafInfo{..} -> pure . TOCSummary patch' $ case leafCategory of + C.Function -> Summarizable leafCategory termName leafSourceSpan (patchType patch') + C.Method -> Summarizable leafCategory termName leafSourceSpan (patchType patch') + _ -> NotSummarizable + +flattenPatch :: Patch DiffInfo -> [Patch DiffInfo] +flattenPatch = \case + Replace i1 i2 -> zipWith Replace (toLeafInfos' i1) (toLeafInfos' i2) + Insert info -> Insert <$> toLeafInfos' info + Delete info -> Delete <$> toLeafInfos' info + +toLeafInfos' :: DiffInfo -> [DiffInfo] +toLeafInfos' BranchInfo{..} = branches >>= toLeafInfos' +toLeafInfos' leaf = [leaf] + +mapToInSummarizable :: DefaultFields fields => Both (Source Char) -> SyntaxDiff leaf fields -> [TOCSummary DiffInfo] -> [TOCSummary DiffInfo] +mapToInSummarizable sources diff children = case (beforeTerm diff, afterTerm diff) of + (_, Just diff') -> mapToInSummarizable' (Both.snd sources) diff' <$> children + (Just diff', _) -> mapToInSummarizable' (Both.fst sources) diff' <$> children + (Nothing, Nothing) -> [] + where + mapToInSummarizable' :: DefaultFields fields => Source Char -> SyntaxTerm leaf fields -> TOCSummary DiffInfo -> TOCSummary DiffInfo + mapToInSummarizable' source term summary = + case (parentInfo summary, summarizable term) of + (NotSummarizable, SummarizableTerm _) -> + summary { parentInfo = InSummarizable (category (extract term)) (toTermName source term) (Info.sourceSpan (extract term)) } + (_, _) -> summary + +summarizable :: ComonadCofree (Syntax t) w => w a -> SummarizableTerm (w a) +summarizable term = go (unwrap term) term + where go = \case + S.Method{} -> SummarizableTerm + S.Function{} -> SummarizableTerm + _ -> NotSummarizableTerm + +toJSONSummaries :: TOCSummary DiffInfo -> [JSONSummary] +toJSONSummaries TOCSummary{..} = case afterOrBefore summaryPatch of + Just diffInfo -> toJSONSummaries' diffInfo + Nothing -> panic "No diff" + where + toJSONSummaries' = \case + ErrorInfo{..} -> pure $ ErrorSummary termName infoSpan + BranchInfo{..} -> branches >>= toJSONSummaries' + LeafInfo{..} -> case parentInfo of + NotSummarizable -> [] + _ -> pure $ JSONSummary parentInfo + +termToDiffInfo :: (StringConv leaf Text, DefaultFields fields) => Source Char -> SyntaxTerm leaf fields -> DiffInfo +termToDiffInfo blob term = case unwrap term of + S.Indexed children -> BranchInfo (termToDiffInfo' <$> children) (category $ extract term) + S.Fixed children -> BranchInfo (termToDiffInfo' <$> children) (category $ extract term) + S.AnonymousFunction _ _ -> LeafInfo C.AnonymousFunction (toTermName' term) (getField $ extract term) + S.Commented cs leaf -> BranchInfo (termToDiffInfo' <$> cs <> maybeToList leaf) (category $ extract term) + S.ParseError _ -> ErrorInfo (getField $ extract term) (toTermName' term) + _ -> toLeafInfo term + where toTermName' = toTermName blob + termToDiffInfo' = termToDiffInfo blob + toLeafInfo term = LeafInfo (category $ extract term) (toTermName' term) (getField $ extract term) + +toTermName :: forall leaf fields. DefaultFields fields => Source Char -> SyntaxTerm leaf fields -> Text +toTermName source term = case unwrap term of + S.Function identifier _ _ _ -> toTermName' identifier + S.Method identifier Nothing _ _ _ -> toTermName' identifier + S.Method identifier (Just receiver) _ _ _ -> toTermName' receiver <> "." <> toTermName' identifier + _ -> termNameFromSource term + where + toTermName' = toTermName source + termNameFromSource term = termNameFromRange (range term) + termNameFromRange range = toText $ Source.slice range source + range = characterRange . extract diff --git a/src/SES.hs b/src/SES.hs index 1a5277fec..3c715009c 100644 --- a/src/SES.hs +++ b/src/SES.hs @@ -1,56 +1,51 @@ +{-# LANGUAGE Strict #-} module SES where -import Patch -import Diff -import Term -import Control.Monad.Free -import Control.Monad.State -import Data.Foldable (minimumBy) -import Data.List (uncons) import qualified Data.Map as Map -import Data.Ord (comparing) +import Patch +import Prologue --- | A function that maybe creates a diff from two terms. -type Compare a annotation = Term a annotation -> Term a annotation -> Maybe (Diff a annotation) --- | A function that computes the cost of a diff. -type Cost a annotation = Diff a annotation -> Integer +-- | Edit constructor for two terms, if comparable. Otherwise returns Nothing. +type Compare term edit = term -> term -> Maybe edit + +-- | A function that computes the cost of an edit. +type Cost edit = edit -> Int -- | Find the shortest edit script (diff) between two terms given a function to compute the cost. -ses :: Compare a annotation -> Cost a annotation -> [Term a annotation] -> [Term a annotation] -> [Diff a annotation] +ses :: Applicative edit => Compare term (edit (Patch term)) -> Cost (edit (Patch term)) -> [term] -> [term] -> [edit (Patch term)] ses diffTerms cost as bs = fst <$> evalState diffState Map.empty where diffState = diffAt diffTerms cost (0, 0) as bs -- | Find the shortest edit script between two terms at a given vertex in the edit graph. -diffAt :: Compare a annotation -> Cost a annotation -> (Integer, Integer) -> [Term a annotation] -> [Term a annotation] -> State (Map.Map (Integer, Integer) [(Diff a annotation, Integer)]) [(Diff a annotation, Integer)] -diffAt _ _ _ [] [] = return [] -diffAt _ cost _ [] bs = return $ foldr toInsertions [] bs where - toInsertions each = consWithCost cost (Pure . Insert $ each) -diffAt _ cost _ as [] = return $ foldr toDeletions [] as where - toDeletions each = consWithCost cost (Pure . Delete $ each) -diffAt diffTerms cost (i, j) (a : as) (b : bs) = do +diffAt :: Applicative edit => Compare term (edit (Patch term)) -> Cost (edit (Patch term)) -> (Int, Int) -> [term] -> [term] -> State (Map.Map (Int, Int) [(edit (Patch term), Int)]) [(edit (Patch term), Int)] +diffAt diffTerms cost (i, j) as bs + | (a : as) <- as, (b : bs) <- bs = do cachedDiffs <- get case Map.lookup (i, j) cachedDiffs of - Just diffs -> return diffs + Just diffs -> pure diffs Nothing -> do down <- recur (i, succ j) as (b : bs) right <- recur (succ i, j) (a : as) bs - nomination <- fmap best $ case diffTerms a b of + nomination <- best <$> case diffTerms a b of Just diff -> do diagonal <- recur (succ i, succ j) as bs - return [ delete down, insert right, consWithCost cost diff diagonal ] - Nothing -> return [ delete down, insert right ] + pure [ delete a down, insert b right, consWithCost cost diff diagonal ] + Nothing -> pure [ delete a down, insert b right ] cachedDiffs' <- get put $ Map.insert (i, j) nomination cachedDiffs' - return nomination + pure nomination + | null as = pure $ foldr insert [] bs + | null bs = pure $ foldr delete [] as + | otherwise = pure [] where - delete = consWithCost cost (Pure . Delete $ a) - insert = consWithCost cost (Pure . Insert $ b) + delete = consWithCost cost . deleting + insert = consWithCost cost . inserting costOf [] = 0 costOf ((_, c) : _) = c best = minimumBy (comparing costOf) recur = diffAt diffTerms cost --- | Prepend a diff to the list with the cumulative cost. -consWithCost :: Cost a annotation -> Diff a annotation -> [(Diff a annotation, Integer)] -> [(Diff a annotation, Integer)] -consWithCost cost diff rest = (diff, cost diff + maybe 0 snd (fst <$> uncons rest)) : rest +-- | Prepend an edit script and the cumulative cost onto the edit script. +consWithCost :: Cost edit -> edit -> [(edit, Int)] -> [(edit, Int)] +consWithCost cost edit rest = (edit, cost edit + maybe 0 snd (fst <$> uncons rest)) : rest diff --git a/src/SemanticDiff.hs b/src/SemanticDiff.hs new file mode 100644 index 000000000..b4813c268 --- /dev/null +++ b/src/SemanticDiff.hs @@ -0,0 +1,173 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# OPTIONS_GHC -fno-warn-warnings-deprecations -fno-warn-incomplete-patterns #-} +module SemanticDiff (main, fetchDiff, fetchDiffs) where + +import Arguments +import Prologue hiding ((<>), fst, snd) +import Data.String +import Data.Functor.Both +import Data.Version (showVersion) +import Text.Regex +import Diffing +import Git.Libgit2 +import Git.Repository +import Git.Blob +import Git.Types +import Git.Libgit2.Backend +import Options.Applicative hiding (action) +import System.Timeout as Timeout +import Data.List ((\\)) +import qualified Diffing as D +import qualified Git +import qualified Paths_semantic_diff as Library (version) +import qualified Renderer as R +import qualified Source +import qualified Control.Concurrent.Async.Pool as Async +import GHC.Conc (numCapabilities) +import Development.GitRev +import Parse + +main :: IO () +main = do + args@Arguments{..} <- programArguments =<< execParser argumentsParser + case runMode of + Diff -> runDiff args + Parse -> Parse.run args + +runDiff :: Arguments -> IO () +runDiff args@Arguments{..} = case diffMode of + PathDiff paths -> diffPaths args paths + CommitDiff -> diffCommits args + +-- | A parser for the application's command-line arguments. +argumentsParser :: ParserInfo CmdLineOptions +argumentsParser = info (version <*> helper <*> argumentsP) + (fullDesc <> progDesc "Set the GIT_DIR environment variable to specify the git repository. Set GIT_ALTERNATE_OBJECT_DIRECTORIES to specify location of alternates." + <> header "semantic-diff - Show semantic changes between commits") + where + argumentsP :: Parser CmdLineOptions + argumentsP = CmdLineOptions + <$> (flag R.Split R.Patch (long "patch" <> help "output a patch(1)-compatible diff") + <|> flag R.Split R.JSON (long "json" <> help "output a json diff") + <|> flag' R.Split (long "split" <> help "output a split diff") + <|> flag' R.Summary (long "summary" <> help "output a diff summary") + <|> flag' R.SExpression (long "sexpression" <> help "output an s-expression diff tree") + <|> flag' R.TOC (long "toc" <> help "output a table of contents diff summary")) + <*> optional (option auto (long "timeout" <> help "timeout for per-file diffs in seconds, defaults to 7 seconds")) + <*> optional (strOption (long "output" <> short 'o' <> help "output directory for split diffs, defaults to stdout if unspecified")) + <*> switch (long "no-index" <> help "compare two paths on the filesystem") + <*> some (argument (eitherReader parseShasAndFiles) (metavar "SHA_A..SHAB FILES...")) + <*> switch (long "development" <> short 'd' <> help "set development mode which prevents timeout behavior by default") + <*> flag Diff Parse (long "parse" <> short 'p' <> help "parses a source file without diffing") + where + parseShasAndFiles :: String -> Either String ExtraArg + parseShasAndFiles s = case matchRegex regex s of + Just ["", sha2] -> Right . ShaPair $ both Nothing (Just sha2) + Just [sha1, sha2] -> Right . ShaPair $ Just <$> both sha1 sha2 + _ -> Right $ FileArg s + where regex = mkRegexWithOpts "([0-9a-f]{40})\\.\\.([0-9a-f]{40})" True False + +versionString :: String +versionString = "semantic-diff version " <> showVersion Library.version <> " (" <> $(gitHash) <> ")" + +version :: Parser (a -> a) +version = infoOption versionString (long "version" <> short 'V' <> help "output the version of the program") + +-- | Compare changes between two commits. +diffCommits :: Arguments -> IO () +diffCommits args@Arguments{..} = do + ts <- fetchTerms args + writeToOutput output (maybe mempty R.concatOutputs ts) + where fetchTerms args = if developmentMode + then Just <$> fetchDiffs args + else Timeout.timeout timeoutInMicroseconds (fetchDiffs args) + + +-- | Compare two paths on the filesystem (compariable to git diff --no-index). +diffPaths :: Arguments -> Both FilePath -> IO () +diffPaths args@Arguments{..} paths = do + sources <- sequence $ readAndTranscodeFile <$> paths + let sourceBlobs = Source.SourceBlob <$> sources <*> pure mempty <*> paths <*> pure (Just Source.defaultPlainBlob) + D.printDiff (parserWithCost (fst paths)) (diffArgs args) sourceBlobs + where + diffArgs Arguments{..} = R.DiffArguments { format = format, output = output } + +fetchDiffs :: Arguments -> IO [R.Output] +fetchDiffs args@Arguments{..} = do + paths <- case(filePaths, shaRange) of + ([], Join (Just a, Just b)) -> pathsToDiff args (both a b) + (ps, _) -> pure ps + + Async.withTaskGroup numCapabilities $ \p -> + Async.mapTasks p (fetchDiff args <$> paths) + +fetchDiff :: Arguments -> FilePath -> IO R.Output +fetchDiff args@Arguments{..} filepath = withRepository lgFactory gitDir $ do + repo <- getRepository + for_ alternateObjectDirs (liftIO . odbBackendAddPath repo . toS) + lift $ runReaderT (fetchDiff' args filepath) repo + +fetchDiff' :: Arguments -> FilePath -> ReaderT LgRepo IO R.Output +fetchDiff' Arguments{..} filepath = do + sourcesAndOids <- sequence $ traverse (getSourceBlob filepath) <$> shaRange + + let sources = fromMaybe (Source.emptySourceBlob filepath) <$> sourcesAndOids + let sourceBlobs = Source.idOrEmptySourceBlob <$> sources + let textDiff = D.textDiff (parserWithCost filepath) diffArguments sourceBlobs + + text <- fetchText textDiff + truncatedPatch <- liftIO $ D.truncatedDiff diffArguments sourceBlobs + pure $ fromMaybe truncatedPatch text + where + diffArguments = R.DiffArguments { format = format, output = output } + fetchText textDiff = if developmentMode + then liftIO $ Just <$> textDiff + else liftIO $ Timeout.timeout timeoutInMicroseconds textDiff + + +pathsToDiff :: Arguments -> Both String -> IO [FilePath] +pathsToDiff Arguments{..} shas = withRepository lgFactory gitDir $ do + repo <- getRepository + for_ alternateObjectDirs (liftIO . odbBackendAddPath repo . toS) + lift $ runReaderT (pathsToDiff' shas) repo + +-- | Returns a list of relative file paths that have changed between the given commit shas. +pathsToDiff' :: Both String -> ReaderT LgRepo IO [FilePath] +pathsToDiff' shas = do + entries <- blobEntriesToDiff shas + pure $ (\(p, _, _) -> toS p) <$> entries + +-- | Returns a list of blob entries that have changed between the given commits shas. +blobEntriesToDiff :: Both String -> ReaderT LgRepo IO [(TreeFilePath, Git.BlobOid LgRepo, BlobKind)] +blobEntriesToDiff shas = do + a <- blobEntries (fst shas) + b <- blobEntries (snd shas) + pure $ (a \\ b) <> (b \\ a) + where blobEntries sha = treeForCommitSha sha >>= treeBlobEntries + +-- | Returns a Git.Tree for a commit sha +treeForCommitSha :: String -> ReaderT LgRepo IO (Git.Tree LgRepo) +treeForCommitSha sha = do + object <- parseObjOid (toS sha) + commit <- lookupCommit object + lookupTree (commitTree commit) + +-- | Returns a SourceBlob given a relative file path, and the sha to look up. +getSourceBlob :: FilePath -> String -> ReaderT LgRepo IO Source.SourceBlob +getSourceBlob path sha = do + tree <- treeForCommitSha sha + entry <- treeEntry tree (toS path) + (bytestring, oid, mode) <- case entry of + Nothing -> pure (mempty, mempty, Nothing) + Just (BlobEntry entryOid entryKind) -> do + blob <- lookupBlob entryOid + let (BlobString s) = blobContents blob + let oid = renderObjOid $ blobOid blob + pure (s, oid, Just entryKind) + s <- liftIO $ transcode bytestring + pure $ Source.SourceBlob s (toS oid) path (toSourceKind <$> mode) + where + toSourceKind :: Git.BlobKind -> Source.SourceKind + toSourceKind (Git.PlainBlob mode) = Source.PlainBlob mode + toSourceKind (Git.ExecutableBlob mode) = Source.ExecutableBlob mode + toSourceKind (Git.SymlinkBlob mode) = Source.SymlinkBlob mode diff --git a/src/Source.hs b/src/Source.hs index 2baa954ae..30d6aafe9 100644 --- a/src/Source.hs +++ b/src/Source.hs @@ -1,13 +1,24 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# OPTIONS_GHC -funbox-strict-fields #-} module Source where -import Data.Foldable -import qualified Data.Text as T +import Prologue hiding (uncons) +import Data.Text (unpack, pack) +import Data.String import qualified Data.Vector as Vector -import Data.Word import Numeric import Range +import SourceSpan +-- | The source, oid, path, and Maybe SourceKind of a blob in a Git repo. +data SourceBlob = SourceBlob { source :: Source Char, oid :: String, path :: FilePath, blobKind :: Maybe SourceKind } + deriving (Show, Eq) + +-- | The contents of a source file, backed by a vector for efficient slicing. +newtype Source a = Source { getVector :: Vector.Vector a } + deriving (Eq, Show, Foldable, Functor, Traversable) + +-- | The kind of a blob, along with it's file mode. data SourceKind = PlainBlob Word32 | ExecutableBlob Word32 | SymlinkBlob Word32 deriving (Show, Eq) @@ -16,24 +27,33 @@ modeToDigits (PlainBlob mode) = showOct mode "" modeToDigits (ExecutableBlob mode) = showOct mode "" modeToDigits (SymlinkBlob mode) = showOct mode "" -data SourceBlob = SourceBlob { source :: Source Char, oid :: String, path :: FilePath, blobKind :: Maybe SourceKind } - deriving (Show, Eq) -- | The default plain blob mode defaultPlainBlob :: SourceKind defaultPlainBlob = PlainBlob 0o100644 --- | The contents of a source file, backed by a vector for efficient slicing. -newtype Source a = Source { getVector :: Vector.Vector a } - deriving (Eq, Show, Foldable, Functor, Traversable) +emptySourceBlob :: FilePath -> SourceBlob +emptySourceBlob filepath = SourceBlob (Source.fromList "") Source.nullOid filepath Nothing + +sourceBlob :: Source Char -> FilePath -> SourceBlob +sourceBlob source filepath = SourceBlob source Source.nullOid filepath (Just defaultPlainBlob) + +-- | Map blobs with Nothing blobKind to empty blobs. +idOrEmptySourceBlob :: SourceBlob -> SourceBlob +idOrEmptySourceBlob blob = if isNothing (blobKind blob) + then blob { oid = nullOid, blobKind = Nothing } + else blob + +nullOid :: String +nullOid = "0000000000000000000000000000000000000000" -- | Return a Source from a list of items. fromList :: [a] -> Source a fromList = Source . Vector.fromList -- | Return a Source of Chars from a Text. -fromText :: T.Text -> Source Char -fromText = Source . Vector.fromList . T.unpack +fromText :: Text -> Source Char +fromText = Source . Vector.fromList . unpack -- | Return a Source that contains a slice of the given Source. slice :: Range -> Source a -> Source a @@ -43,6 +63,10 @@ slice range = Source . Vector.slice (start range) (rangeLength range) . getVecto toString :: Source Char -> String toString = toList +-- | Return a text with the contents of the Source. +toText :: Source Char -> Text +toText = pack . toList + -- | Return the item at the given index. at :: Source a -> Int -> a at = (Vector.!) . getVector @@ -55,19 +79,39 @@ uncons (Source vector) = if null vector then Nothing else Just (Vector.head vect break :: (a -> Bool) -> Source a -> (Source a, Source a) break predicate (Source vector) = let (start, remainder) = Vector.break predicate vector in (Source start, Source remainder) --- | Concatenate two sources. -(++) :: Source a -> Source a -> Source a -(++) (Source a) = Source . (a Vector.++) . getVector - -- | Split the contents of the source after newlines. actualLines :: Source Char -> [Source Char] actualLines source | null source = [ source ] actualLines source = case Source.break (== '\n') source of (l, lines') -> case uncons lines' of Nothing -> [ l ] - Just (_, lines') -> (l Source.++ fromList "\n") : actualLines lines' + Just (_, lines') -> (l <> fromList "\n") : actualLines lines' -- | Compute the line ranges within a given range of a string. actualLineRanges :: Range -> Source Char -> [Range] actualLineRanges range = drop 1 . scanl toRange (Range (start range) (start range)) . actualLines . slice range where toRange previous string = Range (end previous) $ end previous + length string + +-- | Compute the character range given a Source and a SourceSpan. +sourceSpanToRange :: Source Char -> SourceSpan -> Range +sourceSpanToRange source SourceSpan{..} = Range start end + where start = sumLengths leadingRanges + column spanStart + end = start + sumLengths (take (line spanEnd - line spanStart) remainingRanges) + (column spanEnd - column spanStart) + (leadingRanges, remainingRanges) = splitAt (line spanStart) (actualLineRanges (totalRange source) source) + sumLengths = sum . fmap (\ Range{..} -> end - start) + +rangeToSourceSpan :: Source Char -> Range -> SourceSpan +rangeToSourceSpan source range@Range{} = SourceSpan startPos endPos + where startPos = maybe (SourcePos 1 1) (toStartPos 1) (head lineRanges) + endPos = toEndPos (length lineRanges) (fromMaybe (rangeAt 0) (snd <$> unsnoc lineRanges)) + lineRanges = actualLineRanges range source + toStartPos line range = SourcePos line (start range) + toEndPos line range = SourcePos line (end range) + + +instance Semigroup (Source a) where + Source a <> Source b = Source (a Vector.++ b) + +instance Monoid (Source a) where + mempty = fromList [] + mappend = (<>) diff --git a/src/SourceSpan.hs b/src/SourceSpan.hs new file mode 100644 index 000000000..12dfe3594 --- /dev/null +++ b/src/SourceSpan.hs @@ -0,0 +1,100 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# OPTIONS_GHC -funbox-strict-fields #-} +-- | +-- Source position and span information +-- Mostly taken from purescript's SourcePos definition. +-- +module SourceSpan where + +import Data.Aeson ((.=), (.:)) +import qualified Data.Aeson as A +import Data.List.NonEmpty (nonEmpty) +import Data.Semigroup +import Data.These +import Prologue +import Test.LeanCheck + +-- | +-- Source position information +-- +data SourcePos = SourcePos + { -- | + -- Line number + -- + line :: Int + -- | + -- Column number + -- + , column :: Int + } deriving (Show, Read, Eq, Ord, Generic, Hashable) + +displaySourcePos :: SourcePos -> Text +displaySourcePos SourcePos{..} = + "line " <> show line <> ", column " <> show column + +instance A.ToJSON SourcePos where + toJSON SourcePos{..} = + A.toJSON [line, column] + +instance A.FromJSON SourcePos where + parseJSON arr = do + [line, col] <- A.parseJSON arr + pure $ SourcePos line col + +data SourceSpan = SourceSpan + { -- | + -- Start of the span + -- + spanStart :: SourcePos + -- End of the span + -- + , spanEnd :: SourcePos + } deriving (Show, Read, Eq, Ord, Generic, Hashable) + +displayStartEndPos :: SourceSpan -> Text +displayStartEndPos sp = + displaySourcePos (spanStart sp) <> " - " <> displaySourcePos (spanEnd sp) + +unionSourceSpansFrom :: Foldable f => SourceSpan -> f SourceSpan -> SourceSpan +unionSourceSpansFrom sourceSpan = maybe sourceSpan sconcat . nonEmpty . toList + +unionSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan +unionSourceSpan (SourceSpan start1 end1) (SourceSpan start2 end2) = SourceSpan (min start1 start2) (max end1 end2) + +emptySourceSpan :: SourceSpan +emptySourceSpan = SourceSpan (SourcePos 1 1) (SourcePos 1 1) + +instance Semigroup SourceSpan where + a <> b = unionSourceSpan a b + +instance A.ToJSON SourceSpan where + toJSON SourceSpan{..} = + A.object [ "start" .= spanStart + , "end" .= spanEnd + ] + +instance A.FromJSON SourceSpan where + parseJSON = A.withObject "SourceSpan" $ \o -> + SourceSpan <$> + o .: "start" <*> + o .: "end" + + +newtype SourceSpans = SourceSpans { unSourceSpans :: These SourceSpan SourceSpan } + deriving (Eq, Show) + +instance A.ToJSON SourceSpans where + toJSON (SourceSpans spans) = case spans of + (This span) -> A.object ["delete" .= span] + (That span) -> A.object ["insert" .= span] + (These span1 span2) -> A.object ["replace" .= (span1, span2)] + toEncoding (SourceSpans spans) = case spans of + (This span) -> A.pairs $ "delete" .= span + (That span) -> A.pairs $ "insert" .= span + (These span1 span2) -> A.pairs $ "replace" .= (span1, span2) + +instance Listable SourcePos where + tiers = cons2 SourcePos + +instance Listable SourceSpan where + tiers = cons2 SourceSpan diff --git a/src/SplitDiff.hs b/src/SplitDiff.hs index 5b4ea0a94..f78b0ac2d 100644 --- a/src/SplitDiff.hs +++ b/src/SplitDiff.hs @@ -1,8 +1,10 @@ module SplitDiff where -import Diff (Annotated) -import Control.Monad.Free (Free) -import Term (Term) +import Data.Record +import Info +import Prologue +import Syntax +import Term (Term, TermF) -- | A patch to only one side of a diff. data SplitPatch a = SplitInsert a | SplitDelete a | SplitReplace a @@ -14,5 +16,12 @@ getSplitTerm (SplitInsert a) = a getSplitTerm (SplitDelete a) = a getSplitTerm (SplitReplace a) = a +-- | Get the range of a SplitDiff. +getRange :: Functor f => HasField fields Range => SplitDiff f (Record fields) -> Range +getRange diff = characterRange $ case runFree diff of + Free annotated -> headF annotated + Pure patch -> extract (getSplitTerm patch) + -- | A diff with only one side’s annotations. -type SplitDiff leaf annotation = Free (Annotated leaf annotation) (SplitPatch (Term leaf annotation)) +type SplitDiff f annotation = Free (TermF f annotation) (SplitPatch (Term f annotation)) +type SplitSyntaxDiff leaf fields = SplitDiff (Syntax leaf) (Record fields) diff --git a/src/Syntax.hs b/src/Syntax.hs index 6c35d2d5b..385d4994f 100644 --- a/src/Syntax.hs +++ b/src/Syntax.hs @@ -1,19 +1,172 @@ +{-# LANGUAGE DeriveAnyClass #-} module Syntax where -import Data.OrderedMap -import qualified Data.Text as T +import Data.Aeson +import Data.Functor.Listable +import Data.Mergeable +import GHC.Generics +import Prologue -- | A node in an abstract syntax tree. -data Syntax - a -- ^ The type of leaves in the syntax tree, typically String, but possibly some datatype representing different leaves more precisely. - f -- ^ The type representing another level of the tree, e.g. the children of branches. Often Cofree or Fix or similar. - = +-- +-- 'a' is the type of leaves in the syntax tree, typically 'Text', but possibly some datatype representing different leaves more precisely. +-- 'f' is the type representing another level of the tree, e.g. the children of branches. Often 'Cofree', 'Free' or similar. +data Syntax a f -- | A terminal syntax node, e.g. an identifier, or atomic literal. - Leaf a + = Leaf a -- | An ordered branch of child nodes, expected to be variadic in the grammar, e.g. a list of statements or uncurried function parameters. | Indexed [f] -- | An ordered branch of child nodes, expected to be of fixed length in the grammar, e.g. a binary operator & its operands. | Fixed [f] - -- | A branch of child nodes indexed by some String identity. This is useful for identifying e.g. methods & properties in a class scope by their names. Note that comments can generally occur in these scopes as well; one strategy for dealing with this is to identify comments by their text in the source. - | Keyed (OrderedMap T.Text f) - deriving (Functor, Show, Eq, Foldable, Traversable) + -- | A function call has an identifier where f is a (Leaf a) and a list of arguments. + | FunctionCall f [f] + -- | A ternary has a condition, a true case and a false case + | Ternary { ternaryCondition :: f, ternaryCases :: [f] } + -- | An anonymous function has a list of expressions and params. + | AnonymousFunction { params :: [f], expressions :: [f] } + -- | A function has a list of expressions. + | Function { id :: f, params :: [f], ty :: (Maybe f), expressions :: [f] } + -- | An assignment has an identifier where f can be a member access, and the value is another syntax element (function call, leaf, etc.) + | Assignment { assignmentId :: f, value :: f } + -- | An operator assignment represents expressions with operators like math (e.g x += 1) or conditional (e.g. x ||= 1) assignment. + | OperatorAssignment f f + -- | A member access contains a syntax, and another syntax that identifies a property or value in the first syntax. + -- | e.g. in Javascript x.y represents a member access syntax. + | MemberAccess { memberId :: f, property :: f } + -- | A method call consisting of its target, the method name, and the parameters passed to the method. + -- | e.g. in Javascript console.log('hello') represents a method call. + | MethodCall { targetId :: f, methodId :: f, methodParams :: [f] } + -- | An operator can be applied to a list of syntaxes. + | Operator [f] + -- | A variable declaration. e.g. var foo; + | VarDecl f (Maybe f) + -- | A variable assignment in a variable declaration. var foo = bar; + | VarAssignment { varId :: f, varValue :: f } + -- | A subscript access contains a syntax, and another syntax that indefies a property or value in the first syntax. + -- | e.g. in Javascript x["y"] represents a subscript access syntax. + | SubscriptAccess { subscriptId :: f, subscriptElement :: f } + | Switch { switchExpr :: [f], cases :: [f] } + | Case { caseExpr :: f, caseStatements :: [f] } + -- | A default case in a switch statement. + | DefaultCase [f] + | Select { cases :: [f] } + | Object { objectTy :: Maybe f, keyValues :: [f] } + -- | A pair in an Object. e.g. foo: bar or foo => bar + | Pair f f + -- | A comment. + | Comment a + -- | A term preceded or followed by any number of comments. + | Commented [f] (Maybe f) + | ParseError [f] + -- | A for statement has a list of expressions to setup the iteration and then a list of expressions in the body. + | For [f] [f] + | DoWhile { doWhileBody :: f, doWhileExpr :: f } + | While { whileExpr :: f, whileBody :: [f] } + | Return [f] + | Throw f + | Constructor f + -- | TODO: Is it a problem that in Ruby, this pattern can work for method def too? + | Try { tryBegin :: [f], catchRescue :: [f], beginElse :: Maybe f, finallyEnsure :: Maybe f } + -- | An array literal with list of children. + | Array (Maybe f) [f] + -- | A class with an identifier, superclass, and a list of definitions. + | Class f (Maybe f) [f] + -- | A method definition with an identifier, optional receiver, optional return type, params, and a list of expressions. + | Method f (Maybe f) (Maybe f) [f] [f] + -- | An if statement with an expression and maybe more expression clauses. + | If f [f] + -- | A module with an identifier, and a list of syntaxes. + | Module { moduleId:: f, moduleBody :: [f] } + | Import f [f] + | Export (Maybe f) [f] + | Yield [f] + -- | A negation of a single expression. + | Negate f + -- | A rescue block has a list of arguments to rescue and a list of expressions. + | Rescue [f] [f] + | Go f + | Defer f + | TypeAssertion f f + | TypeConversion f f + -- | A struct with an optional type. + | Struct (Maybe f) [f] + | Break (Maybe f) + | Continue (Maybe f) + -- | A block statement has an ordered branch of child nodes, e.g. BEGIN {...} or END {...} in Ruby/Perl. + | BlockStatement [f] + -- | A parameter declaration with an optional type. + | ParameterDecl (Maybe f) f + -- | A type declaration has an identifier and a type. + | TypeDecl f f + -- | A field declaration with an optional type, and an optional tag. + | FieldDecl f (Maybe f) (Maybe f) + -- | A type. + | Ty [f] + -- | A send statement has a channel and an expression in Go. + | Send f f + deriving (Eq, Foldable, Functor, Generic, Generic1, Mergeable, Ord, Show, Traversable, ToJSON) + + +-- Instances + +instance Listable2 Syntax where + liftTiers2 leaf recur + = liftCons1 leaf Leaf + \/ liftCons1 (liftTiers recur) Indexed + \/ liftCons1 (liftTiers recur) Fixed + \/ liftCons2 recur (liftTiers recur) FunctionCall + \/ liftCons2 recur (liftTiers recur) Ternary + \/ liftCons2 (liftTiers recur) (liftTiers recur) AnonymousFunction + \/ liftCons4 recur (liftTiers recur) (liftTiers recur) (liftTiers recur) Function + \/ liftCons2 recur recur Assignment + \/ liftCons2 recur recur OperatorAssignment + \/ liftCons2 recur recur MemberAccess + \/ liftCons3 recur recur (liftTiers recur) MethodCall + \/ liftCons1 (liftTiers recur) Operator + \/ liftCons2 recur (liftTiers recur) VarDecl + \/ liftCons2 recur recur VarAssignment + \/ liftCons2 recur recur SubscriptAccess + \/ liftCons2 (liftTiers recur) (liftTiers recur) Switch + \/ liftCons2 recur (liftTiers recur) Case + \/ liftCons1 (liftTiers recur) Select + \/ liftCons2 (liftTiers recur) (liftTiers recur) Syntax.Object + \/ liftCons2 recur recur Pair + \/ liftCons1 leaf Comment + \/ liftCons2 (liftTiers recur) (liftTiers recur) Commented + \/ liftCons1 (liftTiers recur) Syntax.ParseError + \/ liftCons2 (liftTiers recur) (liftTiers recur) For + \/ liftCons2 recur recur DoWhile + \/ liftCons2 recur (liftTiers recur) While + \/ liftCons1 (liftTiers recur) Return + \/ liftCons1 recur Throw + \/ liftCons1 recur Constructor + \/ liftCons4 (liftTiers recur) (liftTiers recur) (liftTiers recur) (liftTiers recur) Try + \/ liftCons2 (liftTiers recur) (liftTiers recur) Syntax.Array + \/ liftCons3 recur (liftTiers recur) (liftTiers recur) Class + \/ liftCons5 recur (liftTiers recur) (liftTiers recur) (liftTiers recur) (liftTiers recur) Method + \/ liftCons2 recur (liftTiers recur) If + \/ liftCons2 recur (liftTiers recur) Module + \/ liftCons2 recur (liftTiers recur) Import + \/ liftCons2 (liftTiers recur) (liftTiers recur) Export + \/ liftCons1 (liftTiers recur) Yield + \/ liftCons1 recur Negate + \/ liftCons2 (liftTiers recur) (liftTiers recur) Rescue + \/ liftCons1 recur Go + \/ liftCons1 recur Defer + \/ liftCons2 recur recur TypeAssertion + \/ liftCons2 recur recur TypeConversion + \/ liftCons1 (liftTiers recur) Break + \/ liftCons1 (liftTiers recur) Continue + \/ liftCons1 (liftTiers recur) BlockStatement + \/ liftCons2 (liftTiers recur) recur ParameterDecl + \/ liftCons2 recur recur TypeDecl + \/ liftCons3 recur (liftTiers recur) (liftTiers recur) FieldDecl + \/ liftCons1 (liftTiers recur) Ty + \/ liftCons2 recur recur Send + \/ liftCons1 (liftTiers recur) DefaultCase + +instance Listable leaf => Listable1 (Syntax leaf) where + liftTiers = liftTiers2 tiers + +instance (Listable leaf, Listable recur) => Listable (Syntax leaf recur) where + tiers = tiers1 diff --git a/src/Term.hs b/src/Term.hs index 87c5e527a..492d6e753 100644 --- a/src/Term.hs +++ b/src/Term.hs @@ -1,35 +1,47 @@ +{-# LANGUAGE RankNTypes, TypeFamilies, TypeSynonymInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} module Term where -import Control.Comonad.Cofree +import Prologue +import Data.Align.Generic +import Data.Functor.Foldable as Foldable import Data.Functor.Both -import Data.Maybe -import Data.OrderedMap hiding (size) +import Data.Record +import Data.These import Syntax --- | An annotated node (Syntax) in an abstract syntax tree. -type Term a annotation = Cofree (Syntax a) annotation +-- | A Term with an abstract syntax tree and an annotation. +type Term f = Cofree f +type TermF = CofreeF + +-- | A Term with a Syntax leaf and a record of fields. +type SyntaxTerm leaf fields = Term (Syntax leaf) (Record fields) +type SyntaxTermF leaf fields = TermF (Syntax leaf) (Record fields) + +-- Term has a Base functor TermF which gives it Recursive and Corecursive instances. +type instance Base (Term f a) = TermF f a +instance Functor f => Recursive (Term f a) where project = runCofree +instance Functor f => Corecursive (Term f a) where embed = cofree -- | Zip two terms by combining their annotations into a pair of annotations. -- | If the structure of the two terms don't match, then Nothing will be returned. -zipTerms :: Term a annotation -> Term a annotation -> Maybe (Term a (Both annotation)) -zipTerms (annotation1 :< a) (annotation2 :< b) = annotate $ zipUnwrap a b - where - annotate = fmap (Both (annotation1, annotation2) :<) - zipUnwrap (Leaf _) (Leaf b') = Just $ Leaf b' - zipUnwrap (Indexed a') (Indexed b') = Just . Indexed . catMaybes $ zipWith zipTerms a' b' - zipUnwrap (Fixed a') (Fixed b') = Just . Fixed . catMaybes $ zipWith zipTerms a' b' - zipUnwrap (Keyed a') (Keyed b') | keys a' == keys b' = Just . Keyed . fromList . catMaybes $ zipUnwrapMaps a' b' <$> keys a' - zipUnwrap _ _ = Nothing - zipUnwrapMaps a' b' key = (,) key <$> zipTerms (a' ! key) (b' ! key) +zipTerms :: (Traversable f, GAlign f) => Term f annotation -> Term f annotation -> Maybe (Term f (Both annotation)) +zipTerms t1 t2 = iter go (alignCofreeWith galign (const Nothing) both (These t1 t2)) + where go (a :< s) = cofree . (a :<) <$> sequenceA s --- | Fold a term into some other value, starting with the leaves. -cata :: (annotation -> Syntax a b -> b) -> Term a annotation -> b -cata f (annotation :< syntax) = f annotation $ cata f <$> syntax - --- | Return the number of leaves in the node. -termSize :: Term a annotation -> Integer +-- | Return the node count of a term. +termSize :: (Foldable f, Functor f) => Term f annotation -> Int termSize = cata size where - size _ (Leaf _) = 1 - size _ (Indexed i) = sum i - size _ (Fixed f) = sum f - size _ (Keyed k) = sum k + size (_ :< syntax) = 1 + sum syntax + +-- | Aligns (zips, retaining non-overlapping portions of the structure) a pair of terms. +alignCofreeWith :: Functor f + => (forall a b. f a -> f b -> Maybe (f (These a b))) -- ^ A function comparing a pair of structures, returning `Just` the combined structure if they are comparable (e.g. if they have the same constructor), and `Nothing` otherwise. The 'Data.Align.Generic.galign' function is usually what you want here. + -> (These (Term f a) (Term f b) -> contrasted) -- ^ A function mapping a 'These' of incomparable terms into 'Pure' values in the resulting tree. + -> (a -> b -> combined) -- ^ A function mapping the input terms’ annotations into annotations in the 'Free' values in the resulting tree. + -> These (Term f a) (Term f b) -- ^ The input terms. + -> Free (TermF f combined) contrasted +alignCofreeWith compare contrast combine = go + where go terms = fromMaybe (pure (contrast terms)) $ case terms of + These t1 t2 -> wrap . (combine (extract t1) (extract t2) :<) . fmap go <$> compare (unwrap t1) (unwrap t2) + _ -> Nothing diff --git a/src/TreeSitter.hs b/src/TreeSitter.hs index f54c3abb2..378e6b56c 100644 --- a/src/TreeSitter.hs +++ b/src/TreeSitter.hs @@ -1,62 +1,133 @@ -module TreeSitter where +{-# LANGUAGE DataKinds #-} +module TreeSitter +( treeSitterParser +, defaultTermAssignment +) where +import Prologue hiding (Constructor) import Category +import Data.Record import Language +import qualified Language.C as C +import qualified Language.Go as Go +import qualified Language.JavaScript as JS +import qualified Language.Ruby as Ruby import Parser import Range import Source -import qualified Data.Set as Set +import qualified Syntax import Foreign import Foreign.C.String +import qualified Syntax as S +import Term import Text.Parser.TreeSitter hiding (Language(..)) import qualified Text.Parser.TreeSitter as TS +import SourceSpan +import Info -- | Returns a TreeSitter parser for the given language and TreeSitter grammar. -treeSitterParser :: Language -> Ptr TS.Language -> Parser -treeSitterParser language grammar contents = do - document <- ts_document_make +treeSitterParser :: Language -> Ptr TS.Language -> Parser (Syntax.Syntax Text) (Record '[Range, Category, SourceSpan]) +treeSitterParser language grammar blob = do + document <- ts_document_new ts_document_set_language document grammar - withCString (toString contents) (\source -> do + withCString (toString $ source blob) (\source -> do ts_document_set_input_string document source ts_document_parse document - term <- documentToTerm (termConstructor $ categoriesForLanguage language) document contents + term <- documentToTerm language document blob ts_document_free document - return term) + pure term) --- Given a language and a node name, return the correct categories. -categoriesForLanguage :: Language -> String -> Set.Set Category -categoriesForLanguage language name = case (language, name) of - (JavaScript, "object") -> Set.singleton DictionaryLiteral - (JavaScript, "rel_op") -> Set.singleton BinaryOperator -- relational operator, e.g. >, <, <=, >=, ==, != - - (Ruby, "hash") -> Set.singleton DictionaryLiteral - _ -> defaultCategoryForNodeName name - --- | Given a node name from TreeSitter, return the correct categories. -defaultCategoryForNodeName :: String -> Set.Set Category -defaultCategoryForNodeName name = case name of - "function_call" -> Set.singleton FunctionCall - "pair" -> Set.singleton Pair - "string" -> Set.singleton StringLiteral - "integer" -> Set.singleton IntegerLiteral - "symbol" -> Set.singleton SymbolLiteral - "array" -> Set.singleton ArrayLiteral - _ -> Set.singleton (Other name) - --- | Given a constructor and a tree sitter document, return a parser. -documentToTerm :: Constructor -> Ptr Document -> Parser -documentToTerm constructor document contents = alloca $ \ root -> do +-- | Return a parser for a tree sitter language & document. +documentToTerm :: Language -> Ptr Document -> Parser (Syntax.Syntax Text) (Record '[Range, Category, SourceSpan]) +documentToTerm language document SourceBlob{..} = alloca $ \ root -> do ts_document_root_node_p document root toTerm root where toTerm node = do name <- ts_node_p_name node document name <- peekCString name count <- ts_node_p_named_child_count node - children <- mapM (alloca . getChild node) $ take (fromIntegral count) [0..] - -- Note: The strict application here is semantically important. Without it, we may not evaluate the range until after we’ve exited the scope that `node` was allocated within, meaning `alloca` will free it & other stack data may overwrite it. - range <- return $! Range { start = fromIntegral $ ts_node_p_start_char node, end = fromIntegral $ ts_node_p_end_char node } + children <- filter isNonEmpty <$> traverse (alloca . getChild node) (take (fromIntegral count) [0..]) - return $! constructor contents range name children - getChild node n out = do - _ <- ts_node_p_named_child node n out - toTerm out + let range = Range { start = fromIntegral $ ts_node_p_start_char node, end = fromIntegral $ ts_node_p_end_char node } + + let startPos = SourcePos (1 + (fromIntegral $! ts_node_p_start_point_row node)) (1 + (fromIntegral $! ts_node_p_start_point_column node)) + let endPos = SourcePos (1 + (fromIntegral $! ts_node_p_end_point_row node)) (1 + (fromIntegral $! ts_node_p_end_point_column node)) + let sourceSpan = SourceSpan { spanStart = startPos , spanEnd = endPos } + + allChildrenCount <- ts_node_p_child_count node + let allChildren = filter isNonEmpty <$> traverse (alloca . getUnnamedChild node) (take (fromIntegral allChildrenCount) [0..]) + + -- Note: The strict application here is semantically important. + -- Without it, we may not evaluate the value until after we’ve exited + -- the scope that `node` was allocated within, meaning `alloca` will + -- free it & other stack data may overwrite it. + range `seq` sourceSpan `seq` assignTerm language (slice range source) (range :. categoryForLanguageProductionName language (toS name) :. sourceSpan :. Nil) children allChildren + getChild node n out = ts_node_p_named_child node n out >> toTerm out + {-# INLINE getChild #-} + getUnnamedChild node n out = ts_node_p_child node n out >> toTerm out + {-# INLINE getUnnamedChild #-} + isNonEmpty child = category (extract child) /= Empty + +assignTerm :: Language -> Source Char -> Record '[Range, Category, SourceSpan] -> [ SyntaxTerm Text '[ Range, Category, SourceSpan ] ] -> IO [ SyntaxTerm Text '[ Range, Category, SourceSpan ] ] -> IO (SyntaxTerm Text '[ Range, Category, SourceSpan ]) +assignTerm language source annotation children allChildren = + cofree . (annotation :<) <$> case assignTermByLanguage language source (category annotation) children of + Just a -> pure a + _ -> defaultTermAssignment source (category annotation) children allChildren + where assignTermByLanguage :: Language -> Source Char -> Category -> [ SyntaxTerm Text '[ Range, Category, SourceSpan ] ] -> Maybe (S.Syntax Text (SyntaxTerm Text '[ Range, Category, SourceSpan ])) + assignTermByLanguage = \case + JavaScript -> JS.termAssignment + C -> C.termAssignment + Language.Go -> Go.termAssignment + Ruby -> Ruby.termAssignment + _ -> \ _ _ _ -> Nothing + +defaultTermAssignment :: Source Char -> Category -> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -> IO [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -> IO (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan])) +defaultTermAssignment source category children allChildren + | category `elem` operatorCategories = S.Operator <$> allChildren + | otherwise = pure $! case (category, children) of + (ParseError, children) -> S.ParseError children + + (Comment, _) -> S.Comment (toText source) + + (Pair, [key, value]) -> S.Pair key value + + -- Control flow statements + (If, condition : body) -> S.If condition body + (Switch, _) -> uncurry S.Switch (Prologue.break ((== Case) . Info.category . extract) children) + (Case, expr : body) -> S.Case expr body + (While, expr : rest) -> S.While expr rest + + -- Statements + (Return, _) -> S.Return children + (Yield, _) -> S.Yield children + (Throw, [expr]) -> S.Throw expr + (Break, [label]) -> S.Break (Just label) + (Break, []) -> S.Break Nothing + (Continue, [label]) -> S.Continue (Just label) + (Continue, []) -> S.Continue Nothing + + (_, []) -> S.Leaf (toText source) + (_, children) -> S.Indexed children + where operatorCategories = + [ Operator + , Binary + , Unary + , RangeExpression + , ScopeOperator + , BooleanOperator + , MathOperator + , RelationalOperator + , BitwiseOperator + ] + + +categoryForLanguageProductionName :: Language -> Text -> Category +categoryForLanguageProductionName = withDefaults . \case + JavaScript -> JS.categoryForJavaScriptProductionName + C -> C.categoryForCProductionName + Ruby -> Ruby.categoryForRubyName + Language.Go -> Go.categoryForGoName + _ -> Other + where withDefaults productionMap = \case + "ERROR" -> ParseError + s -> productionMap s diff --git a/test/AlignmentSpec.hs b/test/AlignmentSpec.hs index f7df8e64d..7303a232a 100644 --- a/test/AlignmentSpec.hs +++ b/test/AlignmentSpec.hs @@ -1,67 +1,309 @@ +{-# LANGUAGE DataKinds #-} module AlignmentSpec where -import Test.Hspec -import Test.Hspec.QuickCheck -import Test.QuickCheck hiding (Fixed) -import Data.Text.Arbitrary () - import Alignment -import ArbitraryTerm (arbitraryLeaf) -import Control.Arrow -import Control.Comonad.Cofree -import Control.Monad.Free hiding (unfold) -import Data.Adjoined -import Data.Copointed +import Control.Monad.State +import Data.Align hiding (align) +import Data.Bifunctor +import Data.Bifunctor.Join import Data.Functor.Both as Both -import Diff -import qualified Data.Maybe as Maybe -import Data.Functor.Identity -import Line +import Data.Functor.Listable +import Data.List (nub) +import Data.Monoid hiding ((<>)) +import Data.Record +import Data.String +import Data.These import Patch -import Prelude hiding (fst, snd) -import qualified Prelude +import Prologue hiding (fst, snd) +import qualified Prologue import Range -import Source hiding ((++), fromList) import qualified Source import SplitDiff import Syntax +import Term +import Test.Hspec (Spec, describe, it, parallel) +import Test.Hspec.Expectations.Pretty +import Test.Hspec.LeanCheck +import Test.LeanCheck +import GHC.Show (Show(..)) spec :: Spec spec = parallel $ do - describe "splitDiffByLines" $ do - prop "preserves line counts in equal sources" $ - \ source -> - length (splitDiffByLines (pure source) (Free $ Annotated (pure $ Info (totalRange source) mempty) (Indexed . Prelude.fst $ foldl combineIntoLeaves ([], 0) source))) `shouldBe` length (filter (== '\n') $ toString source) + 1 + describe "alignBranch" $ do + it "produces symmetrical context" $ + alignBranch getRange ([] :: [Join These (SplitDiff (Syntax String) (Record '[Range]))]) (both [Range 0 2, Range 2 4] [Range 0 2, Range 2 4]) `shouldBe` + [ Join (These (Range 0 2, []) + (Range 0 2, [])) + , Join (These (Range 2 4, []) + (Range 2 4, [])) + ] - prop "produces the maximum line count in inequal sources" $ - \ sources -> - length (splitDiffByLines sources (Free $ Annotated ((`Info` mempty) . totalRange <$> sources) (Indexed $ leafWithRangesInSources sources <$> runBothWith (zipWith both) (actualLineRanges <$> (totalRange <$> sources) <*> sources)))) `shouldBe` runBothWith max ((+ 1) . length . filter (== '\n') . toString <$> sources) + it "produces asymmetrical context" $ + alignBranch getRange ([] :: [Join These (SplitDiff (Syntax String) (Record '[Range]))]) (both [Range 0 2, Range 2 4] [Range 0 1]) `shouldBe` + [ Join (These (Range 0 2, []) + (Range 0 1, [])) + , Join (This (Range 2 4, [])) + ] - describe "splitAbstractedTerm" $ do - prop "preserves line count" $ - \ source -> let range = totalRange source in - splitAbstractedTerm (:<) (Identity source) (Identity (Info range mempty)) (Leaf source) `shouldBe` (Identity . lineMap (fmap (((:< Leaf source) . (`Info` mempty) &&& id))) <$> linesInRangeOfSource range source) + prop "covers every input line" $ + \ elements -> let (_, children, ranges) = toAlignBranchInputs elements in + join <$> traverse (modifyJoin (fromThese [] []) . fmap (pure . Prologue.fst)) (alignBranch Prologue.snd children ranges) `shouldBe` ranges - let makeTerm = ((Free .) . Annotated) :: Info -> Syntax (Source Char) (SplitDiff (Source Char) Info) -> SplitDiff (Source Char) Info - prop "outputs one row for single-line unchanged leaves" $ - forAll (arbitraryLeaf `suchThat` isOnSingleLine) $ - \ (source, info@(Info range categories), syntax) -> splitAbstractedTerm makeTerm (pure source) (pure $ Info range categories) syntax `shouldBe` fromList [ - both (pure (makeTerm info $ Leaf source, Range 0 (length source))) (pure (makeTerm info $ Leaf source, Range 0 (length source))) ] + prop "covers every input child" $ + \ elements -> let (_, children, ranges) = toAlignBranchInputs elements in + sort (nub (keysOfAlignedChildren (alignBranch Prologue.snd children ranges))) `shouldBe` sort (nub (catMaybes (branchElementKey <$> elements))) - prop "outputs one row for single-line empty unchanged indexed nodes" $ - forAll (arbitrary `suchThat` (\ a -> filter (/= '\n') (toString a) == toString a)) $ - \ source -> splitAbstractedTerm makeTerm (pure source) (pure $ Info (totalRange source) mempty) (Indexed []) `shouldBe` fromList [ - both (pure (makeTerm (Info (totalRange source) mempty) $ Indexed [], Range 0 (length source))) (pure (makeTerm (Info (totalRange source) mempty) $ Indexed [], Range 0 (length source))) ] + prop "covers every line of every input child" $ + \ elements -> let (_, children, ranges) = toAlignBranchInputs elements in + sort (keysOfAlignedChildren (alignBranch Prologue.snd children ranges)) `shouldBe` sort (do + line <- children + these (pure . Prologue.fst) (pure . Prologue.fst) (\ (k1, _) (k2, _) -> [ k1, k2 ]) . runJoin $ line) - where - isOnSingleLine (a, _, _) = filter (/= '\n') (toString a) == toString a + describe "alignDiff" $ do + it "aligns identical branches on a single line" $ + let sources = both (Source.fromList "[ foo ]") (Source.fromList "[ foo ]") in + align sources (pure (info 0 7) `branch` [ pure (info 2 5) `leaf` "foo" ]) `shouldBe` prettyDiff sources + [ Join (These (info 0 7 `branch` [ info 2 5 `leaf` "foo" ]) + (info 0 7 `branch` [ info 2 5 `leaf` "foo" ])) ] - combineIntoLeaves (leaves, start) char = (leaves ++ [ Free $ Annotated (Info <$> pure (Range start $ start + 1) <*> mempty) (Leaf [ char ]) ], start + 1) + it "aligns identical branches spanning multiple lines" $ + let sources = both (Source.fromList "[\nfoo\n]") (Source.fromList "[\nfoo\n]") in + align sources (pure (info 0 7) `branch` [ pure (info 2 5) `leaf` "foo" ]) `shouldBe` prettyDiff sources + [ Join (These (info 0 2 `branch` []) + (info 0 2 `branch` [])) + , Join (These (info 2 6 `branch` [ info 2 5 `leaf` "foo" ]) + (info 2 6 `branch` [ info 2 5 `leaf` "foo" ])) + , Join (These (info 6 7 `branch` []) + (info 6 7 `branch` [])) + ] - leafWithRangesInSources sources ranges = Free $ Annotated (Info <$> ranges <*> pure mempty) (Leaf $ runBothWith (++) (toString <$> sources)) + it "aligns reformatted branches" $ + let sources = both (Source.fromList "[ foo ]") (Source.fromList "[\nfoo\n]") in + align sources (pure (info 0 7) `branch` [ pure (info 2 5) `leaf` "foo" ]) `shouldBe` prettyDiff sources + [ Join (That (info 0 2 `branch` [])) + , Join (These (info 0 7 `branch` [ info 2 5 `leaf` "foo" ]) + (info 2 6 `branch` [ info 2 5 `leaf` "foo" ])) + , Join (That (info 6 7 `branch` [])) + ] - leafWithRangeInSource source range = Info range mempty :< Leaf source + it "aligns nodes following reformatted branches" $ + let sources = both (Source.fromList "[ foo ]\nbar\n") (Source.fromList "[\nfoo\n]\nbar\n") in + align sources (pure (info 0 12) `branch` [ pure (info 0 7) `branch` [ pure (info 2 5) `leaf` "foo" ], pure (info 8 11) `leaf` "bar" ]) `shouldBe` prettyDiff sources + [ Join (That (info 0 2 `branch` [ info 0 2 `branch` [] ])) + , Join (These (info 0 8 `branch` [ info 0 7 `branch` [ info 2 5 `leaf` "foo" ] ]) + (info 2 6 `branch` [ info 2 6 `branch` [ info 2 5 `leaf` "foo" ] ])) + , Join (That (info 6 8 `branch` [ info 6 7 `branch` [] ])) + , Join (These (info 8 12 `branch` [ info 8 11 `leaf` "bar" ]) + (info 8 12 `branch` [ info 8 11 `leaf` "bar" ])) + , Join (These (info 12 12 `branch` []) + (info 12 12 `branch` [])) + ] - patchWithBoth (Insert ()) = Insert . snd - patchWithBoth (Delete ()) = Delete . fst - patchWithBoth (Replace () ()) = runBothWith Replace + it "aligns identical branches with multiple children on the same line" $ + let sources = pure (Source.fromList "[ foo, bar ]") in + align sources (pure (info 0 12) `branch` [ pure (info 2 5) `leaf` "foo", pure (info 7 10) `leaf` "bar" ]) `shouldBe` prettyDiff sources + [ Join (runBothWith These (pure (info 0 12 `branch` [ info 2 5 `leaf` "foo", info 7 10 `leaf` "bar" ])) ) ] + + it "aligns insertions" $ + let sources = both (Source.fromList "a") (Source.fromList "a\nb") in + align sources (both (info 0 1) (info 0 3) `branch` [ pure (info 0 1) `leaf` "a", insert (info 2 3 `leaf` "b") ]) `shouldBe` prettyDiff sources + [ Join (These (info 0 1 `branch` [ info 0 1 `leaf` "a" ]) + (info 0 2 `branch` [ info 0 1 `leaf` "a" ])) + , Join (That (info 2 3 `branch` [ insert (info 2 3 `leaf` "b") ])) + ] + + it "aligns total insertions" $ + let sources = both (Source.fromList "") (Source.fromList "a") in + align sources (insert (info 0 1 `leaf` "a")) `shouldBe` prettyDiff sources + [ Join (That (insert (info 0 1 `leaf` "a"))) ] + + it "aligns insertions into empty branches" $ + let sources = both (Source.fromList "[ ]") (Source.fromList "[a]") in + align sources (pure (info 0 3) `branch` [ insert (info 1 2 `leaf` "a") ]) `shouldBe` prettyDiff sources + [ Join (That (info 0 3 `branch` [ insert (info 1 2 `leaf` "a") ])) + , Join (This (info 0 3 `branch` [])) + ] + + it "aligns symmetrically following insertions" $ + let sources = both (Source.fromList "a\nc") (Source.fromList "a\nb\nc") in + align sources (both (info 0 3) (info 0 5) `branch` [ pure (info 0 1) `leaf` "a", insert (info 2 3 `leaf` "b"), both (info 2 3) (info 4 5) `leaf` "c" ]) + `shouldBe` prettyDiff sources + [ Join (These (info 0 2 `branch` [ info 0 1 `leaf` "a" ]) + (info 0 2 `branch` [ info 0 1 `leaf` "a" ])) + , Join (That (info 2 4 `branch` [ insert (info 2 3 `leaf` "b") ])) + , Join (These (info 2 3 `branch` [ info 2 3 `leaf` "c" ]) + (info 4 5 `branch` [ info 4 5 `leaf` "c" ])) + ] + + it "symmetrical nodes force the alignment of asymmetrical nodes on both sides" $ + let sources = both (Source.fromList "[ a, b ]") (Source.fromList "[ b, c ]") in + align sources (pure (info 0 8) `branch` [ delete (info 2 3 `leaf` "a"), both (info 5 6) (info 2 3) `leaf` "b", insert (info 5 6 `leaf` "c") ]) `shouldBe` prettyDiff sources + [ Join (These (info 0 8 `branch` [ delete (info 2 3 `leaf` "a"), info 5 6 `leaf` "b" ]) + (info 0 8 `branch` [ info 2 3 `leaf` "b", insert (info 5 6 `leaf` "c") ])) ] + + it "when one of two symmetrical nodes must be split, splits the latter" $ + let sources = both (Source.fromList "[ a, b ]") (Source.fromList "[ a\n, b\n]") in + align sources (both (info 0 8) (info 0 9) `branch` [ pure (info 2 3) `leaf` "a", both (info 5 6) (info 6 7) `leaf` "b" ]) `shouldBe` prettyDiff sources + [ Join (These (info 0 8 `branch` [ info 2 3 `leaf` "a", info 5 6 `leaf` "b" ]) + (info 0 4 `branch` [ info 2 3 `leaf` "a" ])) + , Join (That (info 4 8 `branch` [ info 6 7 `leaf` "b" ])) + , Join (That (info 8 9 `branch` [])) + ] + + it "aligns deletions before insertions" $ + let sources = both (Source.fromList "[ a ]") (Source.fromList "[ b ]") in + align sources (pure (info 0 5) `branch` [ delete (info 2 3 `leaf` "a"), insert (info 2 3 `leaf` "b") ]) `shouldBe` prettyDiff sources + [ Join (This (info 0 5 `branch` [ delete (info 2 3 `leaf` "a") ])) + , Join (That (info 0 5 `branch` [ insert (info 2 3 `leaf` "b") ])) + ] + + it "aligns context-only lines symmetrically" $ + let sources = both (Source.fromList "[\n a\n,\n b\n]") (Source.fromList "[\n a, b\n\n\n]") in + align sources (both (info 0 13) (info 0 12) `branch` [ pure (info 4 5) `leaf` "a", both (info 10 11) (info 7 8) `leaf` "b" ]) `shouldBe` prettyDiff sources + [ Join (These (info 0 2 `branch` []) + (info 0 2 `branch` [])) + , Join (These (info 2 6 `branch` [ info 4 5 `leaf` "a" ]) + (info 2 9 `branch` [ info 4 5 `leaf` "a", info 7 8 `leaf` "b" ])) + , Join (These (info 6 8 `branch` []) + (info 9 10 `branch` [])) + , Join (This (info 8 12 `branch` [ info 10 11 `leaf` "b" ])) + , Join (These (info 12 13 `branch` []) + (info 10 11 `branch` [])) + , Join (That (info 11 12 `branch` [])) + ] + + it "aligns asymmetrical nodes preceding their symmetrical siblings conservatively" $ + let sources = both (Source.fromList "[ b, c ]") (Source.fromList "[ a\n, c\n]") in + align sources (both (info 0 8) (info 0 9) `branch` [ insert (info 2 3 `leaf` "a"), delete (info 2 3 `leaf` "b"), both (info 5 6) (info 6 7) `leaf` "c" ]) `shouldBe` prettyDiff sources + [ Join (That (info 0 4 `branch` [ insert (info 2 3 `leaf` "a") ])) + , Join (These (info 0 8 `branch` [ delete (info 2 3 `leaf` "b"), info 5 6 `leaf` "c" ]) + (info 4 8 `branch` [ info 6 7 `leaf` "c" ])) + , Join (That (info 8 9 `branch` [])) + ] + + it "aligns symmetrical reformatted nodes" $ + let sources = both (Source.fromList "a [ b ]\nc") (Source.fromList "a [\nb\n]\nc") in + align sources (pure (info 0 9) `branch` [ pure (info 0 1) `leaf` "a", pure (info 2 7) `branch` [ pure (info 4 5) `leaf` "b" ], pure (info 8 9) `leaf` "c" ]) `shouldBe` prettyDiff sources + [ Join (These (info 0 8 `branch` [ info 0 1 `leaf` "a", info 2 7 `branch` [ info 4 5 `leaf` "b" ] ]) + (info 0 4 `branch` [ info 0 1 `leaf` "a", info 2 4 `branch` [] ])) + , Join (That (info 4 6 `branch` [ info 4 6 `branch` [ info 4 5 `leaf` "b" ] ])) + , Join (That (info 6 8 `branch` [ info 6 7 `branch` [] ])) + , Join (These (info 8 9 `branch` [ info 8 9 `leaf` "c" ]) + (info 8 9 `branch` [ info 8 9 `leaf` "c" ])) + ] + + describe "numberedRows" $ do + prop "counts only non-empty values" $ + \ xs -> counts (numberedRows (unListableF <$> xs :: [Join These Char])) `shouldBe` length . catMaybes <$> Join (unalign (runJoin . unListableF <$> xs)) + +data BranchElement + = Child String (Join These String) + | Margin (Join These String) + deriving Show + +branchElementKey :: BranchElement -> Maybe String +branchElementKey (Child key _) = Just key +branchElementKey _ = Nothing + +toAlignBranchInputs :: [BranchElement] -> (Both (Source.Source Char), [Join These (String, Range)], Both [Range]) +toAlignBranchInputs elements = (sources, join . (`evalState` both 0 0) . traverse go $ elements, ranges) + where go :: BranchElement -> State (Both Int) [Join These (String, Range)] + go child@(Child key _) = do + lines <- traverse (\ (Child _ contents) -> do + prev <- get + let next = (+) <$> prev <*> modifyJoin (fromThese 0 0) (length <$> contents) + put next + pure $! modifyJoin (runBothWith bimap (const <$> (Range <$> prev <*> next))) contents) (alignBranchElement child) + pure $! fmap ((,) key) <$> lines + go (Margin contents) = do + prev <- get + put $ (+) <$> prev <*> modifyJoin (fromThese 0 0) (length <$> contents) + pure [] + alignBranchElement element = case element of + Child key contents -> Child key <$> joinCrosswalk lines contents + Margin contents -> Margin <$> joinCrosswalk lines contents + where lines = fmap toList . Source.actualLines . Source.fromList + sources = foldMap Source.fromList <$> bothContents elements + ranges = fmap (filter (\ (Range start end) -> start /= end)) $ Source.actualLineRanges <$> (totalRange <$> sources) <*> sources + bothContents = foldMap (modifyJoin (fromThese [] []) . fmap (:[]) . branchElementContents) + branchElementContents (Child _ contents) = contents + branchElementContents (Margin contents) = contents + +keysOfAlignedChildren :: [Join These (Range, [(String, Range)])] -> [String] +keysOfAlignedChildren lines = lines >>= these identity identity (<>) . runJoin . fmap (fmap Prologue.fst . Prologue.snd) + +joinCrosswalk :: Bicrosswalk p => Align f => (a -> f b) -> Join p a -> f (Join p b) +joinCrosswalk f = fmap Join . bicrosswalk f f . runJoin + +instance Listable BranchElement where + tiers = oneof [ (\ key -> Child key `mapT` joinTheseOf (contents key)) `concatMapT` key + , Margin `mapT` joinTheseOf (pure `mapT` padding '-') ] + where key = pure `mapT` [['a'..'z'] <> ['A'..'Z'] <> ['0'..'9']] + contents key = (wrap key . pure) `mapT` padding '*' + wrap key contents = "(" <> key <> contents <> ")" :: String + padding :: Char -> [Tier Char] + padding char = frequency [ (10, [[char]]) + , (1, [['\n']]) ] + joinTheseOf g = oneof [ (Join . This) `mapT` g + , (Join . That) `mapT` g + , productWith ((Join .) . These) g g ] + frequency :: [(Int, [Tier a])] -> [Tier a] + frequency = concatT . foldr ((\/) . pure . uncurry replicate) [] + oneof :: [[[a]]] -> [[a]] + oneof = frequency . fmap ((,) 1) + + +counts :: [Join These (Int, a)] -> Both Int +counts numbered = fromMaybe 0 . getLast . mconcat . fmap Last <$> Join (unalign (runJoin . fmap Prologue.fst <$> numbered)) + +align :: Both (Source.Source Char) -> ConstructibleFree (Patch (Term (Syntax String) (Record '[Range]))) (Both (Record '[Range])) -> PrettyDiff (SplitDiff (Syntax String) (Record '[Range])) +align sources = PrettyDiff sources . fmap (fmap (getRange &&& identity)) . alignDiff sources . deconstruct + +info :: Int -> Int -> Record '[Range] +info start end = Range start end :. Nil + +prettyDiff :: Both (Source.Source Char) -> [Join These (ConstructibleFree (SplitPatch (Term (Syntax String) (Record '[Range]))) (Record '[Range]))] -> PrettyDiff (SplitDiff (Syntax String) (Record '[Range])) +prettyDiff sources = PrettyDiff sources . fmap (fmap ((getRange &&& identity) . deconstruct)) + +data PrettyDiff a = PrettyDiff { unPrettySources :: Both (Source.Source Char), unPrettyLines :: [Join These (Range, a)] } + deriving Eq + +instance Show (PrettyDiff a) where + showsPrec _ (PrettyDiff sources lines) = (prettyPrinted ++) -- . (("\n" ++ show lines) ++) + where prettyPrinted = showLine (maximum (0 : (maximum . fmap length <$> shownLines))) <$> shownLines >>= ('\n':) + shownLines = catMaybes $ toBoth <$> lines + showLine n line = uncurry ((<>) . (++ " | ")) (fromThese (replicate n ' ') (replicate n ' ') (runJoin (pad n <$> line))) + showDiff (range, _) = filter (/= '\n') . toList . Source.slice range + pad n string = (<>) (take n string) (replicate (max 0 (n - length string)) ' ') + toBoth them = showDiff <$> them `applyThese` modifyJoin (uncurry These) sources + +newtype ConstructibleFree patch annotation = ConstructibleFree { deconstruct :: Free (CofreeF (Syntax String) annotation) patch } + + +class PatchConstructible p where + insert :: Term (Syntax String) (Record '[Range]) -> p + delete :: Term (Syntax String) (Record '[Range]) -> p + +instance PatchConstructible (Patch (Term (Syntax String) (Record '[Range]))) where + insert = Insert + delete = Delete + +instance PatchConstructible (SplitPatch (Term (Syntax String) (Record '[Range]))) where + insert = SplitInsert + delete = SplitDelete + +instance PatchConstructible patch => PatchConstructible (ConstructibleFree patch annotation) where + insert = ConstructibleFree . pure . insert + delete = ConstructibleFree . pure . delete + +class SyntaxConstructible s where + leaf :: annotation -> String -> s annotation + branch :: annotation -> [s annotation] -> s annotation + +instance SyntaxConstructible (ConstructibleFree patch) where + leaf info = ConstructibleFree . free . Free . (info :<) . Leaf + branch info = ConstructibleFree . free . Free . (info :<) . Indexed . fmap deconstruct + +instance SyntaxConstructible (Cofree (Syntax String)) where + info `leaf` value = cofree $ info :< Leaf value + info `branch` children = cofree $ info :< Indexed children diff --git a/test/ArbitraryTerm.hs b/test/ArbitraryTerm.hs deleted file mode 100644 index db649a2bb..000000000 --- a/test/ArbitraryTerm.hs +++ /dev/null @@ -1,76 +0,0 @@ -module ArbitraryTerm where - -import Category -import Control.Comonad.Cofree -import Control.Monad -import Data.Functor.Both -import qualified Data.OrderedMap as Map -import qualified Data.List as List -import qualified Data.Set as Set -import Data.Text.Arbitrary () -import Diff -import Line -import Patch -import Prelude hiding (fst, snd) -import Range -import Source hiding ((++)) -import Syntax -import GHC.Generics -import Term -import Test.QuickCheck hiding (Fixed) - -newtype ArbitraryTerm a annotation = ArbitraryTerm (annotation, Syntax a (ArbitraryTerm a annotation)) - deriving (Show, Eq, Generic) - -unTerm :: ArbitraryTerm a annotation -> Term a annotation -unTerm = unfold unpack - where unpack (ArbitraryTerm (annotation, syntax)) = (annotation, syntax) - -instance (Eq a, Eq annotation, Arbitrary a, Arbitrary annotation) => Arbitrary (ArbitraryTerm a annotation) where - arbitrary = scale (`div` 2) $ sized (\ x -> boundedTerm x x) -- first indicates the cube of the max length of lists, second indicates the cube of the max depth of the tree - where boundedTerm maxLength maxDepth = ArbitraryTerm <$> ((,) <$> arbitrary <*> boundedSyntax maxLength maxDepth) - boundedSyntax _ maxDepth | maxDepth <= 0 = liftM Leaf arbitrary - boundedSyntax maxLength maxDepth = frequency - [ (12, liftM Leaf arbitrary), - (1, liftM Indexed $ take maxLength <$> listOf (smallerTerm maxLength maxDepth)), - (1, liftM Fixed $ take maxLength <$> listOf (smallerTerm maxLength maxDepth)), - (1, liftM (Keyed . Map.fromList) $ take maxLength <$> listOf (arbitrary >>= (\x -> (,) x <$> smallerTerm maxLength maxDepth))) ] - smallerTerm maxLength maxDepth = boundedTerm (div maxLength 3) (div maxDepth 3) - shrink term@(ArbitraryTerm (annotation, syntax)) = (++) (subterms term) $ filter (/= term) $ - ArbitraryTerm <$> ((,) <$> shrink annotation <*> case syntax of - Leaf a -> Leaf <$> shrink a - Indexed i -> Indexed <$> (List.subsequences i >>= recursivelyShrink) - Fixed f -> Fixed <$> (List.subsequences f >>= recursivelyShrink) - Keyed k -> Keyed . Map.fromList <$> (List.subsequences (Map.toList k) >>= recursivelyShrink)) - -data CategorySet = A | B | C | D deriving (Eq, Show) - -instance Categorizable CategorySet where - categories A = Set.fromList [ Other "a" ] - categories B = Set.fromList [ Other "b" ] - categories C = Set.fromList [ Other "c" ] - categories D = Set.fromList [ Other "d" ] - -instance Arbitrary CategorySet where - arbitrary = elements [ A, B, C, D ] - -instance Arbitrary a => Arbitrary (Both a) where - arbitrary = pure (curry Both) <*> arbitrary <*> arbitrary - shrink b = both <$> (shrink (fst b)) <*> (shrink (snd b)) - -instance Arbitrary a => Arbitrary (Line a) where - arbitrary = oneof [ Line <$> arbitrary, Closed <$> arbitrary ] - shrink line = (`lineMap` line) . const <$> shrinkList shrink (unLine line) - -instance Arbitrary a => Arbitrary (Patch a) where - arbitrary = oneof [ - Insert <$> arbitrary, - Delete <$> arbitrary, - Replace <$> arbitrary <*> arbitrary ] - -instance Arbitrary a => Arbitrary (Source a) where - arbitrary = Source.fromList <$> arbitrary - -arbitraryLeaf :: Gen (Source Char, Info, Syntax (Source Char) f) -arbitraryLeaf = toTuple <$> arbitrary - where toTuple string = (string, Info (Range 0 $ length string) mempty, Leaf string) diff --git a/test/CorpusSpec.hs b/test/CorpusSpec.hs index 70bd559df..04d33d2f5 100644 --- a/test/CorpusSpec.hs +++ b/test/CorpusSpec.hs @@ -1,30 +1,32 @@ +{-# 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 Control.DeepSeq -import Data.Functor.Both -import qualified Data.ByteString.Lazy.Char8 as B -import Data.List as List -import Data.Map as Map -import Data.Maybe -import Data.Set as Set -import qualified Data.Text as T -import qualified Data.Text.Lazy as TL -import Prelude hiding (fst, snd) -import qualified Prelude import qualified Source as S import System.FilePath import System.FilePath.Glob -import Test.Hspec +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` return (a == b) `shouldThrow` anyException + 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 @@ -34,39 +36,37 @@ spec = parallel $ do examples "test/diffs/" `shouldNotReturn` [] where - runTestsIn :: String -> (String -> String -> Expectation) -> SpecWith () + runTestsIn :: FilePath -> (Maybe Verbatim -> Maybe Verbatim -> Expectation) -> SpecWith () runTestsIn directory matcher = do paths <- runIO $ examples directory let tests = correctTests =<< paths - mapM_ (\ (formatName, renderer, paths, output) -> it (normalizeName (fst paths) ++ " (" ++ formatName ++ ")") $ testDiff renderer paths output matcher) tests - - correctTests :: (Both FilePath, Maybe FilePath, Maybe FilePath, Maybe FilePath) -> [(String, Renderer a String, Both FilePath, Maybe FilePath)] - correctTests paths@(_, Nothing, Nothing, Nothing) = testsForPaths paths - correctTests paths = List.filter (\(_, _, _, output) -> isJust output) $ testsForPaths paths - testsForPaths :: (Both FilePath, Maybe FilePath, Maybe FilePath, Maybe FilePath) -> [(String, Renderer a String, Both FilePath, Maybe FilePath)] - testsForPaths (paths, json, patch, split) = [ ("json", testJSON, paths, json), ("patch", P.patch, paths, patch), ("split", testSplit, paths, split) ] - testSplit :: Renderer a String - testSplit diff sources = TL.unpack $ Split.split diff sources - testJSON :: Renderer a String - testJSON diff sources = B.unpack $ J.json diff sources + 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 [(Both FilePath, Maybe FilePath, Maybe FilePath, Maybe FilePath)] +examples :: FilePath -> IO [(Maybe FilePath, Maybe FilePath, Maybe FilePath, Maybe FilePath, Maybe FilePath)] examples directory = do - as <- toDict <$> globFor "*.A.*" - bs <- toDict <$> globFor "*.B.*" - jsons <- toDict <$> globFor "*.json.*" - patches <- toDict <$> globFor "*.patch.*" - splits <- toDict <$> globFor "*.split.*" - let keys = Set.unions $ keysSet <$> [as, bs] - return $ (\name -> (Both (as ! name, bs ! name), Map.lookup name jsons, Map.lookup name patches, Map.lookup name splits)) <$> sort (Set.toList keys) + 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 - globFor :: String -> IO [FilePath] + lookupNormalized name = find $ (== name) . normalizeName + globFor :: FilePath -> IO [FilePath] globFor p = globDir1 (compile p) directory - toDict list = Map.fromList ((normalizeName <$> list) `zip` list) -- | Given a test name like "foo.A.js", return "foo.js". normalizeName :: FilePath -> FilePath @@ -75,14 +75,27 @@ normalizeName path = addExtension (dropExtension $ dropExtension path) (takeExte -- | 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 T.Text String -> Both FilePath -> Maybe FilePath -> (String -> String -> Expectation) -> Expectation +testDiff :: Renderer (Record '[Cost, Range, Category, SourceSpan]) -> Both (Maybe FilePath) -> Maybe FilePath -> (Maybe Verbatim -> Maybe Verbatim -> Expectation) -> Expectation testDiff renderer paths diff matcher = do - let parser = parserForFilepath (fst paths) - sources <- sequence $ readAndTranscodeFile <$> paths - let sourceBlobs = Both (S.SourceBlob, S.SourceBlob) <*> sources <*> pure mempty <*> paths <*> pure (Just S.defaultPlainBlob) - actual <- diffFiles parser renderer sourceBlobs + 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 <- readFile file - matcher actual expected + expected <- Verbatim <$> readFile file + matcher actual (Just expected) + where diffFiles' sources parser = diffFiles parser renderer (sourceBlobs sources paths) + parser = parserWithCost <$> runBothWith (<|>) paths + sourceBlobs :: Both (Maybe (S.Source Char)) -> 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 ++) diff --git a/test/Data/Adjoined/Spec.hs b/test/Data/Adjoined/Spec.hs deleted file mode 100644 index 8b77d0168..000000000 --- a/test/Data/Adjoined/Spec.hs +++ /dev/null @@ -1,94 +0,0 @@ -module Data.Adjoined.Spec (spec) where - -import ArbitraryTerm () -import Control.Applicative -import Data.Adjoined -import Data.Coalescent -import Data.Foldable -import Data.Functor.Both -import Data.Typeable -import Line -import Test.Hspec -import Test.Hspec.QuickCheck -import Test.QuickCheck - -spec :: Spec -spec = do - prop "equality is reflexive" $ - \ a -> a `shouldBe` (a :: Adjoined (Uncoalesced Char)) - - monoid (arbitrary :: Gen (Adjoined (Coalesced String))) - monoid (arbitrary :: Gen (Adjoined (Uncoalesced String))) - monoid (arbitrary :: Gen (Adjoined (Semicoalesced String))) - monoid (arbitrary :: Gen (Adjoined (Line Char))) - -- monoid (arbitrary :: Gen (Adjoined (Both (Line Char)))) - -monoid :: (Arbitrary a, Coalescent a, Eq a, Show a, Typeable a) => Gen (Adjoined a) -> Spec -monoid gen = - describe ("Monoid (" ++ showTypeOf (`asGeneratedTypeOf` gen) ++ ")") $ do - describe "mempty" $ do - prop "left identity" $ forAll gen $ - \ a -> mempty `mappend` a `shouldBe` a - - prop "right identity" $ forAll gen $ - \ a -> a `mappend` mempty `shouldBe` a - - describe "mappend" $ do - prop "associativity" $ forAll gen $ - \ a b c -> (a `mappend` b) `mappend` c `shouldBe` a `mappend` (b `mappend` c) - - -instance Arbitrary a => Arbitrary (Adjoined a) where - arbitrary = fromList <$> arbitrary - shrink arbitrary = fromList <$> shrinkList shrink (toList arbitrary) - - --- | A wrapper which never coalesces values. -newtype Uncoalesced a = Uncoalesced { runUncoalesced :: a } - deriving (Eq, Show) - -instance Arbitrary a => Arbitrary (Uncoalesced a) where - arbitrary = Uncoalesced <$> arbitrary - -instance Coalescent (Uncoalesced a) where - coalesce a b = pure a <|> pure b - - --- | A wrapper which always coalesces values. -newtype Coalesced a = Coalesced { runCoalesced :: a } - deriving (Eq, Show) - -instance Arbitrary a => Arbitrary (Coalesced a) where - arbitrary = Coalesced <$> arbitrary - -instance Monoid a => Coalescent (Coalesced a) where - coalesce a b = pure (Coalesced (runCoalesced a `mappend` runCoalesced b)) - - --- | A wrapper which coalesces asymmetrically. --- | --- | Specifically, it coalesces only when the value at the left has `True` set. -newtype Semicoalesced a = Semicoalesced { runSemicoalesced :: (Bool, a) } - deriving (Eq, Show) - -instance Arbitrary a => Arbitrary (Semicoalesced a) where - arbitrary = Semicoalesced <$> arbitrary - -instance Monoid a => Coalescent (Semicoalesced a) where - Semicoalesced (True, a) `coalesce` Semicoalesced (flag, b) = pure (Semicoalesced (flag, a `mappend` b)) - a `coalesce` b = pure a <|> pure b - - --- | Returns a string with the name of a type. --- | --- | Use with `asTypeOf` or `asGeneratedTypeOf` to show type names for parameters without fighting type variable scoping: --- | --- | showTypeOf (`asTypeOf` someTypeParametricValue) -showTypeOf :: Typeable a => (a -> a) -> String -showTypeOf f = show (typeRep (proxyOf f)) - where proxyOf :: (a -> a) -> Proxy a - proxyOf _ = Proxy - --- | Type-restricted `const`, usually written infix or as an operator section with `showTypeOf`. -asGeneratedTypeOf :: a -> Gen a -> a -asGeneratedTypeOf = const diff --git a/test/Data/Functor/Both/Spec.hs b/test/Data/Functor/Both/Spec.hs deleted file mode 100644 index dba945953..000000000 --- a/test/Data/Functor/Both/Spec.hs +++ /dev/null @@ -1,22 +0,0 @@ -module Data.Functor.Both.Spec (spec) where - -import Data.Adjoined -import Data.Coalescent -import Data.Functor.Both -import Line -import Test.Hspec - -spec :: Spec -spec = do - describe "Coalescent" $ do - it "should coalesce when both sides coalesce" $ - (pure (Line [True]) `coalesce` pure (Line [True]) :: Adjoined (Both (Line Bool))) `shouldBe` fromList [pure (Line [True, True])] - - it "should not coalesce when neither side coalesces" $ - (pure (Closed [True]) `coalesce` pure (Line [True]) :: Adjoined (Both (Line Bool))) `shouldBe` fromList [pure (Closed [True]), pure (Line [True])] - - it "should coalesce asymmetrically at left" $ - (both (Line [True]) (Closed [True]) `coalesce` pure (Line [True]) :: Adjoined (Both (Line Bool))) `shouldBe` fromList [both (Line []) (Closed [True]), both (Line [True, True]) (Line [True])] - - it "should coalesce asymmetrically at right" $ - (both (Closed [True]) (Line [True]) `coalesce` pure (Line [True]) :: Adjoined (Both (Line Bool))) `shouldBe` fromList [both (Closed [True]) (Line []), both (Line [True]) (Line [True, True])] diff --git a/test/Data/Mergeable/Spec.hs b/test/Data/Mergeable/Spec.hs new file mode 100644 index 000000000..8aba89d5c --- /dev/null +++ b/test/Data/Mergeable/Spec.hs @@ -0,0 +1,63 @@ +{-# LANGUAGE RankNTypes, ScopedTypeVariables #-} +module Data.Mergeable.Spec where + +import Data.Functor.Identity +import Data.Functor.Listable +import Data.Mergeable +import Data.String (String) +import GHC.Show +import Prologue +import Syntax +import Test.Hspec +import Test.Hspec.LeanCheck +import Test.LeanCheck + +spec :: Spec +spec = parallel $ do + describe "[]" $ do + withAlternativeInstances sequenceAltLaws (tiers :: [Tier String]) + withAlternativeInstances mergeLaws (tiers :: [Tier String]) + describe "Maybe" $ do + withAlternativeInstances sequenceAltLaws (tiers :: [Tier (Maybe Char)]) + withAlternativeInstances mergeLaws (tiers :: [Tier (Maybe Char)]) + describe "Identity" $ do + withAlternativeInstances sequenceAltLaws (Identity `mapT` tiers :: [Tier (Identity Char)]) + withAlternativeInstances mergeLaws (Identity `mapT` tiers :: [Tier (Identity Char)]) + describe "Syntax" $ do + withAlternativeInstances sequenceAltLaws (tiers :: [Tier (Syntax Char Char)]) + withAlternativeInstances mergeLaws (tiers :: [Tier (Syntax Char Char)]) + + prop "subsumes catMaybes/Just" $ + \ a -> sequenceAlt a `shouldBe` pure (catMaybes (a :: [Maybe Char])) + +mergeLaws :: forall f g a. (Mergeable f, Alternative g, Eq (g (f a)), Show (f a), Show (g (f a))) => [Tier (f a)] -> [Tier (Blind (a -> g a))] -> Spec +mergeLaws value function = describe "merge" $ do + prop "identity" . forAll value $ + \ a -> merge pure a `shouldNotBe` (empty :: g (f a)) + + prop "relationship with sequenceAlt" . forAll (value >< function) $ + \ (a, f) -> merge (getBlind f) a `shouldBe` sequenceAlt (fmap (getBlind f) a) + +sequenceAltLaws :: forall f g a. (Mergeable f, Alternative g, Eq (g (f a)), Show (f a), Show (g (f a))) => [Tier (f a)] -> [Tier (Blind (a -> g a))] -> Spec +sequenceAltLaws value function = describe "sequenceAlt" $ do + prop "identity" . forAll value $ + \ a -> sequenceAlt (pure <$> a) `shouldNotBe` (empty :: g (f a)) + + prop "relationship with merge" . forAll (productWith ((Blind .) . fmap . getBlind) function value :: [Tier (Blind (f (g a)))]) $ + \ a -> sequenceAlt (getBlind a) `shouldBe` merge identity (getBlind a) + + +withAlternativeInstances :: forall f a. (Listable a, Eq (f a), Show (f a)) => (forall g. (Alternative g, Eq (g (f a)), Show (g (f a))) => [Tier (f a)] -> [Tier (Blind (a -> g a))] -> Spec) -> [Tier (f a)] -> Spec +withAlternativeInstances laws gen = do + describe "[]" $ laws gen (fmap const `mapT` tiers :: [Tier (Blind (a -> [a]))]) + describe "Maybe" $ laws gen (fmap const `mapT` tiers :: [Tier (Blind (a -> Maybe a))]) + + +newtype Blind a = Blind { getBlind :: a } + deriving Functor + +instance Listable a => Listable (Blind a) where + tiers = Blind `mapT` tiers + +instance Show (Blind a) where + showsPrec _ _ = showString "*" diff --git a/test/Data/RandomWalkSimilarity/Spec.hs b/test/Data/RandomWalkSimilarity/Spec.hs new file mode 100644 index 000000000..fed1e733e --- /dev/null +++ b/test/Data/RandomWalkSimilarity/Spec.hs @@ -0,0 +1,51 @@ +{-# LANGUAGE DataKinds #-} +module Data.RandomWalkSimilarity.Spec where + +import Category +import Data.Functor.Both +import Data.Functor.Listable +import Data.RandomWalkSimilarity +import Data.Record +import Data.String +import Diff +import Info +import Patch +import Prologue +import Syntax +import Term +import Test.Hspec +import Test.Hspec.LeanCheck + +spec :: Spec +spec = parallel $ do + let positively = succ . abs + describe "pqGramDecorator" $ do + prop "produces grams with stems of the specified length" $ + \ (term, p, q) -> pqGramDecorator (rhead . headF) (positively p) (positively q) (unListableF term :: SyntaxTerm String '[Category]) `shouldSatisfy` all ((== positively p) . length . stem . rhead) + + prop "produces grams with bases of the specified width" $ + \ (term, p, q) -> pqGramDecorator (rhead . headF) (positively p) (positively q) (unListableF term :: SyntaxTerm String '[Category]) `shouldSatisfy` all ((== positively q) . length . base . rhead) + + describe "featureVectorDecorator" $ do + prop "produces a vector of the specified dimension" $ + \ (term, p, q, d) -> featureVectorDecorator (rhead . headF) (positively p) (positively q) (positively d) (unListableF term :: SyntaxTerm String '[Category]) `shouldSatisfy` all ((== positively d) . length . rhead) + + describe "rws" $ do + prop "produces correct diffs" $ + \ (as, bs) -> let tas = decorate <$> (unListableF <$> as :: [SyntaxTerm String '[Category]]) + tbs = decorate <$> (unListableF <$> bs :: [SyntaxTerm String '[Category]]) + root = cofree . ((Program :. Nil) :<) . Indexed + diff = wrap (pure (Program :. Nil) :< Indexed (stripDiff <$> rws compare tas tbs)) in + (beforeTerm diff, afterTerm diff) `shouldBe` (Just (root (stripTerm <$> tas)), Just (root (stripTerm <$> tbs))) + + it "produces unbiased insertions within branches" $ + let (a, b) = (decorate (cofree ((StringLiteral :. Nil) :< Indexed [ cofree ((StringLiteral :. Nil) :< Leaf ("a" :: Text)) ])), decorate (cofree ((StringLiteral :. Nil) :< Indexed [ cofree ((StringLiteral :. Nil) :< Leaf "b") ]))) in + fmap stripDiff (rws compare [ b ] [ a, b ]) `shouldBe` fmap stripDiff [ inserting a, copying b ] + + where compare :: (HasField fields Category, Functor f, Eq (Cofree f Category)) => Term f (Record fields) -> Term f (Record fields) -> Maybe (Diff f (Record fields)) + compare a b | (category <$> a) == (category <$> b) = Just (copying b) + | otherwise = if ((==) `on` category . extract) a b then Just (replacing a b) else Nothing + copying :: Functor f => Cofree f (Record fields) -> Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields))) + copying = cata wrap . fmap pure + decorate :: SyntaxTerm leaf '[Category] -> SyntaxTerm leaf '[Maybe FeatureVector, Category] + decorate = defaultFeatureVectorDecorator (category . headF) diff --git a/test/Diff/Spec.hs b/test/Diff/Spec.hs new file mode 100644 index 000000000..7d8feded0 --- /dev/null +++ b/test/Diff/Spec.hs @@ -0,0 +1,40 @@ +{-# LANGUAGE DataKinds #-} +module Diff.Spec where + +import Category +import Data.Bifunctor.Join +import Data.Functor.Listable +import Data.RandomWalkSimilarity +import Data.String +import Diff +import Info +import Interpreter +import Patch +import Prologue +import Term +import Test.Hspec +import Test.Hspec.LeanCheck + +spec :: Spec +spec = parallel $ do + let decorate = defaultFeatureVectorDecorator (category . headF) + prop "equality is reflexive" $ + \ a -> let diff = unListableDiff a :: SyntaxDiff String '[Category] in + diff `shouldBe` diff + + prop "equal terms produce identity diffs" $ + \ a -> let term = decorate (unListableF a :: SyntaxTerm String '[Category]) in + diffCost (diffTerms wrap (==) diffCost term term) `shouldBe` 0 + + describe "beforeTerm" $ do + prop "recovers the before term" $ + \ a b -> let diff = stripDiff $ diffTerms wrap (==) diffCost (decorate (unListableF a)) (decorate (unListableF b :: SyntaxTerm String '[Category])) in + beforeTerm diff `shouldBe` Just (unListableF a) + + describe "afterTerm" $ do + prop "recovers the after term" $ + \ a b -> let diff = stripDiff $ diffTerms wrap (==) diffCost (decorate (unListableF a)) (decorate (unListableF b :: SyntaxTerm String '[Category])) in + afterTerm diff `shouldBe` Just (unListableF b) + +unListableDiff :: Functor f => ListableF (Free (TermF f (ListableF (Join (,)) annotation))) (Patch (ListableF (Term f) annotation)) -> Diff f annotation +unListableDiff diff = transFreeT (first unListableF) $ fmap unListableF <$> unListableF diff diff --git a/test/DiffSummarySpec.hs b/test/DiffSummarySpec.hs new file mode 100644 index 000000000..f305dd1b8 --- /dev/null +++ b/test/DiffSummarySpec.hs @@ -0,0 +1,102 @@ +{-# LANGUAGE DataKinds #-} +module DiffSummarySpec where + +import Category +import Data.Functor.Both +import Data.Functor.Listable +import Data.List (partition) +import Data.RandomWalkSimilarity +import Data.Record +import Data.String +import Diff +import DiffSummary +import Info +import Interpreter +import Patch +import Prologue +import Source +import Syntax +import Term +import Test.Hspec (Spec, describe, it, parallel) +import Test.Hspec.Expectations.Pretty +import Test.Hspec.LeanCheck +import Data.These + +sourceSpanBetween :: (Int, Int) -> (Int, Int) -> SourceSpan +sourceSpanBetween (s1, e1) (s2, e2) = SourceSpan (SourcePos s1 e1) (SourcePos s2 e2) + +arrayInfo :: Record '[Category, Range, SourceSpan] +arrayInfo = ArrayLiteral :. Range 0 3 :. sourceSpanBetween (1, 1) (1, 5) :. Nil + +literalInfo :: Record '[Category, Range, SourceSpan] +literalInfo = StringLiteral :. Range 1 2 :. sourceSpanBetween (1, 2) (1, 4) :. Nil + +testDiff :: Diff (Syntax Text) (Record '[Category, Range, SourceSpan]) +testDiff = free $ Free (pure arrayInfo :< Indexed [ free $ Pure (Insert (cofree $ literalInfo :< Leaf "\"a\"")) ]) + +testSummary :: DiffSummary DiffInfo +testSummary = DiffSummary { patch = Insert (LeafInfo StringLiteral "a" $ sourceSpanBetween (1,1) (1, 2)), parentAnnotation = [] } + +replacementSummary :: DiffSummary DiffInfo +replacementSummary = DiffSummary { patch = Replace (LeafInfo StringLiteral "a" $ sourceSpanBetween (1, 2) (1, 4)) (LeafInfo SymbolLiteral "b" $ sourceSpanBetween (1,1) (1, 2)), parentAnnotation = [Left (Info.FunctionCall, "foo")] } + +blobs :: Both SourceBlob +blobs = both (SourceBlob (fromText "[]") nullOid "a.js" (Just defaultPlainBlob)) (SourceBlob (fromText "[a]") nullOid "b.js" (Just defaultPlainBlob)) + +spec :: Spec +spec = parallel $ do + describe "diffSummaries" $ do + it "outputs a diff summary" $ + diffSummaries blobs testDiff `shouldBe` [ JSONSummary "Added the \"a\" string" (SourceSpans . That $ sourceSpanBetween (1, 2) (1, 4)) ] + + prop "equal terms produce identity diffs" $ + \ a -> let term = defaultFeatureVectorDecorator (category . headF) (unListableF a :: SyntaxTerm String '[Category, Range, SourceSpan]) in + diffSummaries blobs (diffTerms wrap (==) diffCost term term) `shouldBe` [] + + describe "DiffInfo" $ do + prop "patches in summaries match the patches in diffs" $ + \a -> let + diff = unListableDiff a :: SyntaxDiff String '[Category, Cost, Range, SourceSpan] + summaries = diffToDiffSummaries (source <$> blobs) diff + patches = toList diff + in + case (partition isBranchNode (patch <$> summaries), partition isIndexedOrFixed patches) of + ((branchPatches, otherPatches), (branchDiffPatches, otherDiffPatches)) -> + (() <$ branchPatches, () <$ otherPatches) `shouldBe` (() <$ branchDiffPatches, () <$ otherDiffPatches) + prop "generates one LeafInfo for each child in an arbitrary branch patch" $ + \a -> let + diff = unListableDiff a :: SyntaxDiff String '[Category, Range, SourceSpan] + diffInfoPatches = patch <$> diffToDiffSummaries (source <$> blobs) diff + syntaxPatches = toList diff + extractLeaves :: DiffInfo -> [DiffInfo] + extractLeaves (BranchInfo children _ _) = join $ extractLeaves <$> children + extractLeaves leaf = [ leaf ] + + extractDiffLeaves :: SyntaxTerm String '[Category, Range, SourceSpan] -> [ SyntaxTerm String '[Category, Range, SourceSpan] ] + extractDiffLeaves term = case unwrap term of + (Indexed children) -> join $ extractDiffLeaves <$> children + (Fixed children) -> join $ extractDiffLeaves <$> children + Commented children leaf -> children <> maybeToList leaf >>= extractDiffLeaves + _ -> [ term ] + in + case (partition isBranchNode diffInfoPatches, partition isIndexedOrFixed syntaxPatches) of + ((branchPatches, _), (diffPatches, _)) -> + let listOfLeaves = foldMap extractLeaves (join $ toList <$> branchPatches) + listOfDiffLeaves = foldMap extractDiffLeaves (diffPatches >>= toList) + in + length listOfLeaves `shouldBe` length listOfDiffLeaves + +isIndexedOrFixed :: Patch (Term (Syntax a) annotation) -> Bool +isIndexedOrFixed = any (isIndexedOrFixed' . unwrap) + +isIndexedOrFixed' :: Syntax a f -> Bool +isIndexedOrFixed' syntax = case syntax of + (Indexed _) -> True + (Fixed _) -> True + _ -> False + +isBranchNode :: Patch DiffInfo -> Bool +isBranchNode = any isBranchInfo + +unListableDiff :: Functor f => ListableF (Free (TermF f (ListableF (Join (,)) annotation))) (Patch (ListableF (Term f) annotation)) -> Diff f annotation +unListableDiff diff = transFreeT (first unListableF) $ fmap unListableF <$> unListableF diff diff --git a/test/IntegrationFormatSpec.hs b/test/IntegrationFormatSpec.hs new file mode 100644 index 000000000..b8765019c --- /dev/null +++ b/test/IntegrationFormatSpec.hs @@ -0,0 +1,61 @@ +module IntegrationFormatSpec where + +import Arguments +import Data.Aeson +import Data.List.Split +import Control.Exception +import qualified Data.ByteString.Lazy as DL +import JSONTestCase +import Test.Hspec (Spec, describe, it, SpecWith, runIO, parallel) +import Prelude +import Prologue +import Renderer +import SemanticDiff +import System.FilePath.Glob +import Data.Maybe (fromJust) +import Test.Hspec.Expectations.Pretty + +catchException :: IO [Text] -> IO [Text] +catchException = handle errorHandler + where errorHandler :: (SomeException -> IO [Text]) + errorHandler exception = return [toS . encode $ ["Crashed: " <> Prologue.show exception :: Text]] + +assertDiffSummary :: JSONTestCase -> Format -> (Either String ExpectedResult -> Either String ExpectedResult -> Expectation) -> Expectation +assertDiffSummary JSONTestCase {..} format matcher = do + diffs <- fetchDiffs $ args gitDir (Prelude.head shas') (Prelude.last shas') filePaths format + result <- catchException . pure . pure . concatOutputs $ diffs + let actual = eitherDecode . DL.fromStrict . encodeUtf8 . fromJust . listToMaybe $ result + matcher actual (Right expectedResult) + where shas' = splitOn ".." shas + +runTestsIn :: [FilePath] -> Format -> (Either String ExpectedResult -> Either String ExpectedResult -> Expectation) -> SpecWith () +runTestsIn filePaths format matcher = do + contents <- runIO $ traverse DL.readFile filePaths + let filePathContents = zip filePaths contents + let jsonContents = (\(filePath, content) -> (filePath, eitherDecode content)) <$> filePathContents :: [(FilePath, Either String [JSONTestCase])] + traverse_ handleJSONTestCase jsonContents + where handleJSONTestCase :: (FilePath, Either String [JSONTestCase]) -> SpecWith () + handleJSONTestCase (filePath, eitherJSONTestCase) = + case eitherJSONTestCase of + Left err -> it ("An error occurred " <> err <> " (" <> filePath <> ")") $ True `shouldBe` False + Right testCases -> traverse_ (\testCase -> it (testCaseDescription testCase) $ assertDiffSummary testCase format matcher) testCases + +spec :: Maybe String -> Spec +spec maybeLanguage = parallel $ do + summaryFormatFiles <- runIO $ testCaseFiles maybeLanguage "test/corpus/diff-summaries" + summaryFormatToDoFiles <- runIO $ testCaseFiles maybeLanguage "test/corpus/diff-summaries-todo" + summaryFormatCrasherFiles <- runIO $ testCaseFiles maybeLanguage "test/corpus/diff-summary-crashers" + + jsonFormatFiles <- runIO $ testCaseFiles maybeLanguage "test/corpus/json" + + describe "Summary format" $ runTestsIn summaryFormatFiles Summary shouldBe + describe "Summary format todo" $ runTestsIn summaryFormatToDoFiles Summary shouldNotBe + describe "Summary format crashers todo" $ runTestsIn summaryFormatCrasherFiles Summary shouldBe + + describe "JSON format" $ runTestsIn jsonFormatFiles JSON shouldBe + + where + testCaseFiles :: Maybe String -> String -> IO [FilePath] + testCaseFiles maybeLanguage dir = case maybeLanguage of + Just language -> globDir1 (compile (language <> "/*.json")) dir + Nothing -> globDir1 (compile "*/*.json") dir diff --git a/test/InterpreterSpec.hs b/test/InterpreterSpec.hs index cbcc50c5c..32b5626da 100644 --- a/test/InterpreterSpec.hs +++ b/test/InterpreterSpec.hs @@ -1,22 +1,44 @@ +{-# LANGUAGE DataKinds #-} module InterpreterSpec where -import qualified Interpreter as I -import Range -import Syntax -import Control.Comonad.Cofree -import Control.Monad.Free -import Patch -import Diff import Category -import Test.Hspec +import Data.Array +import Data.Functor.Foldable hiding (Nil) +import Data.Functor.Listable +import Data.RandomWalkSimilarity +import Data.Record +import Data.String +import Diff +import Info +import Interpreter +import Patch +import Prologue +import Syntax +import Term +import Test.Hspec (Spec, describe, it, parallel) +import Test.Hspec.Expectations.Pretty +import Test.Hspec.LeanCheck spec :: Spec spec = parallel $ do describe "interpret" $ do + let decorate = defaultFeatureVectorDecorator (category . headF) + let compare = (==) `on` category . extract it "returns a replacement when comparing two unicode equivalent terms" $ - I.interpret comparable (Info range mempty :< Leaf "t\776") (Info range2 mempty :< Leaf "\7831") `shouldBe` - Pure (Replace (Info range mempty :< Leaf "t\776") (Info range2 mempty :< Leaf "\7831")) + let termA = cofree $ (StringLiteral :. Nil) :< Leaf ("t\776" :: String) + termB = cofree $ (StringLiteral :. Nil) :< Leaf "\7831" in + stripDiff (diffTerms wrap compare diffCost (decorate termA) (decorate termB)) `shouldBe` replacing termA termB - where - range = Range 0 2 - range2 = Range 0 1 + prop "produces correct diffs" $ + \ a b -> let diff = stripDiff $ diffTerms wrap compare diffCost (decorate (unListableF a)) (decorate (unListableF b :: SyntaxTerm String '[Category])) in + (beforeTerm diff, afterTerm diff) `shouldBe` (Just (unListableF a), Just (unListableF b)) + + prop "constructs zero-cost diffs of equal terms" $ + \ a -> let term = decorate (unListableF a :: SyntaxTerm String '[Category]) + diff = diffTerms wrap compare diffCost term term in + diffCost diff `shouldBe` 0 + + it "produces unbiased insertions within branches" $ + let term s = decorate (cofree ((StringLiteral :. Nil) :< Indexed [ cofree ((StringLiteral :. Nil) :< Leaf s) ])) + root = cofree . ((Just (listArray (0, defaultD) (repeat 0)) :. Program :. Nil) :<) . Indexed in + stripDiff (diffTerms wrap compare diffCost (root [ term "b" ]) (root [ term "a", term "b" ])) `shouldBe` wrap (pure (Program :. Nil) :< Indexed [ inserting (stripTerm (term "a")), cata wrap (fmap pure (stripTerm (term "b"))) ]) diff --git a/test/JSONTestCase.hs b/test/JSONTestCase.hs new file mode 100644 index 000000000..9020a1406 --- /dev/null +++ b/test/JSONTestCase.hs @@ -0,0 +1,69 @@ +{-# LANGUAGE DeriveAnyClass, OverloadedStrings #-} +module JSONTestCase where + +import Data.Aeson +import Data.Aeson.Types +import Data.Map.Strict as Map +import Data.HashMap.Strict as HM +import Prelude +import Prologue + +data JSONMetaRepo = JSONMetaRepo { repoUrl :: !String + , language :: !String + , fileExt :: !String + , syntaxes :: ![JSONMetaSyntax] + , templateText :: !(Maybe String) + } deriving (Show, Generic, FromJSON) + +data JSONMetaSyntax = JSONMetaSyntax { template :: !(Maybe String) + , syntax :: !String + , insert :: !String + , replacement :: !String + } deriving (Show, Generic, FromJSON) + +data JSONTestCase = JSONTestCase { gitDir :: !String + , testCaseDescription :: !String + , filePaths :: ![String] + , shas :: !String + , patch :: ![String] + , expectedResult :: !ExpectedResult + } deriving (Show, Generic, FromJSON) + +data ExpectedResult = SummaryResult (Map Text (Map Text [Value])) + | JSONResult (Map Text Value) + deriving (Show, Generic, Eq) + +-- | These replace the defaultOptions normally used by genericToEncoding. +-- | All options are default except for `sumEncoding`, which uses the `UntaggedValue` +-- | option to prevent the sum type `ExpectedResult` from encoding with a `tag` and `contents` +-- | fields when a JSONTestCase is encoded. +jsonTestCaseOptions :: Options +jsonTestCaseOptions = Options { fieldLabelModifier = id + , constructorTagModifier = id + , allNullaryToStringTag = False + , omitNothingFields = True + , sumEncoding = UntaggedValue + , unwrapUnaryRecords = False + } + +instance ToJSON JSONTestCase where + toJSON = genericToJSON jsonTestCaseOptions + toEncoding = genericToEncoding jsonTestCaseOptions + +instance ToJSON ExpectedResult where + toJSON = genericToJSON jsonTestCaseOptions + toEncoding = genericToEncoding jsonTestCaseOptions + +-- | We have to parse the specific formats of the ExpectedResults based on their keys. +-- | This is how we determine which ExpectedResult constructor to use. +instance FromJSON ExpectedResult where + parseJSON = Data.Aeson.withObject "ExpectedResult" $ \o -> + SummaryResult <$> summaryResultValues o <|> + JSONResult <$> jsonResultValues o + where + jsonResultValues :: Object -> Parser (Map Text Value) + jsonResultValues o = Map.fromList <$> (fromKey "oids" <> fromKey "rows" <> fromKey "paths") + where fromKey k = (\a -> [(k, a)]) <$> o .: k + summaryResultValues :: Object -> Parser (Map Text (Map Text [Value])) + summaryResultValues o = Map.fromList <$> (fromKey "changes" <> fromKey "errors") + where fromKey k = (\a -> [(k :: Text, Map.fromList . HM.toList $ a )] ) <$> o .: k diff --git a/test/OrderedMapSpec.hs b/test/OrderedMapSpec.hs deleted file mode 100644 index 482ab99a1..000000000 --- a/test/OrderedMapSpec.hs +++ /dev/null @@ -1,44 +0,0 @@ -module OrderedMapSpec where - -import qualified Data.OrderedMap as Map -import Test.Hspec - -spec :: Spec -spec = parallel $ do - describe "difference" $ do - it "should return those elements of a not in b" $ - Map.difference a b `shouldBe` Map.fromList [ ("a", 1) ] - - it "is asymmetrical" $ - Map.difference a b `shouldNotBe` Map.difference b a - - describe "union" $ do - it "should return those elements in either a or b" $ - Map.union a b `shouldBe` Map.fromList (Map.toList a ++ [ ("d", -4) ]) - - it "is asymmetrical" $ - Map.union a b `shouldNotBe` Map.union b a - - describe "unions" $ do - it "is equivalent to `union` for two maps" $ - Map.unions [ a, b ] `shouldBe` Map.union a b - - it "does not duplicate elements" $ - Map.unions [ a, b, a, b, a, b ] `shouldBe` Map.union a b - - describe "intersectionWith" $ do - it "should return those elements in both a and b, combined with a function" $ - Map.intersectionWith (-) a b `shouldBe` Map.fromList [ ("b", 4), ("c", 6) ] - - it "is asymmetrical" $ - Map.intersectionWith (-) a b `shouldNotBe` Map.intersectionWith (-) b a - - describe "keys" $ do - it "should return all the keys in a map" $ - Map.keys a `shouldBe` [ "a", "b", "c" ] - - it "is ordered" $ - Map.keys (Map.union b a) `shouldBe` [ "b", "c", "d", "a" ] - - where a = Map.fromList [ ("a", 1), ("b", 2), ("c", 3) ] - b = Map.fromList [ ("b", -2), ("c", -3), ("d", -4) ] diff --git a/test/PatchOutputSpec.hs b/test/PatchOutputSpec.hs index 892394c3c..c0d674979 100644 --- a/test/PatchOutputSpec.hs +++ b/test/PatchOutputSpec.hs @@ -1,16 +1,17 @@ module PatchOutputSpec where +import Prologue import Data.Functor.Both -import Diff -import Renderer.Patch +import Data.Record import Range +import Renderer.Patch import Source import Syntax -import Control.Monad.Free -import Test.Hspec +import Test.Hspec (Spec, describe, it, parallel) +import Test.Hspec.Expectations.Pretty spec :: Spec -spec = parallel $ - describe "hunks" $ +spec = parallel $ do + describe "hunks" $ do it "empty diffs have empty hunks" $ - hunks (Free . Annotated (pure (Info (Range 0 0) mempty)) $ Leaf "") (Both (SourceBlob (fromList "") "abcde" "path2.txt" (Just defaultPlainBlob), SourceBlob (fromList "") "xyz" "path2.txt" (Just defaultPlainBlob))) `shouldBe` [Hunk {offset = Both (0, 0), changes = [], trailingContext = []}] + hunks (wrap $ pure (Range 0 0 :. Nil) :< Leaf ("" :: Text)) (both (SourceBlob (fromList "") "abcde" "path2.txt" (Just defaultPlainBlob)) (SourceBlob (fromList "") "xyz" "path2.txt" (Just defaultPlainBlob))) `shouldBe` [Hunk {offset = pure 0, changes = [], trailingContext = []}] diff --git a/test/RangeSpec.hs b/test/RangeSpec.hs index 4d541e625..21f64b7a6 100644 --- a/test/RangeSpec.hs +++ b/test/RangeSpec.hs @@ -1,7 +1,9 @@ module RangeSpec where -import Test.Hspec +import Prologue import Range +import Test.Hspec (Spec, describe, it, parallel) +import Test.Hspec.Expectations.Pretty spec :: Spec spec = parallel $ do diff --git a/test/Source/Spec.hs b/test/Source/Spec.hs new file mode 100644 index 000000000..e767a3ebc --- /dev/null +++ b/test/Source/Spec.hs @@ -0,0 +1,53 @@ +module Source.Spec where + +import qualified Prelude +import Prologue +import Range +import Source +import SourceSpan +import Test.Hspec +import Test.Hspec.QuickCheck + +spec :: Spec +spec = parallel $ do + describe "actualLineRanges" $ do + prop "produces 1 more range than there are newlines" $ + \ s -> length (actualLineRanges (totalRange s) (fromList s)) `shouldBe` succ (length (filter (== '\n') s)) + + prop "produces exhaustive ranges" $ + \ s -> let source = fromList s in + foldMap (`slice` source) (actualLineRanges (totalRange s) source) `shouldBe` source + + describe "sourceSpanToRange" $ do + prop "computes single-line ranges" $ + \ s -> let source = fromList s + spans = zipWith (\ i Range {..} -> SourceSpan (SourcePos i 0) (SourcePos i (end - start))) [0..] ranges + ranges = actualLineRanges (totalRange source) source in + sourceSpanToRange source <$> spans `shouldBe` ranges + + prop "computes multi-line ranges" $ + \ s -> let source = fromList s in + sourceSpanToRange source (totalSpan source) `shouldBe` totalRange source + + prop "computes sub-line ranges" $ + \ s -> let source = fromList ('*' : s <> "*") in + sourceSpanToRange source (insetSpan (totalSpan source)) `shouldBe` insetRange (totalRange source) + + describe "totalSpan" $ do + prop "covers single lines" $ + \ n -> totalSpan (fromList (replicate n '*')) `shouldBe` SourceSpan (SourcePos 0 0) (SourcePos 0 (max 0 n)) + + prop "covers multiple lines" $ + \ n -> totalSpan (fromList (intersperse '\n' (replicate n '*'))) `shouldBe` SourceSpan (SourcePos 0 0) (SourcePos (max 0 (pred n)) (if n > 0 then 1 else 0)) + +totalSpan :: Source Char -> SourceSpan +totalSpan source = SourceSpan (SourcePos 0 0) (SourcePos (pred (length ranges)) (end lastRange - start lastRange)) + where ranges = actualLineRanges (totalRange source) source + lastRange = Prelude.last ranges + +insetSpan :: SourceSpan -> SourceSpan +insetSpan sourceSpan = sourceSpan { spanStart = (spanStart sourceSpan) { column = succ (column (spanStart sourceSpan)) } + , spanEnd = (spanEnd sourceSpan) { column = pred (column (spanEnd sourceSpan)) } } + +insetRange :: Range -> Range +insetRange Range {..} = Range (succ start) (pred end) diff --git a/test/Spec.hs b/test/Spec.hs index 0f6609a7a..71480f5b5 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1,22 +1,29 @@ module Main where +import Prologue import qualified AlignmentSpec import qualified CorpusSpec -import qualified Data.Adjoined.Spec -import qualified Data.Functor.Both.Spec +import qualified Data.Mergeable.Spec +import qualified Data.RandomWalkSimilarity.Spec +import qualified Diff.Spec +import qualified DiffSummarySpec import qualified InterpreterSpec -import qualified OrderedMapSpec import qualified PatchOutputSpec +import qualified RangeSpec +import qualified Source.Spec import qualified TermSpec import Test.Hspec main :: IO () -main = hspec $ parallel $ do +main = hspec . parallel $ do describe "Alignment" AlignmentSpec.spec describe "Corpus" CorpusSpec.spec - describe "Data.Adjoined" Data.Adjoined.Spec.spec - describe "Data.Functor.Both" Data.Functor.Both.Spec.spec + describe "Data.Mergeable" Data.Mergeable.Spec.spec + describe "Data.RandomWalkSimilarity" Data.RandomWalkSimilarity.Spec.spec + describe "Diff.Spec" Diff.Spec.spec + describe "DiffSummary" DiffSummarySpec.spec describe "Interpreter" InterpreterSpec.spec - describe "OrderedMap" OrderedMapSpec.spec describe "PatchOutput" PatchOutputSpec.spec + describe "Range" RangeSpec.spec + describe "Source" Source.Spec.spec describe "Term" TermSpec.spec diff --git a/test/SpecIntegration.hs b/test/SpecIntegration.hs new file mode 100644 index 000000000..fb56fbbcf --- /dev/null +++ b/test/SpecIntegration.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE FlexibleContexts #-} +module Main where + +import Prologue +import Prelude (String) +import Data.List +import Data.List.Utils +import qualified IntegrationFormatSpec +import Test.Hspec +import System.Environment (withArgs) + +main :: IO () +main = do + args <- getArgs + let (language, rest) = parseCustomArgs args + withArgs rest . hspec . parallel $ describe "Integration Format Specs" (IntegrationFormatSpec.spec language) + where + parseCustomArgs :: [String] -> (Maybe String, [String]) + parseCustomArgs args = case partitioned of + (l:_, rest) -> (toLang l, rest) + _ -> (Nothing, args) + where + partitioned = partition (startswith "--language") args + toLang s = Just $ replace "--language=" "" s diff --git a/test/TermSpec.hs b/test/TermSpec.hs index 354266192..14dddfa75 100644 --- a/test/TermSpec.hs +++ b/test/TermSpec.hs @@ -1,25 +1,17 @@ +{-# LANGUAGE DataKinds #-} module TermSpec where -import Test.Hspec -import Test.Hspec.QuickCheck -import Data.Text.Arbitrary () - import Category -import Interpreter -import Diff -import ArbitraryTerm +import Data.Functor.Listable +import Data.String (String) +import Prologue +import Term +import Test.Hspec (Spec, describe, parallel) +import Test.Hspec.Expectations.Pretty +import Test.Hspec.LeanCheck spec :: Spec spec = parallel $ do describe "Term" $ do prop "equality is reflexive" $ - \ a -> unTerm a == unTerm (a :: ArbitraryTerm String ()) - - describe "Diff" $ do - prop "equality is reflexive" $ - \ a b -> let diff = interpret comparable (unTerm a) (unTerm (b :: ArbitraryTerm String CategorySet)) in - diff == diff - - prop "equal terms produce identity diffs" $ - \ a -> let term = unTerm (a :: ArbitraryTerm String CategorySet) in - diffCost (interpret comparable term term) == 0 + \ a -> unListableF a `shouldBe` (unListableF a :: SyntaxTerm String '[Category]) diff --git a/test/Test/Hspec/LeanCheck.hs b/test/Test/Hspec/LeanCheck.hs new file mode 100644 index 000000000..ba4c4d720 --- /dev/null +++ b/test/Test/Hspec/LeanCheck.hs @@ -0,0 +1,76 @@ +{-# LANGUAGE GADTs, TypeFamilies #-} +module Test.Hspec.LeanCheck +( prop +, forAll +) where + +import Control.Exception +import Data.Bifunctor (first) +import Data.String (String) +import GHC.Show as Show (showsPrec) +import Prologue +import Test.Hspec +import Test.Hspec.Core.Spec +import Test.LeanCheck.Core + +data Property where + Property :: IOTestable prop => prop -> Property + +-- | Perform an enumerative test of a property using LeanCheck. +-- +-- 'prop' will typically be a function of one or more 'Listable' arguments, returning either 'Bool' or 'IO ()' (in the latter case, typically via 'shouldBe' and friends). For example: +-- +-- > describe "+" $ do +-- > prop "associativity" $ +-- > \ a b c -> a + (b + c) `shouldBe` (a + b :: Int) + c +prop :: (HasCallStack, IOTestable prop) => String -> prop -> Spec +prop s = it s . Property + +data ForAll a where + ForAll :: IOTestable prop => [[a]] -> (a -> prop) -> ForAll a + +-- | Test a property given by an explicit list of tiers rather than a 'Listable' instance. This can be used to e.g. filter input values for which the property does not hold. +-- +-- > describe "mean" $ do +-- > prop "≥ the minimum" . forAll (not . null `filterT` tiers) $ +-- > \ list -> (mean list :: Int) `shouldSatisfy` (>= min list) +forAll :: IOTestable prop => [[a]] -> (a -> prop) -> ForAll a +forAll = ForAll + +instance Example Property where + type Arg Property = () + evaluateExample (Property prop) (Params _ bound) _ _ = do + result <- iocounterExample bound prop + case result of + Just messages -> pure $ Fail Nothing (concat messages) + Nothing -> pure Success + +class IOTestable t where + -- 'resultiers', lifted into 'IO'. + ioResultTiers :: t -> [[IO ([String], Bool)]] + +instance IOTestable (IO ()) where + ioResultTiers action = [[ (action >> pure ([], True)) `catch` (\ e -> pure ([ displayException (e :: SomeException) ], False)) ]] + +instance (IOTestable b, Show a, Listable a) => IOTestable (a -> b) where + ioResultTiers p = ioconcatMapT resultiersFor tiers + where resultiersFor x = fmap (fmap (first (showsPrec 11 x "":))) <$> ioResultTiers (p x) + +instance IOTestable Bool where + ioResultTiers p = [[ pure ([], p) ]] + +instance IOTestable (ForAll a) where + ioResultTiers (ForAll tiers property) = concatMapT (ioResultTiers . property) tiers + + +-- | 'concatMapT', lifted into 'IO'. +ioconcatMapT :: (a -> [[IO b]]) -> [[a]] -> [[IO b]] +ioconcatMapT f = (>>= (>>= f)) + +-- | 'counterExamples', lifted into 'IO'. +iocounterExamples :: IOTestable a => Int -> a -> IO [[String]] +iocounterExamples n = fmap (fmap fst . filter (not . snd)) . sequenceA . take n . concat . ioResultTiers + +-- | 'counterExample', lifted into 'IO'. +iocounterExample :: IOTestable a => Int -> a -> IO (Maybe [String]) +iocounterExample n = fmap listToMaybe . iocounterExamples n diff --git a/test/corpus/diff-summaries-crashers/javascript/.gitkeep b/test/corpus/diff-summaries-crashers/javascript/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/corpus/diff-summaries-todo/javascript/.gitkeep b/test/corpus/diff-summaries-todo/javascript/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/corpus/diff-summaries-todo/ruby/.gitkeep b/test/corpus/diff-summaries-todo/ruby/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/corpus/diff-summaries-todo2/ruby/delimiter.json b/test/corpus/diff-summaries-todo2/ruby/delimiter.json new file mode 100644 index 000000000..4287293ac --- /dev/null +++ b/test/corpus/diff-summaries-todo2/ruby/delimiter.json @@ -0,0 +1,1312 @@ +[{ + "testCaseDescription": "ruby-delimiter-insert-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the %q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the %qc> string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Added the %#a# string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the %Q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %c> string" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index e69de29..8ec39b8 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -0,0 +1,6 @@", + "+%q#a#", + "+%qc>", + "+%#a#", + "+%Q#a#", + "+%c>", + "+%Qc>" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ef8d34476c23317120bf744df9d41b9110a04c03..1b0f7afd8b56c527a93bcf77cd130a197736aae8" +} +,{ + "testCaseDescription": "ruby-delimiter-replacement-insert-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the %q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the %q{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Added the %/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the %Q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the %Q{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Added the %q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Added the %qc> string" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Added the %#a# string" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Added the %Q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 9 + ] + } + }, + "summary": "Added the %c> string" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 10 + ] + } + }, + "summary": "Added the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 8ec39b8..5b0f7ec 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,3 +1,15 @@", + "+%q/b/", + "+%q{d{e}f}", + "+%/b/", + "+%Q/b/", + "+%{d{e}f}", + "+%Q{d{e}f}", + "+%q#a#", + "+%qc>", + "+%#a#", + "+%Q#a#", + "+%c>", + "+%Qc>", + " %q#a#", + " %qc>", + " %#a#" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1b0f7afd8b56c527a93bcf77cd130a197736aae8..4e8d0a2cbe3dfca073f23bbb72b1461e5963338e" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-insert-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the %q/b/ string with the %q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the %qc> string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Added the %#a# string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the %Q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %c> string" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the %Qc> string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Q{d{e}f} string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 5b0f7ec..64d6df4 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,9 +1,9 @@", + "-%q/b/", + "-%q{d{e}f}", + "-%/b/", + "-%Q/b/", + "-%{d{e}f}", + "-%Q{d{e}f}", + "+%q#a#", + "+%qc>", + "+%#a#", + "+%Q#a#", + "+%c>", + "+%Qc>", + " %q#a#", + " %qc>", + " %#a#" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4e8d0a2cbe3dfca073f23bbb72b1461e5963338e..413fa9f465cd1591ad3c753e6d5d160ac0503019" +} +,{ + "testCaseDescription": "ruby-delimiter-replacement-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the %q#a# string with the %q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the %q{d{e}f} string" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + ] + }, + "summary": "Replaced the %qc> string with the %/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the %Q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %{d{e}f} string" + }, + { + "span": { + "replace": [ + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + ] + }, + "summary": "Replaced the %#a# string with the %Q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %c> string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 64d6df4..5b0f7ec 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,9 +1,9 @@", + "-%q#a#", + "-%qc>", + "-%#a#", + "-%Q#a#", + "-%c>", + "-%Qc>", + "+%q/b/", + "+%q{d{e}f}", + "+%/b/", + "+%Q/b/", + "+%{d{e}f}", + "+%Q{d{e}f}", + " %q#a#", + " %qc>", + " %#a#" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "413fa9f465cd1591ad3c753e6d5d160ac0503019..2a8902902ea697fda4a67838615f8b6a8e108353" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-replacement-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the %q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Deleted the %q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Deleted the %qc> string" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Deleted the %#a# string" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Deleted the %Q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 9 + ] + } + }, + "summary": "Deleted the %c> string" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 10 + ] + } + }, + "summary": "Deleted the %Qc> string" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Added the %q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Added the %q{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Added the %/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Added the %Q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 9 + ] + } + }, + "summary": "Added the %{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 10 + ] + } + }, + "summary": "Added the %Q{d{e}f} string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 5b0f7ec..2095136 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,18 +1,12 @@", + "-%q/b/", + "-%q{d{e}f}", + "-%/b/", + "-%Q/b/", + "-%{d{e}f}", + "-%Q{d{e}f}", + "-%q#a#", + "-%qc>", + "-%#a#", + "-%Q#a#", + "-%c>", + "-%Qc>", + " %q#a#", + " %qc>", + " %#a#", + " %Q#a#", + " %c>", + " %Qc>", + "+%q/b/", + "+%q{d{e}f}", + "+%/b/", + "+%Q/b/", + "+%{d{e}f}", + "+%Q{d{e}f}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2a8902902ea697fda4a67838615f8b6a8e108353..c03569b5f580bc90dc6d65cdd1ec2c719444ce89" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the %q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %qc> string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %#a# string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %c> string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 2095136..3843090 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,9 +1,3 @@", + "-%q#a#", + "-%qc>", + "-%#a#", + "-%Q#a#", + "-%c>", + "-%Qc>", + " %q/b/", + " %q{d{e}f}", + " %/b/" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c03569b5f580bc90dc6d65cdd1ec2c719444ce89..e9178c14220997160dfe6c89506972e0b7e1f258" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-rest-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the %q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Q{d{e}f} string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 3843090..e69de29 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,6 +0,0 @@", + "-%q/b/", + "-%q{d{e}f}", + "-%/b/", + "-%Q/b/", + "-%{d{e}f}", + "-%Q{d{e}f}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e9178c14220997160dfe6c89506972e0b7e1f258..b8a1e5f549bc1fa5a1424093d499d32fa0987cee" +}] diff --git a/test/corpus/diff-summaries-todo2/ruby/multiple-assignments.json b/test/corpus/diff-summaries-todo2/ruby/multiple-assignments.json new file mode 100644 index 000000000..0adbdd21c --- /dev/null +++ b/test/corpus/diff-summaries-todo2/ruby/multiple-assignments.json @@ -0,0 +1,383 @@ +[{ + "testCaseDescription": "ruby-multiple-assignments-insert-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Added the 'identifier' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index e69de29..348cf74 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -0,0 +1 @@", + "+x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a966f9b2783f127617cc42cbed16e6ec570b75ad..850232b2802cc99838c38bb6884e78c8675d900d" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-replacement-insert-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the 'identifier' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 23 + ] + } + }, + "summary": "Added the 'identifier' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 348cf74..242315a 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1 +1,3 @@", + "+x, *y = [10, 20, 30]", + "+x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "850232b2802cc99838c38bb6884e78c8675d900d..2f0556416a97d736bf681a377c0a17ad20fe03a1" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-insert-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'y' identifier in an assignment to identifier" + }, + { + "span": { + "insert": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'z' identifier in an assignment to identifier" + }, + { + "span": { + "delete": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'y' identifier in an assignment to identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 242315a..274faf2 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,3 +1,3 @@", + "-x, *y = [10, 20, 30]", + "+x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2f0556416a97d736bf681a377c0a17ad20fe03a1..4cf32e342e860dec68b496ba04ed8fca1d04a08f" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-replacement-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'y' identifier in an assignment to identifier" + }, + { + "span": { + "delete": { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'y' identifier in an assignment to identifier" + }, + { + "span": { + "delete": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'z' identifier in an assignment to identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 274faf2..242315a 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,3 +1,3 @@", + "-x, y, z = [10, 20, 30]", + "+x, *y = [10, 20, 30]", + " x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4cf32e342e860dec68b496ba04ed8fca1d04a08f..3d3c3f2b1d6ed385e8c69eb0de5f5db36abd1f93" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-replacement-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'identifier' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 23 + ] + } + }, + "summary": "Deleted the 'identifier' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Added the 'identifier' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 242315a..7ba9487 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,3 +1,2 @@", + "-x, *y = [10, 20, 30]", + "-x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]", + "+x, *y = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3d3c3f2b1d6ed385e8c69eb0de5f5db36abd1f93..b724179373843cb5f953b1eb84fe3cf1f787cae1" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'identifier' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 7ba9487..32cf6a2 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,2 +1 @@", + "-x, y, z = [10, 20, 30]", + " x, *y = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b724179373843cb5f953b1eb84fe3cf1f787cae1..9470930d6fca5e33ec313863fbe1c443d7388dbe" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-rest-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'identifier' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 32cf6a2..e69de29 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1 +0,0 @@", + "-x, *y = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9470930d6fca5e33ec313863fbe1c443d7388dbe..d4996909ad6798a66c5242d7171125ce6dbe1a50" +}] diff --git a/test/corpus/diff-summaries-todo2/ruby/regex.json b/test/corpus/diff-summaries-todo2/ruby/regex.json new file mode 100644 index 000000000..b55291eca --- /dev/null +++ b/test/corpus/diff-summaries-todo2/ruby/regex.json @@ -0,0 +1,383 @@ +[{ + "testCaseDescription": "ruby-regex-insert-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index e69de29..02dce9d 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -0,0 +1 @@", + "+/^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "956b136e24f76c977fefd27d5368ecd527f721ec..49cb17b4244d627bd084dab1c7248c48a3cdb7cc" +} +,{ + "testCaseDescription": "ruby-regex-replacement-insert-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the '%r/a/' regex" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the '%rc>' regex" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 19 + ] + } + }, + "summary": "Added the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index 02dce9d..c801d61 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1 +1,4 @@", + "+%r/a/", + "+%rc>", + "+/^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "49cb17b4244d627bd084dab1c7248c48a3cdb7cc..a73a7605d28b1fe2b09ce87d8db7426ea6295610" +} +,{ + "testCaseDescription": "ruby-regex-delete-insert-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + ] + }, + "summary": "Replaced the '%r/a/' regex with the '/^(foo|bar[^_])$/i' regex" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the '%rc>' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index c801d61..42d4984 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,4 +1,3 @@", + "-%r/a/", + "-%rc>", + "+/^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a73a7605d28b1fe2b09ce87d8db7426ea6295610..edcc26845e0ed493216f7b8ce1235e7a37ace55d" +} +,{ + "testCaseDescription": "ruby-regex-replacement-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the '/^(foo|bar[^_])$/i' regex with the '%r/a/' regex" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the '%rc>' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index 42d4984..c801d61 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,3 +1,4 @@", + "-/^(foo|bar[^_])$/i", + "+%r/a/", + "+%rc>", + " /^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "edcc26845e0ed493216f7b8ce1235e7a37ace55d..46655f4fd04784ed0fd995951c5f83018cc02d97" +} +,{ + "testCaseDescription": "ruby-regex-delete-replacement-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 19 + ] + } + }, + "summary": "Deleted the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index c801d61..48e43a9 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,4 +1,3 @@", + "+/^(foo|bar[^_])$/i", + " %r/a/", + " %rc>", + "-/^(foo|bar[^_])$/i", + "-/^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "46655f4fd04784ed0fd995951c5f83018cc02d97..dd7c07f9f3797a03b8a34fbd1efdbc98b01d2e76" +} +,{ + "testCaseDescription": "ruby-regex-delete-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index 48e43a9..b23927a 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,3 +1,2 @@", + "-/^(foo|bar[^_])$/i", + " %r/a/", + " %rc>" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "dd7c07f9f3797a03b8a34fbd1efdbc98b01d2e76..a9ee657f847f069d80fe4f52e9b1fb3bf991f26f" +} +,{ + "testCaseDescription": "ruby-regex-delete-rest-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the '%r/a/' regex" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the '%rc>' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index b23927a..e69de29 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,2 +0,0 @@", + "-%r/a/", + "-%rc>" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a9ee657f847f069d80fe4f52e9b1fb3bf991f26f..e8c4c9b4ba151237a0e88d5a650d34ee5a5a1b61" +}] diff --git a/test/corpus/diff-summaries/go/array-types.json b/test/corpus/diff-summaries/go/array-types.json new file mode 100644 index 000000000..805ee862e --- /dev/null +++ b/test/corpus/diff-summaries/go/array-types.json @@ -0,0 +1,418 @@ +[{ + "testCaseDescription": "go-array-types-setup-test", + "expectedResult": { + "changes": { + "array-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-types.go" + ], + "patch": [ + "diff --git a/array-types.go b/array-types.go", + "index e69de29b..79058077 100644", + "--- a/array-types.go", + "+++ b/array-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "dd275c4f09cc46a085621fe3f9d293f9e0c3427d..6bdff60b57b35cfcfb1c877f120c146637db874d" +} +,{ + "testCaseDescription": "go-array-types-insert-test", + "expectedResult": { + "changes": { + "array-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 14 + ] + } + }, + "summary": "Added the 'a' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-types.go" + ], + "patch": [ + "diff --git a/array-types.go b/array-types.go", + "index 79058077..3f73aea0 100644", + "--- a/array-types.go", + "+++ b/array-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+type a [2+2]x", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6bdff60b57b35cfcfb1c877f120c146637db874d..65b3b04b9eb8c1efb4abed1d1f5cd18b0cf211c7" +} +,{ + "testCaseDescription": "go-array-types-replacement-test", + "expectedResult": { + "changes": { + "array-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced '2' with '1' in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 11 + ], + "end": [ + 4, + 12 + ] + }, + { + "start": [ + 4, + 11 + ], + "end": [ + 4, + 12 + ] + } + ] + }, + "summary": "Replaced '2' with '1' in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 14 + ] + }, + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 14 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'y' identifier in the 'a' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-types.go" + ], + "patch": [ + "diff --git a/array-types.go b/array-types.go", + "index 3f73aea0..49783126 100644", + "--- a/array-types.go", + "+++ b/array-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type a [2+2]x", + "+type a [1+1]y", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "65b3b04b9eb8c1efb4abed1d1f5cd18b0cf211c7..e41a22e39e6be090a894ae3ca6727e0c2fb499a8" +} +,{ + "testCaseDescription": "go-array-types-delete-replacement-test", + "expectedResult": { + "changes": { + "array-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced '1' with '2' in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 11 + ], + "end": [ + 4, + 12 + ] + }, + { + "start": [ + 4, + 11 + ], + "end": [ + 4, + 12 + ] + } + ] + }, + "summary": "Replaced '1' with '2' in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 14 + ] + }, + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 14 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'x' identifier in the 'a' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-types.go" + ], + "patch": [ + "diff --git a/array-types.go b/array-types.go", + "index 49783126..3f73aea0 100644", + "--- a/array-types.go", + "+++ b/array-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type a [1+1]y", + "+type a [2+2]x", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e41a22e39e6be090a894ae3ca6727e0c2fb499a8..8526d819400848c08871bbc571369d972db212ce" +} +,{ + "testCaseDescription": "go-array-types-delete-insert-test", + "expectedResult": { + "changes": { + "array-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 14 + ] + } + }, + "summary": "Deleted the 'a' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-types.go" + ], + "patch": [ + "diff --git a/array-types.go b/array-types.go", + "index 3f73aea0..79058077 100644", + "--- a/array-types.go", + "+++ b/array-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type a [2+2]x", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8526d819400848c08871bbc571369d972db212ce..d63b29265993d9c65e5d3d45180e9179c3155919" +} +,{ + "testCaseDescription": "go-array-types-teardown-test", + "expectedResult": { + "changes": { + "array-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-types.go" + ], + "patch": [ + "diff --git a/array-types.go b/array-types.go", + "index 79058077..e69de29b 100644", + "--- a/array-types.go", + "+++ b/array-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d63b29265993d9c65e5d3d45180e9179c3155919..9ff6020ed6d316a29f1c88377d7c240617263a9f" +}] diff --git a/test/corpus/diff-summaries/go/array-with-implicit-length.json b/test/corpus/diff-summaries/go/array-with-implicit-length.json new file mode 100644 index 000000000..393616fd8 --- /dev/null +++ b/test/corpus/diff-summaries/go/array-with-implicit-length.json @@ -0,0 +1,430 @@ +[{ + "testCaseDescription": "go-array-with-implicit-length-setup-test", + "expectedResult": { + "changes": { + "array-with-implicit-length.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-with-implicit-length.go" + ], + "patch": [ + "diff --git a/array-with-implicit-length.go b/array-with-implicit-length.go", + "index e69de29b..79058077 100644", + "--- a/array-with-implicit-length.go", + "+++ b/array-with-implicit-length.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "bcd4bf3659a22076c572c879141d7ef13cadf8ba..84303d9cea50b86ab4d8f3477ea0841911d4427c" +} +,{ + "testCaseDescription": "go-array-with-implicit-length-insert-test", + "expectedResult": { + "changes": { + "array-with-implicit-length.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 29 + ] + } + }, + "summary": "Added the 'a1' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-with-implicit-length.go" + ], + "patch": [ + "diff --git a/array-with-implicit-length.go b/array-with-implicit-length.go", + "index 79058077..a53dc8c5 100644", + "--- a/array-with-implicit-length.go", + "+++ b/array-with-implicit-length.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+const a1 = [...]int{1, 2, 3}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "84303d9cea50b86ab4d8f3477ea0841911d4427c..6f23ae5fac8069864b3a5fe8b64198a81b97286e" +} +,{ + "testCaseDescription": "go-array-with-implicit-length-replacement-test", + "expectedResult": { + "changes": { + "array-with-implicit-length.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 22 + ] + } + }, + "summary": "Added '4' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 23 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Added '5' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 22 + ] + }, + { + "start": [ + 4, + 25 + ], + "end": [ + 4, + 26 + ] + } + ] + }, + "summary": "Replaced '1' with '6' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 24 + ], + "end": [ + 4, + 25 + ] + } + }, + "summary": "Deleted '2' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 27 + ], + "end": [ + 4, + 28 + ] + } + }, + "summary": "Deleted '3' in the [...]int composite_literal of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-with-implicit-length.go" + ], + "patch": [ + "diff --git a/array-with-implicit-length.go b/array-with-implicit-length.go", + "index a53dc8c5..e9e3d08f 100644", + "--- a/array-with-implicit-length.go", + "+++ b/array-with-implicit-length.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const a1 = [...]int{1, 2, 3}", + "+const a1 = [...]int{4,5,6}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6f23ae5fac8069864b3a5fe8b64198a81b97286e..ee620c3ebf598b4fb0f1aa4d6493bed828059de2" +} +,{ + "testCaseDescription": "go-array-with-implicit-length-delete-replacement-test", + "expectedResult": { + "changes": { + "array-with-implicit-length.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 22 + ] + } + }, + "summary": "Added '1' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 22 + ] + }, + { + "start": [ + 4, + 24 + ], + "end": [ + 4, + 25 + ] + } + ] + }, + "summary": "Replaced '4' with '2' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 27 + ], + "end": [ + 4, + 28 + ] + } + }, + "summary": "Added '3' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 23 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Deleted '5' in the [...]int composite_literal of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 25 + ], + "end": [ + 4, + 26 + ] + } + }, + "summary": "Deleted '6' in the [...]int composite_literal of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-with-implicit-length.go" + ], + "patch": [ + "diff --git a/array-with-implicit-length.go b/array-with-implicit-length.go", + "index e9e3d08f..a53dc8c5 100644", + "--- a/array-with-implicit-length.go", + "+++ b/array-with-implicit-length.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const a1 = [...]int{4,5,6}", + "+const a1 = [...]int{1, 2, 3}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ee620c3ebf598b4fb0f1aa4d6493bed828059de2..61516e3a8c818cb0812c8d4dcccd3e51b51b552c" +} +,{ + "testCaseDescription": "go-array-with-implicit-length-delete-insert-test", + "expectedResult": { + "changes": { + "array-with-implicit-length.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 29 + ] + } + }, + "summary": "Deleted the 'a1' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-with-implicit-length.go" + ], + "patch": [ + "diff --git a/array-with-implicit-length.go b/array-with-implicit-length.go", + "index a53dc8c5..79058077 100644", + "--- a/array-with-implicit-length.go", + "+++ b/array-with-implicit-length.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const a1 = [...]int{1, 2, 3}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "61516e3a8c818cb0812c8d4dcccd3e51b51b552c..2d0d3b75a1aa4688e2ee1aae6c5388cd39e396a4" +} +,{ + "testCaseDescription": "go-array-with-implicit-length-teardown-test", + "expectedResult": { + "changes": { + "array-with-implicit-length.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array-with-implicit-length.go" + ], + "patch": [ + "diff --git a/array-with-implicit-length.go b/array-with-implicit-length.go", + "index 79058077..e69de29b 100644", + "--- a/array-with-implicit-length.go", + "+++ b/array-with-implicit-length.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "2d0d3b75a1aa4688e2ee1aae6c5388cd39e396a4..fad96915d832ac6e13a3a067b6bc46fb5150823d" +}] diff --git a/test/corpus/diff-summaries/go/assignment-statements.json b/test/corpus/diff-summaries/go/assignment-statements.json new file mode 100644 index 000000000..2f8e65daa --- /dev/null +++ b/test/corpus/diff-summaries/go/assignment-statements.json @@ -0,0 +1,580 @@ +[{ + "testCaseDescription": "go-assignment-statements-setup-test", + "expectedResult": { + "changes": { + "assignment-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment-statements.go" + ], + "patch": [ + "diff --git a/assignment-statements.go b/assignment-statements.go", + "index e69de29b..79058077 100644", + "--- a/assignment-statements.go", + "+++ b/assignment-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e2c2101dadc49e784ab17192eba4aad3c2c5d13b..79a597ca63c3f7aba661f01ecaa3ec0c909f019d" +} +,{ + "testCaseDescription": "go-assignment-statements-insert-test", + "expectedResult": { + "changes": { + "assignment-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'a' assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the 'b, c' assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the 'd' assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 7 + ] + } + }, + "summary": "Added the 'e' assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment-statements.go" + ], + "patch": [ + "diff --git a/assignment-statements.go b/assignment-statements.go", + "index 79058077..072782b1 100644", + "--- a/assignment-statements.go", + "+++ b/assignment-statements.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+a = 1", + "+b, c += 2, 3", + "+d *= 3", + "+e += 1", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "79a597ca63c3f7aba661f01ecaa3ec0c909f019d..7a3bfc9e5f9f145637904b08f975bf89cfc743c6" +} +,{ + "testCaseDescription": "go-assignment-statements-replacement-test", + "expectedResult": { + "changes": { + "assignment-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in an assignment to x of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in an assignment to y, c of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + } + ] + }, + "summary": "Replaced the 'd' identifier with the 'z' identifier in an assignment to z of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 2 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 2 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'h' identifier in an assignment to h of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment-statements.go" + ], + "patch": [ + "diff --git a/assignment-statements.go b/assignment-statements.go", + "index 072782b1..2e6b444c 100644", + "--- a/assignment-statements.go", + "+++ b/assignment-statements.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-a = 1", + "-b, c += 2, 3", + "-d *= 3", + "-e += 1", + "+x = 1", + "+y, c += 2, 3", + "+z *= 3", + "+h += 1", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7a3bfc9e5f9f145637904b08f975bf89cfc743c6..55fb8ccd8e99c214fd184281948c01d1fb7ad7d1" +} +,{ + "testCaseDescription": "go-assignment-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "assignment-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in an assignment to a of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in an assignment to b, c of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + } + ] + }, + "summary": "Replaced the 'z' identifier with the 'd' identifier in an assignment to d of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 2 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 2 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'e' identifier in an assignment to e of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment-statements.go" + ], + "patch": [ + "diff --git a/assignment-statements.go b/assignment-statements.go", + "index 2e6b444c..072782b1 100644", + "--- a/assignment-statements.go", + "+++ b/assignment-statements.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-x = 1", + "-y, c += 2, 3", + "-z *= 3", + "-h += 1", + "+a = 1", + "+b, c += 2, 3", + "+d *= 3", + "+e += 1", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "55fb8ccd8e99c214fd184281948c01d1fb7ad7d1..ad10bb2d2952b00ac63e7e3c025cdb8312a931ac" +} +,{ + "testCaseDescription": "go-assignment-statements-delete-insert-test", + "expectedResult": { + "changes": { + "assignment-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the 'a' assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Deleted the 'b, c' assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Deleted the 'd' assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 7 + ] + } + }, + "summary": "Deleted the 'e' assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment-statements.go" + ], + "patch": [ + "diff --git a/assignment-statements.go b/assignment-statements.go", + "index 072782b1..79058077 100644", + "--- a/assignment-statements.go", + "+++ b/assignment-statements.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-a = 1", + "-b, c += 2, 3", + "-d *= 3", + "-e += 1", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ad10bb2d2952b00ac63e7e3c025cdb8312a931ac..bf0fad2433a6cb884471ee65ed32b0797c855306" +} +,{ + "testCaseDescription": "go-assignment-statements-teardown-test", + "expectedResult": { + "changes": { + "assignment-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment-statements.go" + ], + "patch": [ + "diff --git a/assignment-statements.go b/assignment-statements.go", + "index 79058077..e69de29b 100644", + "--- a/assignment-statements.go", + "+++ b/assignment-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "bf0fad2433a6cb884471ee65ed32b0797c855306..844563260fa09b99d4cf94ec2ba5a65d9a5e6ded" +}] diff --git a/test/corpus/diff-summaries/go/call-expressions.json b/test/corpus/diff-summaries/go/call-expressions.json new file mode 100644 index 000000000..39f4e27d8 --- /dev/null +++ b/test/corpus/diff-summaries/go/call-expressions.json @@ -0,0 +1,490 @@ +[{ + "testCaseDescription": "go-call-expressions-setup-test", + "expectedResult": { + "changes": { + "call-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "call-expressions.go" + ], + "patch": [ + "diff --git a/call-expressions.go b/call-expressions.go", + "index e69de29b..79058077 100644", + "--- a/call-expressions.go", + "+++ b/call-expressions.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "373c46bee0b8179cf5d2f00412173597e503cdd3..3647e58e37fefb500235f7b03c45bf4fdf4fd353" +} +,{ + "testCaseDescription": "go-call-expressions-insert-test", + "expectedResult": { + "changes": { + "call-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the 'x(b, c)' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the 'y(b, c)' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 11 + ] + } + }, + "summary": "Added the 'z(b, c)' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "call-expressions.go" + ], + "patch": [ + "diff --git a/call-expressions.go b/call-expressions.go", + "index 79058077..72918e59 100644", + "--- a/call-expressions.go", + "+++ b/call-expressions.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "-", + "+x(b, c...)", + "+y(b, c,)", + "+z(b,c...,)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3647e58e37fefb500235f7b03c45bf4fdf4fd353..fdf200e5448db3d0c33a098158f58cc50a96bf92" +} +,{ + "testCaseDescription": "go-call-expressions-replacement-test", + "expectedResult": { + "changes": { + "call-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the a(b, c) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the b(b, c) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + } + ] + }, + "summary": "Replaced the 'z' identifier with the 'c' identifier in the c(b, c) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "call-expressions.go" + ], + "patch": [ + "diff --git a/call-expressions.go b/call-expressions.go", + "index 72918e59..2d5e765c 100644", + "--- a/call-expressions.go", + "+++ b/call-expressions.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-x(b, c...)", + "-y(b, c,)", + "-z(b,c...,)", + "+a(b, c...)", + "+b(b, c,)", + "+c(b,c...,)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fdf200e5448db3d0c33a098158f58cc50a96bf92..fd62f603e7f0fbcd87c5d3e9259b56af869c8df9" +} +,{ + "testCaseDescription": "go-call-expressions-delete-replacement-test", + "expectedResult": { + "changes": { + "call-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the x(b, c) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the y(b, c) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'z' identifier in the z(b, c) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "call-expressions.go" + ], + "patch": [ + "diff --git a/call-expressions.go b/call-expressions.go", + "index 2d5e765c..72918e59 100644", + "--- a/call-expressions.go", + "+++ b/call-expressions.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-a(b, c...)", + "-b(b, c,)", + "-c(b,c...,)", + "+x(b, c...)", + "+y(b, c,)", + "+z(b,c...,)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fd62f603e7f0fbcd87c5d3e9259b56af869c8df9..c0baf110edbc43a5181ed54a0275ec81f704845a" +} +,{ + "testCaseDescription": "go-call-expressions-delete-insert-test", + "expectedResult": { + "changes": { + "call-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted the 'x(b, c)' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the 'y(b, c)' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 11 + ] + } + }, + "summary": "Deleted the 'z(b, c)' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "call-expressions.go" + ], + "patch": [ + "diff --git a/call-expressions.go b/call-expressions.go", + "index 72918e59..79058077 100644", + "--- a/call-expressions.go", + "+++ b/call-expressions.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "-x(b, c...)", + "-y(b, c,)", + "-z(b,c...,)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c0baf110edbc43a5181ed54a0275ec81f704845a..4877e00f14f3b561922b7e0cc5388fee41ed8c13" +} +,{ + "testCaseDescription": "go-call-expressions-teardown-test", + "expectedResult": { + "changes": { + "call-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "call-expressions.go" + ], + "patch": [ + "diff --git a/call-expressions.go b/call-expressions.go", + "index 79058077..e69de29b 100644", + "--- a/call-expressions.go", + "+++ b/call-expressions.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4877e00f14f3b561922b7e0cc5388fee41ed8c13..0bd1a3a45c722927b5d7c0c96d296bc01c1b333c" +}] diff --git a/test/corpus/diff-summaries/go/case-statements.json b/test/corpus/diff-summaries/go/case-statements.json new file mode 100644 index 000000000..f41751fc3 --- /dev/null +++ b/test/corpus/diff-summaries/go/case-statements.json @@ -0,0 +1,286 @@ +[{ + "testCaseDescription": "go-case-statements-setup-test", + "expectedResult": { + "changes": { + "case-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-statements.go" + ], + "patch": [ + "diff --git a/case-statements.go b/case-statements.go", + "index e69de29b..79058077 100644", + "--- a/case-statements.go", + "+++ b/case-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "084c915d8b993e13da207d668c798c4e3e6f3baa..1617f204e24679f90810da7e6d2d103138a72eb1" +} +,{ + "testCaseDescription": "go-case-statements-insert-test", + "expectedResult": { + "changes": { + "case-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added a switch statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-statements.go" + ], + "patch": [ + "diff --git a/case-statements.go b/case-statements.go", + "index 79058077..0b4c9561 100644", + "--- a/case-statements.go", + "+++ b/case-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+switch { }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1617f204e24679f90810da7e6d2d103138a72eb1..357a5f5d499d2c8a838737609f072a7b1e05d332" +} +,{ + "testCaseDescription": "go-case-statements-replacement-test", + "expectedResult": { + "changes": { + "case-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Added the 'case foo' case statement in a switch statement of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-statements.go" + ], + "patch": [ + "diff --git a/case-statements.go b/case-statements.go", + "index 0b4c9561..27b70908 100644", + "--- a/case-statements.go", + "+++ b/case-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-switch { }", + "+switch { case foo: f1() }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "357a5f5d499d2c8a838737609f072a7b1e05d332..1eb14111e36eb50e0191ad522c47e39f5c117353" +} +,{ + "testCaseDescription": "go-case-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "case-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Deleted the 'case foo' case statement in a switch statement of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-statements.go" + ], + "patch": [ + "diff --git a/case-statements.go b/case-statements.go", + "index 27b70908..0b4c9561 100644", + "--- a/case-statements.go", + "+++ b/case-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-switch { case foo: f1() }", + "+switch { }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1eb14111e36eb50e0191ad522c47e39f5c117353..140b9733bf13312661aa4907e1e1585c185b8300" +} +,{ + "testCaseDescription": "go-case-statements-delete-insert-test", + "expectedResult": { + "changes": { + "case-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted a switch statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-statements.go" + ], + "patch": [ + "diff --git a/case-statements.go b/case-statements.go", + "index 0b4c9561..79058077 100644", + "--- a/case-statements.go", + "+++ b/case-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-switch { }", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "140b9733bf13312661aa4907e1e1585c185b8300..9141ef00e2e4d9fdd72051f74a4da988a046f9ed" +} +,{ + "testCaseDescription": "go-case-statements-teardown-test", + "expectedResult": { + "changes": { + "case-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-statements.go" + ], + "patch": [ + "diff --git a/case-statements.go b/case-statements.go", + "index 79058077..e69de29b 100644", + "--- a/case-statements.go", + "+++ b/case-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9141ef00e2e4d9fdd72051f74a4da988a046f9ed..d42e8128993c8291af25742eee205e792ec356b4" +}] diff --git a/test/corpus/diff-summaries/go/channel-types.json b/test/corpus/diff-summaries/go/channel-types.json new file mode 100644 index 000000000..3b47c1378 --- /dev/null +++ b/test/corpus/diff-summaries/go/channel-types.json @@ -0,0 +1,604 @@ +[{ + "testCaseDescription": "go-channel-types-setup-test", + "expectedResult": { + "changes": { + "channel-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "channel-types.go" + ], + "patch": [ + "diff --git a/channel-types.go b/channel-types.go", + "index e69de29b..79058077 100644", + "--- a/channel-types.go", + "+++ b/channel-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a85665c66f8582bcde0abe05f4203f3696378040..d21a5042b8c05cc5e193d6b65680852b4808685c" +} +,{ + "testCaseDescription": "go-channel-types-insert-test", + "expectedResult": { + "changes": { + "channel-types.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 19 + ] + } + }, + "summary": "Added the 'c1' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 26 + ] + } + }, + "summary": "Added the 'c2' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 21 + ] + } + }, + "summary": "Added the 'c3' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "channel-types.go" + ], + "patch": [ + "diff --git a/channel-types.go b/channel-types.go", + "index 79058077..1c10bf6f 100644", + "--- a/channel-types.go", + "+++ b/channel-types.go", + "@@ -1,5 +1,9 @@", + " package main", + " ", + " func main() {", + "-", + "+type (", + "+c1 chan<- chan int", + "+c2 chan<- chan<- struct{}", + "+c3 chan<- <-chan int", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d21a5042b8c05cc5e193d6b65680852b4808685c..6580596e5489e682cecab66160c5ed0574514755" +} +,{ + "testCaseDescription": "go-channel-types-replacement-test", + "expectedResult": { + "changes": { + "channel-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 3 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 3 + ] + } + ] + }, + "summary": "Replaced the 'c1' identifier with the 'c2' identifier in the 'c2' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 16 + ], + "end": [ + 5, + 19 + ] + }, + { + "start": [ + 5, + 16 + ], + "end": [ + 5, + 22 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the chan string channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 3 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 3 + ] + } + ] + }, + "summary": "Replaced the 'c2' identifier with the 'c3' identifier in the 'c3' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 3 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 3 + ] + } + ] + }, + "summary": "Replaced the 'c3' identifier with the 'c4' identifier in the 'c4' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 18 + ], + "end": [ + 7, + 21 + ] + }, + { + "start": [ + 7, + 18 + ], + "end": [ + 7, + 24 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the <-chan string channel type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "channel-types.go" + ], + "patch": [ + "diff --git a/channel-types.go b/channel-types.go", + "index 1c10bf6f..196a7928 100644", + "--- a/channel-types.go", + "+++ b/channel-types.go", + "@@ -2,8 +2,8 @@ package main", + " ", + " func main() {", + " type (", + "-c1 chan<- chan int", + "-c2 chan<- chan<- struct{}", + "-c3 chan<- <-chan int", + "+c2 chan<- chan string", + "+c3 chan<- chan<- struct{}", + "+c4 chan<- <-chan string", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6580596e5489e682cecab66160c5ed0574514755..a0f3391f2532d0fb429ee42aaa4798f4cf7e5b69" +} +,{ + "testCaseDescription": "go-channel-types-delete-replacement-test", + "expectedResult": { + "changes": { + "channel-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 3 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 3 + ] + } + ] + }, + "summary": "Replaced the 'c2' identifier with the 'c1' identifier in the 'c1' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 16 + ], + "end": [ + 5, + 22 + ] + }, + { + "start": [ + 5, + 16 + ], + "end": [ + 5, + 19 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the chan int channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 3 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 3 + ] + } + ] + }, + "summary": "Replaced the 'c3' identifier with the 'c2' identifier in the 'c2' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 3 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 3 + ] + } + ] + }, + "summary": "Replaced the 'c4' identifier with the 'c3' identifier in the 'c3' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 18 + ], + "end": [ + 7, + 24 + ] + }, + { + "start": [ + 7, + 18 + ], + "end": [ + 7, + 21 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the <-chan int channel type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "channel-types.go" + ], + "patch": [ + "diff --git a/channel-types.go b/channel-types.go", + "index 196a7928..1c10bf6f 100644", + "--- a/channel-types.go", + "+++ b/channel-types.go", + "@@ -2,8 +2,8 @@ package main", + " ", + " func main() {", + " type (", + "-c2 chan<- chan string", + "-c3 chan<- chan<- struct{}", + "-c4 chan<- <-chan string", + "+c1 chan<- chan int", + "+c2 chan<- chan<- struct{}", + "+c3 chan<- <-chan int", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a0f3391f2532d0fb429ee42aaa4798f4cf7e5b69..ce282aa3733f82ffebfd127de4095c04fa9b0955" +} +,{ + "testCaseDescription": "go-channel-types-delete-insert-test", + "expectedResult": { + "changes": { + "channel-types.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 19 + ] + } + }, + "summary": "Deleted the 'c1' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 26 + ] + } + }, + "summary": "Deleted the 'c2' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 21 + ] + } + }, + "summary": "Deleted the 'c3' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "channel-types.go" + ], + "patch": [ + "diff --git a/channel-types.go b/channel-types.go", + "index 1c10bf6f..79058077 100644", + "--- a/channel-types.go", + "+++ b/channel-types.go", + "@@ -1,9 +1,5 @@", + " package main", + " ", + " func main() {", + "-type (", + "-c1 chan<- chan int", + "-c2 chan<- chan<- struct{}", + "-c3 chan<- <-chan int", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ce282aa3733f82ffebfd127de4095c04fa9b0955..b364521a12983a0480c9abb672c23e7d2a373e28" +} +,{ + "testCaseDescription": "go-channel-types-teardown-test", + "expectedResult": { + "changes": { + "channel-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "channel-types.go" + ], + "patch": [ + "diff --git a/channel-types.go b/channel-types.go", + "index 79058077..e69de29b 100644", + "--- a/channel-types.go", + "+++ b/channel-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "b364521a12983a0480c9abb672c23e7d2a373e28..4c1430949679a459f5530eccab8efc8046a3abc7" +}] diff --git a/test/corpus/diff-summaries/go/comment.json b/test/corpus/diff-summaries/go/comment.json new file mode 100644 index 000000000..807b3a500 --- /dev/null +++ b/test/corpus/diff-summaries/go/comment.json @@ -0,0 +1,218 @@ +[{ + "testCaseDescription": "go-comment-setup-test", + "expectedResult": { + "changes": { + "comment.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comment.go" + ], + "patch": [ + "diff --git a/comment.go b/comment.go", + "index e69de29b..79058077 100644", + "--- a/comment.go", + "+++ b/comment.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a1fc9648f91cfb841a93722bdf033369a8b2ec1c..141f6c7370b64be19098cf131c64fff22ecfae1a" +} +,{ + "testCaseDescription": "go-comment-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.go" + ], + "patch": [ + "diff --git a/comment.go b/comment.go", + "index 79058077..61c10ca2 100644", + "--- a/comment.go", + "+++ b/comment.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+// this is a comment", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "141f6c7370b64be19098cf131c64fff22ecfae1a..f6115129baf32cdb1e47ba1760e6be298af29b36" +} +,{ + "testCaseDescription": "go-comment-replacement-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.go" + ], + "patch": [ + "diff --git a/comment.go b/comment.go", + "index 61c10ca2..8e149b7b 100644", + "--- a/comment.go", + "+++ b/comment.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "-// this is a comment", + "+/*", + "+this is a block comment", + "+*/", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f6115129baf32cdb1e47ba1760e6be298af29b36..5914d3b3f69f8c27bdc2662d10485bd4d18a2e1b" +} +,{ + "testCaseDescription": "go-comment-delete-replacement-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.go" + ], + "patch": [ + "diff --git a/comment.go b/comment.go", + "index 8e149b7b..61c10ca2 100644", + "--- a/comment.go", + "+++ b/comment.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "-/*", + "-this is a block comment", + "-*/", + "+// this is a comment", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5914d3b3f69f8c27bdc2662d10485bd4d18a2e1b..b35645e04c8084ef015813094178217915053082" +} +,{ + "testCaseDescription": "go-comment-delete-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.go" + ], + "patch": [ + "diff --git a/comment.go b/comment.go", + "index 61c10ca2..79058077 100644", + "--- a/comment.go", + "+++ b/comment.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-// this is a comment", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "b35645e04c8084ef015813094178217915053082..81009a6559400aa0f18f9f8cd63e5d53fdbf02a6" +} +,{ + "testCaseDescription": "go-comment-teardown-test", + "expectedResult": { + "changes": { + "comment.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comment.go" + ], + "patch": [ + "diff --git a/comment.go b/comment.go", + "index 79058077..e69de29b 100644", + "--- a/comment.go", + "+++ b/comment.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "81009a6559400aa0f18f9f8cd63e5d53fdbf02a6..8566e6b82b82cdb946f31050cd67e81c7a70a4f8" +}] diff --git a/test/corpus/diff-summaries/go/const-declarations-with-types.json b/test/corpus/diff-summaries/go/const-declarations-with-types.json new file mode 100644 index 000000000..47bb46431 --- /dev/null +++ b/test/corpus/diff-summaries/go/const-declarations-with-types.json @@ -0,0 +1,538 @@ +[{ + "testCaseDescription": "go-const-declarations-with-types-setup-test", + "expectedResult": { + "changes": { + "const-declarations-with-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-with-types.go" + ], + "patch": [ + "diff --git a/const-declarations-with-types.go b/const-declarations-with-types.go", + "index e69de29b..79058077 100644", + "--- a/const-declarations-with-types.go", + "+++ b/const-declarations-with-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e569ad4f2564b872ede19dff450315ba540c3076..66684e941dfc86595981306872ef4c33a9fce21a" +} +,{ + "testCaseDescription": "go-const-declarations-with-types-insert-test", + "expectedResult": { + "changes": { + "const-declarations-with-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the 'zero' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Added the 'int' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 18 + ], + "end": [ + 4, + 19 + ] + } + }, + "summary": "Added '0' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-with-types.go" + ], + "patch": [ + "diff --git a/const-declarations-with-types.go b/const-declarations-with-types.go", + "index 79058077..0adafada 100644", + "--- a/const-declarations-with-types.go", + "+++ b/const-declarations-with-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+const zero int = 0", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "66684e941dfc86595981306872ef4c33a9fce21a..42b30d03e59093b632266908655473fd65f5f2eb" +} +,{ + "testCaseDescription": "go-const-declarations-with-types-replacement-test", + "expectedResult": { + "changes": { + "const-declarations-with-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 11 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the 'zero' identifier with the 'one' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Added the 'two' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + }, + { + "start": [ + 4, + 16 + ], + "end": [ + 4, + 23 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'uiint64' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 18 + ], + "end": [ + 4, + 19 + ] + }, + { + "start": [ + 4, + 26 + ], + "end": [ + 4, + 27 + ] + } + ] + }, + "summary": "Replaced '0' with '1' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 29 + ], + "end": [ + 4, + 30 + ] + } + }, + "summary": "Added '2' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-with-types.go" + ], + "patch": [ + "diff --git a/const-declarations-with-types.go b/const-declarations-with-types.go", + "index 0adafada..901589bf 100644", + "--- a/const-declarations-with-types.go", + "+++ b/const-declarations-with-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const zero int = 0", + "+const one, two uiint64 = 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "42b30d03e59093b632266908655473fd65f5f2eb..22edff1148e1572a99d19f30e690a3f64b662f4f" +} +,{ + "testCaseDescription": "go-const-declarations-with-types-delete-replacement-test", + "expectedResult": { + "changes": { + "const-declarations-with-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 11 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'zero' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Deleted the 'two' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 16 + ], + "end": [ + 4, + 23 + ] + }, + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + ] + }, + "summary": "Replaced the 'uiint64' identifier with the 'int' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 26 + ], + "end": [ + 4, + 27 + ] + }, + { + "start": [ + 4, + 18 + ], + "end": [ + 4, + 19 + ] + } + ] + }, + "summary": "Replaced '1' with '0' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 29 + ], + "end": [ + 4, + 30 + ] + } + }, + "summary": "Deleted '2' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-with-types.go" + ], + "patch": [ + "diff --git a/const-declarations-with-types.go b/const-declarations-with-types.go", + "index 901589bf..0adafada 100644", + "--- a/const-declarations-with-types.go", + "+++ b/const-declarations-with-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const one, two uiint64 = 1, 2", + "+const zero int = 0", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "22edff1148e1572a99d19f30e690a3f64b662f4f..fd5e7578b399409eefac5e83a4a5189c0da7c1f0" +} +,{ + "testCaseDescription": "go-const-declarations-with-types-delete-insert-test", + "expectedResult": { + "changes": { + "const-declarations-with-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted the 'zero' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Deleted the 'int' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 18 + ], + "end": [ + 4, + 19 + ] + } + }, + "summary": "Deleted '0' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-with-types.go" + ], + "patch": [ + "diff --git a/const-declarations-with-types.go b/const-declarations-with-types.go", + "index 0adafada..79058077 100644", + "--- a/const-declarations-with-types.go", + "+++ b/const-declarations-with-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const zero int = 0", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fd5e7578b399409eefac5e83a4a5189c0da7c1f0..007d654f99ed0a26e9857d991a181da97005bcb2" +} +,{ + "testCaseDescription": "go-const-declarations-with-types-teardown-test", + "expectedResult": { + "changes": { + "const-declarations-with-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-with-types.go" + ], + "patch": [ + "diff --git a/const-declarations-with-types.go b/const-declarations-with-types.go", + "index 79058077..e69de29b 100644", + "--- a/const-declarations-with-types.go", + "+++ b/const-declarations-with-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "007d654f99ed0a26e9857d991a181da97005bcb2..acb9e5e1c505bf2f3ccd977641fe0084ff8d7d58" +}] diff --git a/test/corpus/diff-summaries/go/const-declarations-without-types.json b/test/corpus/diff-summaries/go/const-declarations-without-types.json new file mode 100644 index 000000000..de6f77875 --- /dev/null +++ b/test/corpus/diff-summaries/go/const-declarations-without-types.json @@ -0,0 +1,424 @@ +[{ + "testCaseDescription": "go-const-declarations-without-types-setup-test", + "expectedResult": { + "changes": { + "const-declarations-without-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-without-types.go" + ], + "patch": [ + "diff --git a/const-declarations-without-types.go b/const-declarations-without-types.go", + "index e69de29b..79058077 100644", + "--- a/const-declarations-without-types.go", + "+++ b/const-declarations-without-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d01762bbba4dab11931c77b7e92313b7e8ac8f8d..a944383d6a991e067df8eb52b10f41c69e2432d6" +} +,{ + "testCaseDescription": "go-const-declarations-without-types-insert-test", + "expectedResult": { + "changes": { + "const-declarations-without-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Added the 'zero' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-without-types.go" + ], + "patch": [ + "diff --git a/const-declarations-without-types.go b/const-declarations-without-types.go", + "index 79058077..7ef3805e 100644", + "--- a/const-declarations-without-types.go", + "+++ b/const-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+const zero = 0", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a944383d6a991e067df8eb52b10f41c69e2432d6..8b92431550b595466e765c5df24f64bf4f4be471" +} +,{ + "testCaseDescription": "go-const-declarations-without-types-replacement-test", + "expectedResult": { + "changes": { + "const-declarations-without-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 11 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the 'zero' identifier with the 'one' identifier in the one, two var assignment of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Added the 'two' identifier in the one, two var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 14 + ], + "end": [ + 4, + 15 + ] + }, + { + "start": [ + 4, + 18 + ], + "end": [ + 4, + 19 + ] + } + ] + }, + "summary": "Replaced '0' with '1' in the one, two var assignment of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 22 + ] + } + }, + "summary": "Added '2' in the one, two var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-without-types.go" + ], + "patch": [ + "diff --git a/const-declarations-without-types.go b/const-declarations-without-types.go", + "index 7ef3805e..c4525e24 100644", + "--- a/const-declarations-without-types.go", + "+++ b/const-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const zero = 0", + "+const one, two = 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8b92431550b595466e765c5df24f64bf4f4be471..27ee58022c11f97fc49c46591e48bfd1c5c86735" +} +,{ + "testCaseDescription": "go-const-declarations-without-types-delete-replacement-test", + "expectedResult": { + "changes": { + "const-declarations-without-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 11 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'zero' identifier in the zero var assignment of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Deleted the 'two' identifier in the zero var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 18 + ], + "end": [ + 4, + 19 + ] + }, + { + "start": [ + 4, + 14 + ], + "end": [ + 4, + 15 + ] + } + ] + }, + "summary": "Replaced '1' with '0' in the zero var assignment of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 22 + ] + } + }, + "summary": "Deleted '2' in the zero var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-without-types.go" + ], + "patch": [ + "diff --git a/const-declarations-without-types.go b/const-declarations-without-types.go", + "index c4525e24..7ef3805e 100644", + "--- a/const-declarations-without-types.go", + "+++ b/const-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const one, two = 1, 2", + "+const zero = 0", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "27ee58022c11f97fc49c46591e48bfd1c5c86735..0d20aa866a60c0921108d2d27f927d8c18fbdb6d" +} +,{ + "testCaseDescription": "go-const-declarations-without-types-delete-insert-test", + "expectedResult": { + "changes": { + "const-declarations-without-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 15 + ] + } + }, + "summary": "Deleted the 'zero' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-without-types.go" + ], + "patch": [ + "diff --git a/const-declarations-without-types.go b/const-declarations-without-types.go", + "index 7ef3805e..79058077 100644", + "--- a/const-declarations-without-types.go", + "+++ b/const-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-const zero = 0", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0d20aa866a60c0921108d2d27f927d8c18fbdb6d..0eeceba36497436beca93db3731d381fe08b2bfc" +} +,{ + "testCaseDescription": "go-const-declarations-without-types-teardown-test", + "expectedResult": { + "changes": { + "const-declarations-without-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-declarations-without-types.go" + ], + "patch": [ + "diff --git a/const-declarations-without-types.go b/const-declarations-without-types.go", + "index 79058077..e69de29b 100644", + "--- a/const-declarations-without-types.go", + "+++ b/const-declarations-without-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0eeceba36497436beca93db3731d381fe08b2bfc..e569ad4f2564b872ede19dff450315ba540c3076" +}] diff --git a/test/corpus/diff-summaries/go/const-with-implicit-values.json b/test/corpus/diff-summaries/go/const-with-implicit-values.json new file mode 100644 index 000000000..4f286746d --- /dev/null +++ b/test/corpus/diff-summaries/go/const-with-implicit-values.json @@ -0,0 +1,496 @@ +[{ + "testCaseDescription": "go-const-with-implicit-values-setup-test", + "expectedResult": { + "changes": { + "const-with-implicit-values.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-with-implicit-values.go" + ], + "patch": [ + "diff --git a/const-with-implicit-values.go b/const-with-implicit-values.go", + "index e69de29b..79058077 100644", + "--- a/const-with-implicit-values.go", + "+++ b/const-with-implicit-values.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5caeef873494edf9110ed67e273e7c4df49d588e..c207b3578afc46787bbc1fc463c375e65284dbb3" +} +,{ + "testCaseDescription": "go-const-with-implicit-values-insert-test", + "expectedResult": { + "changes": { + "const-with-implicit-values.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the 'zero' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 5 + ] + } + }, + "summary": "Added the 'one' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 5 + ] + } + }, + "summary": "Added the 'two' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-with-implicit-values.go" + ], + "patch": [ + "diff --git a/const-with-implicit-values.go b/const-with-implicit-values.go", + "index 79058077..d98ee4cf 100644", + "--- a/const-with-implicit-values.go", + "+++ b/const-with-implicit-values.go", + "@@ -1,5 +1,9 @@", + " package main", + " ", + " func main() {", + "-", + "+const (", + "+ zero = iota", + "+ one", + "+ two", + "+ )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c207b3578afc46787bbc1fc463c375e65284dbb3..50cb43c50d503af99684dd1b21a32bd20dabf536" +} +,{ + "testCaseDescription": "go-const-with-implicit-values-replacement-test", + "expectedResult": { + "changes": { + "const-with-implicit-values.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 6 + ] + }, + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 3 + ] + } + ] + }, + "summary": "Replaced the 'zero' identifier with the 'a' identifier in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 5 + ] + }, + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 3 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'b' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 5 + ] + }, + { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 3 + ] + } + ] + }, + "summary": "Replaced the 'two' identifier with the 'c' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-with-implicit-values.go" + ], + "patch": [ + "diff --git a/const-with-implicit-values.go b/const-with-implicit-values.go", + "index d98ee4cf..c4c9127b 100644", + "--- a/const-with-implicit-values.go", + "+++ b/const-with-implicit-values.go", + "@@ -2,8 +2,8 @@ package main", + " ", + " func main() {", + " const (", + "- zero = iota", + "- one", + "- two", + "+ a = iota", + "+ b", + "+ c", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "50cb43c50d503af99684dd1b21a32bd20dabf536..a9979d0ec9379382e44de670b4f20350ddb595e2" +} +,{ + "testCaseDescription": "go-const-with-implicit-values-delete-replacement-test", + "expectedResult": { + "changes": { + "const-with-implicit-values.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 3 + ] + }, + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 6 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'zero' identifier in the zero var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 3 + ] + }, + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 5 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'one' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 3 + ] + }, + { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 5 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'two' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-with-implicit-values.go" + ], + "patch": [ + "diff --git a/const-with-implicit-values.go b/const-with-implicit-values.go", + "index c4c9127b..d98ee4cf 100644", + "--- a/const-with-implicit-values.go", + "+++ b/const-with-implicit-values.go", + "@@ -2,8 +2,8 @@ package main", + " ", + " func main() {", + " const (", + "- a = iota", + "- b", + "- c", + "+ zero = iota", + "+ one", + "+ two", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a9979d0ec9379382e44de670b4f20350ddb595e2..7093865216c3ed298ad93ff34ace3f1679fb22f3" +} +,{ + "testCaseDescription": "go-const-with-implicit-values-delete-insert-test", + "expectedResult": { + "changes": { + "const-with-implicit-values.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Deleted the 'zero' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 5 + ] + } + }, + "summary": "Deleted the 'one' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 5 + ] + } + }, + "summary": "Deleted the 'two' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-with-implicit-values.go" + ], + "patch": [ + "diff --git a/const-with-implicit-values.go b/const-with-implicit-values.go", + "index d98ee4cf..79058077 100644", + "--- a/const-with-implicit-values.go", + "+++ b/const-with-implicit-values.go", + "@@ -1,9 +1,5 @@", + " package main", + " ", + " func main() {", + "-const (", + "- zero = iota", + "- one", + "- two", + "- )", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7093865216c3ed298ad93ff34ace3f1679fb22f3..c549422d0ddad2f5d06f04b223fa72b7c1dfce8d" +} +,{ + "testCaseDescription": "go-const-with-implicit-values-teardown-test", + "expectedResult": { + "changes": { + "const-with-implicit-values.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "const-with-implicit-values.go" + ], + "patch": [ + "diff --git a/const-with-implicit-values.go b/const-with-implicit-values.go", + "index 79058077..e69de29b 100644", + "--- a/const-with-implicit-values.go", + "+++ b/const-with-implicit-values.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c549422d0ddad2f5d06f04b223fa72b7c1dfce8d..c505aaaa18999293830a998c55e78edfeed5c138" +}] diff --git a/test/corpus/diff-summaries/go/constructors.json b/test/corpus/diff-summaries/go/constructors.json new file mode 100644 index 000000000..d01dad533 --- /dev/null +++ b/test/corpus/diff-summaries/go/constructors.json @@ -0,0 +1,742 @@ +[{ + "testCaseDescription": "go-constructors-setup-test", + "expectedResult": { + "changes": { + "constructors.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructors.go" + ], + "patch": [ + "diff --git a/constructors.go b/constructors.go", + "index e69de29b..79058077 100644", + "--- a/constructors.go", + "+++ b/constructors.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c505aaaa18999293830a998c55e78edfeed5c138..ea9b5903a29e31e80f43020258003697be5ee291" +} +,{ + "testCaseDescription": "go-constructors-insert-test", + "expectedResult": { + "changes": { + "constructors.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 17 + ] + } + }, + "summary": "Added the 'make(chan<- int)' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 30 + ] + } + }, + "summary": "Added the 'make(chan<- int, …)' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 24 + ] + } + }, + "summary": "Added the 'make(chan<- int, 5, 10)' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 24 + ] + } + }, + "summary": "Added the 'new(…)' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructors.go" + ], + "patch": [ + "diff --git a/constructors.go b/constructors.go", + "index 79058077..082e65fd 100644", + "--- a/constructors.go", + "+++ b/constructors.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+make(chan<- int)", + "+make(chan<- int, (new - old))", + "+make(chan<- int, 5, 10)", + "+ new(map[string]string)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ea9b5903a29e31e80f43020258003697be5ee291..60388824f20672415714fbae1893d561753be6e3" +} +,{ + "testCaseDescription": "go-constructors-replacement-test", + "expectedResult": { + "changes": { + "constructors.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 16 + ] + }, + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 19 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the chan<- string channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 13 + ], + "end": [ + 5, + 16 + ] + }, + { + "start": [ + 5, + 13 + ], + "end": [ + 5, + 19 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the chan<- string channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 13 + ], + "end": [ + 6, + 16 + ] + }, + { + "start": [ + 6, + 13 + ], + "end": [ + 6, + 19 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the chan<- string channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 18 + ], + "end": [ + 6, + 19 + ] + }, + { + "start": [ + 6, + 21 + ], + "end": [ + 6, + 22 + ] + } + ] + }, + "summary": "Replaced '5' with '7' in the make(chan<- string, 7, 11) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 21 + ], + "end": [ + 6, + 23 + ] + }, + { + "start": [ + 6, + 24 + ], + "end": [ + 6, + 26 + ] + } + ] + }, + "summary": "Replaced '10' with '11' in the make(chan<- string, 7, 11) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 10 + ], + "end": [ + 7, + 16 + ] + }, + { + "start": [ + 7, + 10 + ], + "end": [ + 7, + 13 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the new(…) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 17 + ], + "end": [ + 7, + 23 + ] + }, + { + "start": [ + 7, + 14 + ], + "end": [ + 7, + 17 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the new(…) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructors.go" + ], + "patch": [ + "diff --git a/constructors.go b/constructors.go", + "index 082e65fd..e4fdb2e9 100644", + "--- a/constructors.go", + "+++ b/constructors.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-make(chan<- int)", + "-make(chan<- int, (new - old))", + "-make(chan<- int, 5, 10)", + "- new(map[string]string)", + "+make(chan<- string)", + "+make(chan<- string, (new - old))", + "+make(chan<- string, 7, 11)", + "+ new(map[int]int)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "60388824f20672415714fbae1893d561753be6e3..3bffdaa19f7ce53c52445a5d1798c3665c57f617" +} +,{ + "testCaseDescription": "go-constructors-delete-replacement-test", + "expectedResult": { + "changes": { + "constructors.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 19 + ] + }, + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 16 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the chan<- int channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 13 + ], + "end": [ + 5, + 19 + ] + }, + { + "start": [ + 5, + 13 + ], + "end": [ + 5, + 16 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the chan<- int channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 13 + ], + "end": [ + 6, + 19 + ] + }, + { + "start": [ + 6, + 13 + ], + "end": [ + 6, + 16 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the chan<- int channel type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 21 + ], + "end": [ + 6, + 22 + ] + }, + { + "start": [ + 6, + 18 + ], + "end": [ + 6, + 19 + ] + } + ] + }, + "summary": "Replaced '7' with '5' in the make(chan<- int, 5, 10) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 24 + ], + "end": [ + 6, + 26 + ] + }, + { + "start": [ + 6, + 21 + ], + "end": [ + 6, + 23 + ] + } + ] + }, + "summary": "Replaced '11' with '10' in the make(chan<- int, 5, 10) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 10 + ], + "end": [ + 7, + 13 + ] + }, + { + "start": [ + 7, + 10 + ], + "end": [ + 7, + 16 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the new(…) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 14 + ], + "end": [ + 7, + 17 + ] + }, + { + "start": [ + 7, + 17 + ], + "end": [ + 7, + 23 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the new(…) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructors.go" + ], + "patch": [ + "diff --git a/constructors.go b/constructors.go", + "index e4fdb2e9..082e65fd 100644", + "--- a/constructors.go", + "+++ b/constructors.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-make(chan<- string)", + "-make(chan<- string, (new - old))", + "-make(chan<- string, 7, 11)", + "- new(map[int]int)", + "+make(chan<- int)", + "+make(chan<- int, (new - old))", + "+make(chan<- int, 5, 10)", + "+ new(map[string]string)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3bffdaa19f7ce53c52445a5d1798c3665c57f617..f30b9bf146cc89b7e19efbfb747f3045b96a6e58" +} +,{ + "testCaseDescription": "go-constructors-delete-insert-test", + "expectedResult": { + "changes": { + "constructors.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 17 + ] + } + }, + "summary": "Deleted the 'make(chan<- int)' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 30 + ] + } + }, + "summary": "Deleted the 'make(chan<- int, …)' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 24 + ] + } + }, + "summary": "Deleted the 'make(chan<- int, 5, 10)' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 24 + ] + } + }, + "summary": "Deleted the 'new(…)' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructors.go" + ], + "patch": [ + "diff --git a/constructors.go b/constructors.go", + "index 082e65fd..79058077 100644", + "--- a/constructors.go", + "+++ b/constructors.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-make(chan<- int)", + "-make(chan<- int, (new - old))", + "-make(chan<- int, 5, 10)", + "- new(map[string]string)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f30b9bf146cc89b7e19efbfb747f3045b96a6e58..b641795c7753970336fc4c7e332de36ad5441011" +} +,{ + "testCaseDescription": "go-constructors-teardown-test", + "expectedResult": { + "changes": { + "constructors.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructors.go" + ], + "patch": [ + "diff --git a/constructors.go b/constructors.go", + "index 79058077..e69de29b 100644", + "--- a/constructors.go", + "+++ b/constructors.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "b641795c7753970336fc4c7e332de36ad5441011..39da12378f56efc6f5a7d91aa4cfd6dd9b410d0d" +}] diff --git a/test/corpus/diff-summaries/go/float-literals.json b/test/corpus/diff-summaries/go/float-literals.json new file mode 100644 index 000000000..d8dab1ae6 --- /dev/null +++ b/test/corpus/diff-summaries/go/float-literals.json @@ -0,0 +1,670 @@ +[{ + "testCaseDescription": "go-float-literals-setup-test", + "expectedResult": { + "changes": { + "float-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "float-literals.go" + ], + "patch": [ + "diff --git a/float-literals.go b/float-literals.go", + "index e69de29b..79058077 100644", + "--- a/float-literals.go", + "+++ b/float-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "cb535d2811aca85ccc5af6391402ea86b6b7e441..7062e83a312e720b425e314e289fc0b3bbbe6ed3" +} +,{ + "testCaseDescription": "go-float-literals-insert-test", + "expectedResult": { + "changes": { + "float-literals.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Added the 'f1' assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the 'f2' assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 13 + ] + } + }, + "summary": "Added the 'f3' assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 12 + ] + } + }, + "summary": "Added the 'f4' assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 12 + ] + } + }, + "summary": "Added the 'f5' assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "float-literals.go" + ], + "patch": [ + "diff --git a/float-literals.go b/float-literals.go", + "index 79058077..772bdb09 100644", + "--- a/float-literals.go", + "+++ b/float-literals.go", + "@@ -1,5 +1,9 @@", + " package main", + " ", + " func main() {", + "-", + "+f1 = 1.5", + "+f2 = 1.5e100", + "+f3 = 1.5e+50", + "+f4 = 1.5e-5", + "+f5 = .5e-50", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7062e83a312e720b425e314e289fc0b3bbbe6ed3..8d110da38175af096c2ccfdfca9dbfad106a9ca2" +} +,{ + "testCaseDescription": "go-float-literals-replacement-test", + "expectedResult": { + "changes": { + "float-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the '1.5' float with the '2.6' float in an assignment to f1 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced the '1.5e100' float with the '2.6e211' float in an assignment to f2 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 13 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 13 + ] + } + ] + }, + "summary": "Replaced the '1.5e+50' float with the '2.6e+60' float in an assignment to f3 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 12 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 12 + ] + } + ] + }, + "summary": "Replaced the '1.5e-5' float with the '2.6e-7' float in an assignment to f4 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 12 + ] + }, + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 12 + ] + } + ] + }, + "summary": "Replaced the '.5e-50' float with the '.6e-60' float in an assignment to f5 of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "float-literals.go" + ], + "patch": [ + "diff --git a/float-literals.go b/float-literals.go", + "index 772bdb09..0818628b 100644", + "--- a/float-literals.go", + "+++ b/float-literals.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-f1 = 1.5", + "-f2 = 1.5e100", + "-f3 = 1.5e+50", + "-f4 = 1.5e-5", + "-f5 = .5e-50", + "+f1 = 2.6", + "+f2 = 2.6e211", + "+f3 = 2.6e+60", + "+f4 = 2.6e-7", + "+f5 = .6e-60", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8d110da38175af096c2ccfdfca9dbfad106a9ca2..3b363fc0f9540db83dedca604aa883cf5fc816b5" +} +,{ + "testCaseDescription": "go-float-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "float-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the '2.6' float with the '1.5' float in an assignment to f1 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced the '2.6e211' float with the '1.5e100' float in an assignment to f2 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 13 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 13 + ] + } + ] + }, + "summary": "Replaced the '2.6e+60' float with the '1.5e+50' float in an assignment to f3 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 12 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 12 + ] + } + ] + }, + "summary": "Replaced the '2.6e-7' float with the '1.5e-5' float in an assignment to f4 of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 12 + ] + }, + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 12 + ] + } + ] + }, + "summary": "Replaced the '.6e-60' float with the '.5e-50' float in an assignment to f5 of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "float-literals.go" + ], + "patch": [ + "diff --git a/float-literals.go b/float-literals.go", + "index 0818628b..772bdb09 100644", + "--- a/float-literals.go", + "+++ b/float-literals.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-f1 = 2.6", + "-f2 = 2.6e211", + "-f3 = 2.6e+60", + "-f4 = 2.6e-7", + "-f5 = .6e-60", + "+f1 = 1.5", + "+f2 = 1.5e100", + "+f3 = 1.5e+50", + "+f4 = 1.5e-5", + "+f5 = .5e-50", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3b363fc0f9540db83dedca604aa883cf5fc816b5..3b766942e9beae9f2f073811d72797e7265e4193" +} +,{ + "testCaseDescription": "go-float-literals-delete-insert-test", + "expectedResult": { + "changes": { + "float-literals.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Deleted the 'f1' assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Deleted the 'f2' assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 13 + ] + } + }, + "summary": "Deleted the 'f3' assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 12 + ] + } + }, + "summary": "Deleted the 'f4' assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 12 + ] + } + }, + "summary": "Deleted the 'f5' assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "float-literals.go" + ], + "patch": [ + "diff --git a/float-literals.go b/float-literals.go", + "index 772bdb09..79058077 100644", + "--- a/float-literals.go", + "+++ b/float-literals.go", + "@@ -1,9 +1,5 @@", + " package main", + " ", + " func main() {", + "-f1 = 1.5", + "-f2 = 1.5e100", + "-f3 = 1.5e+50", + "-f4 = 1.5e-5", + "-f5 = .5e-50", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3b766942e9beae9f2f073811d72797e7265e4193..60e553921c8013dfaebd3331f73ffd00cf8d6854" +} +,{ + "testCaseDescription": "go-float-literals-teardown-test", + "expectedResult": { + "changes": { + "float-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "float-literals.go" + ], + "patch": [ + "diff --git a/float-literals.go b/float-literals.go", + "index 79058077..e69de29b 100644", + "--- a/float-literals.go", + "+++ b/float-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "60e553921c8013dfaebd3331f73ffd00cf8d6854..b33ba59ecc38b2543059f17e99013c5f619a0295" +}] diff --git a/test/corpus/diff-summaries/go/for-statements.json b/test/corpus/diff-summaries/go/for-statements.json new file mode 100644 index 000000000..104cdee6c --- /dev/null +++ b/test/corpus/diff-summaries/go/for-statements.json @@ -0,0 +1,830 @@ +[{ + "testCaseDescription": "go-for-statements-setup-test", + "expectedResult": { + "changes": { + "for-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statements.go" + ], + "patch": [ + "diff --git a/for-statements.go b/for-statements.go", + "index e69de29b..79058077 100644", + "--- a/for-statements.go", + "+++ b/for-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "05733ec654b2b20d054881640e8c5726bbe00f6d..df6add01a946172080998527e2eebaa60f522c3f" +} +,{ + "testCaseDescription": "go-for-statements-insert-test", + "expectedResult": { + "changes": { + "for-statements.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'a()' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the 'loop' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 11, + 2 + ] + } + }, + "summary": "Added the 'i := 0; i < 5; i++' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 15, + 2 + ] + } + }, + "summary": "Added the 'i < 10; i++' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 16, + 1 + ], + "end": [ + 19, + 2 + ] + } + }, + "summary": "Added the 'for ;; {\na()\ncontinue\n}' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 20, + 1 + ], + "end": [ + 23, + 2 + ] + } + }, + "summary": "Added the 'x := range y' for statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statements.go" + ], + "patch": [ + "diff --git a/for-statements.go b/for-statements.go", + "index 79058077..66e5f7a4 100644", + "--- a/for-statements.go", + "+++ b/for-statements.go", + "@@ -1,5 +1,24 @@", + " package main", + " ", + " func main() {", + "-", + "+ for {", + "+a()", + "+goto loop", + "+}", + "+for i := 0; i < 5; i++ {", + "+a()", + "+break loop", + "+}", + "+for ; i < 10; i++ {", + "+a()", + "+continue loop2", + "+}", + "+for ;; {", + "+a()", + "+continue", + "+}", + "+for x := range y {", + "+a(x)", + "+break", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "df6add01a946172080998527e2eebaa60f522c3f..5abfa387e21f226e626004f4b0ff9558456bc5db" +} +,{ + "testCaseDescription": "go-for-statements-replacement-test", + "expectedResult": { + "changes": { + "for-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 2 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Added the 'for ;; {\na()\ngoto loop\n}' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 11, + 2 + ] + } + }, + "summary": "Added the 'x := range y' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 15, + 2 + ] + } + }, + "summary": "Added the 'for ;; {\na()\ncontinue loop2\n}' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 16, + 1 + ], + "end": [ + 19, + 2 + ] + } + }, + "summary": "Added the 'i < 10; i++' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 21, + 3 + ], + "end": [ + 21, + 4 + ] + } + }, + "summary": "Added the 'x' identifier in the a(x) function call of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 22, + 1 + ], + "end": [ + 22, + 6 + ] + } + }, + "summary": "Added a break statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the 'loop' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 11, + 2 + ] + } + }, + "summary": "Deleted the 'i := 0; i < 5; i++' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 15, + 2 + ] + } + }, + "summary": "Deleted the 'i < 10; i++' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 16, + 1 + ], + "end": [ + 19, + 2 + ] + } + }, + "summary": "Deleted the 'for ;; {\na()\ncontinue\n}' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 20, + 1 + ], + "end": [ + 23, + 2 + ] + } + }, + "summary": "Deleted the 'x := range y' for statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statements.go" + ], + "patch": [ + "diff --git a/for-statements.go b/for-statements.go", + "index 66e5f7a4..4099658c 100644", + "--- a/for-statements.go", + "+++ b/for-statements.go", + "@@ -1,23 +1,23 @@", + " package main", + " ", + " func main() {", + "- for {", + "+ for ;; {", + " a()", + " goto loop", + " }", + "-for i := 0; i < 5; i++ {", + "+for x := range y {", + " a()", + " break loop", + " }", + "-for ; i < 10; i++ {", + "+for ;; {", + " a()", + " continue loop2", + " }", + "-for ;; {", + "+for ; i < 10; i++ {", + " a()", + " continue", + " }", + "-for x := range y {", + "+for {", + " a(x)", + " break", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5abfa387e21f226e626004f4b0ff9558456bc5db..e16f85f960b0ced7007e35dd0e9bf05a3cd63951" +} +,{ + "testCaseDescription": "go-for-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "for-statements.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'a()' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the 'loop' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 11, + 2 + ] + } + }, + "summary": "Added the 'i := 0; i < 5; i++' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 15, + 2 + ] + } + }, + "summary": "Added the 'i < 10; i++' for statement in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 2 + ], + "end": [ + 7, + 2 + ] + }, + { + "start": [ + 16, + 1 + ], + "end": [ + 19, + 2 + ] + } + ] + }, + "summary": "Replaced the 'for ;; {\na()\ngoto loop\n}' for statement with the 'for ;; {\na()\ncontinue\n}' for statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 21, + 3 + ], + "end": [ + 21, + 4 + ] + } + }, + "summary": "Added the 'x' identifier in the a(x) function call of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 10, + 7 + ], + "end": [ + 10, + 11 + ] + } + }, + "summary": "Deleted the 'loop' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 15, + 2 + ] + } + }, + "summary": "Deleted the 'for ;; {\na()\ncontinue loop2\n}' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 16, + 1 + ], + "end": [ + 19, + 2 + ] + } + }, + "summary": "Deleted the 'i < 10; i++' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 21, + 1 + ], + "end": [ + 21, + 5 + ] + } + }, + "summary": "Deleted the 'a(x)' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 22, + 1 + ], + "end": [ + 22, + 6 + ] + } + }, + "summary": "Deleted a break statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statements.go" + ], + "patch": [ + "diff --git a/for-statements.go b/for-statements.go", + "index 4099658c..66e5f7a4 100644", + "--- a/for-statements.go", + "+++ b/for-statements.go", + "@@ -1,23 +1,23 @@", + " package main", + " ", + " func main() {", + "- for ;; {", + "+ for {", + " a()", + " goto loop", + " }", + "-for x := range y {", + "+for i := 0; i < 5; i++ {", + " a()", + " break loop", + " }", + "-for ;; {", + "+for ; i < 10; i++ {", + " a()", + " continue loop2", + " }", + "-for ; i < 10; i++ {", + "+for ;; {", + " a()", + " continue", + " }", + "-for {", + "+for x := range y {", + " a(x)", + " break", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e16f85f960b0ced7007e35dd0e9bf05a3cd63951..684844812a7399654c951e09eb2ebdb9768f4a2a" +} +,{ + "testCaseDescription": "go-for-statements-delete-insert-test", + "expectedResult": { + "changes": { + "for-statements.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'a()' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the 'loop' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 11, + 2 + ] + } + }, + "summary": "Deleted the 'i := 0; i < 5; i++' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 15, + 2 + ] + } + }, + "summary": "Deleted the 'i < 10; i++' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 16, + 1 + ], + "end": [ + 19, + 2 + ] + } + }, + "summary": "Deleted the 'for ;; {\na()\ncontinue\n}' for statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 20, + 1 + ], + "end": [ + 23, + 2 + ] + } + }, + "summary": "Deleted the 'x := range y' for statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statements.go" + ], + "patch": [ + "diff --git a/for-statements.go b/for-statements.go", + "index 66e5f7a4..79058077 100644", + "--- a/for-statements.go", + "+++ b/for-statements.go", + "@@ -1,24 +1,5 @@", + " package main", + " ", + " func main() {", + "- for {", + "-a()", + "-goto loop", + "-}", + "-for i := 0; i < 5; i++ {", + "-a()", + "-break loop", + "-}", + "-for ; i < 10; i++ {", + "-a()", + "-continue loop2", + "-}", + "-for ;; {", + "-a()", + "-continue", + "-}", + "-for x := range y {", + "-a(x)", + "-break", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "684844812a7399654c951e09eb2ebdb9768f4a2a..19a19906bf854e2f265525156b22f5f511e954c3" +} +,{ + "testCaseDescription": "go-for-statements-teardown-test", + "expectedResult": { + "changes": { + "for-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statements.go" + ], + "patch": [ + "diff --git a/for-statements.go b/for-statements.go", + "index 79058077..e69de29b 100644", + "--- a/for-statements.go", + "+++ b/for-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "19a19906bf854e2f265525156b22f5f511e954c3..f93b93e3865f62d4b7782f4ee60f9029b851186a" +}] diff --git a/test/corpus/diff-summaries/go/function-declarations.json b/test/corpus/diff-summaries/go/function-declarations.json new file mode 100644 index 000000000..f680aca07 --- /dev/null +++ b/test/corpus/diff-summaries/go/function-declarations.json @@ -0,0 +1,514 @@ +[{ + "testCaseDescription": "go-function-declarations-setup-test", + "expectedResult": { + "changes": { + "function-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-declarations.go" + ], + "patch": [ + "diff --git a/function-declarations.go b/function-declarations.go", + "index e69de29b..79058077 100644", + "--- a/function-declarations.go", + "+++ b/function-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f93b93e3865f62d4b7782f4ee60f9029b851186a..d7355a26f3f9a780f8a246c80682e9bd61da1590" +} +,{ + "testCaseDescription": "go-function-declarations-insert-test", + "expectedResult": { + "changes": { + "function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 9, + 1 + ] + } + ] + }, + "summary": "Replaced the 'main' module with 'package main\n\nfunc main() {\nfunc f1() {}\nfunc f2(a int, b, c, d string) int {}\nfunc f2() (int, error) {}\nfunc f2() (result int, err error) {}\n}\n' at line 1, column 1 - line 9, column 1" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-declarations.go" + ], + "patch": [ + "diff --git a/function-declarations.go b/function-declarations.go", + "index 79058077..2a1e7b86 100644", + "--- a/function-declarations.go", + "+++ b/function-declarations.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+func f1() {}", + "+func f2(a int, b, c, d string) int {}", + "+func f2() (int, error) {}", + "+func f2() (result int, err error) {}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d7355a26f3f9a780f8a246c80682e9bd61da1590..13e067d2cca396e5cd315f8e43f62ba9893540b5" +} +,{ + "testCaseDescription": "go-function-declarations-replacement-test", + "expectedResult": { + "changes": { + "function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f1' identifier with the 'fa' identifier in the fa() function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f2' identifier with the 'fb' identifier in the fb function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f2' identifier with the 'fc' identifier in the fc function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f2' identifier with the 'fd' identifier in the fd function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-declarations.go" + ], + "patch": [ + "diff --git a/function-declarations.go b/function-declarations.go", + "index 2a1e7b86..10d0b496 100644", + "--- a/function-declarations.go", + "+++ b/function-declarations.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-func f1() {}", + "-func f2(a int, b, c, d string) int {}", + "-func f2() (int, error) {}", + "-func f2() (result int, err error) {}", + "+func fa() {}", + "+func fb(a int, b, c, d string) int {}", + "+func fc() (int, error) {}", + "+func fd() (result int, err error) {}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "13e067d2cca396e5cd315f8e43f62ba9893540b5..29c9d800fcfa597bdccf3057bb4827c1ebfe7148" +} +,{ + "testCaseDescription": "go-function-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'fa' identifier with the 'f1' identifier in the f1() function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'fb' identifier with the 'f2' identifier in the f2 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'fc' identifier with the 'f2' identifier in the f2 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + } + ] + }, + "summary": "Replaced the 'fd' identifier with the 'f2' identifier in the f2 function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-declarations.go" + ], + "patch": [ + "diff --git a/function-declarations.go b/function-declarations.go", + "index 10d0b496..2a1e7b86 100644", + "--- a/function-declarations.go", + "+++ b/function-declarations.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-func fa() {}", + "-func fb(a int, b, c, d string) int {}", + "-func fc() (int, error) {}", + "-func fd() (result int, err error) {}", + "+func f1() {}", + "+func f2(a int, b, c, d string) int {}", + "+func f2() (int, error) {}", + "+func f2() (result int, err error) {}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "29c9d800fcfa597bdccf3057bb4827c1ebfe7148..1e348e167bda850a7b4e0b13d9273364852e6a78" +} +,{ + "testCaseDescription": "go-function-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 9, + 1 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced 'package main\n\nfunc main() {\nfunc f1() {}\nfunc f2(a int, b, c, d string) int {}\nfunc f2() (int, error) {}\nfunc f2() (result int, err error) {}\n}\n' at line 1, column 1 - line 9, column 1 with the 'main' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-declarations.go" + ], + "patch": [ + "diff --git a/function-declarations.go b/function-declarations.go", + "index 2a1e7b86..79058077 100644", + "--- a/function-declarations.go", + "+++ b/function-declarations.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-func f1() {}", + "-func f2(a int, b, c, d string) int {}", + "-func f2() (int, error) {}", + "-func f2() (result int, err error) {}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1e348e167bda850a7b4e0b13d9273364852e6a78..0f0e6a61a99794f159dc3dd2b347670d2c2c1fca" +} +,{ + "testCaseDescription": "go-function-declarations-teardown-test", + "expectedResult": { + "changes": { + "function-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-declarations.go" + ], + "patch": [ + "diff --git a/function-declarations.go b/function-declarations.go", + "index 79058077..e69de29b 100644", + "--- a/function-declarations.go", + "+++ b/function-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0f0e6a61a99794f159dc3dd2b347670d2c2c1fca..a2dfb03fc1f7dc5419ac9aa570a15071f5eeeeea" +}] diff --git a/test/corpus/diff-summaries/go/function-literals.json b/test/corpus/diff-summaries/go/function-literals.json new file mode 100644 index 000000000..829d810d1 --- /dev/null +++ b/test/corpus/diff-summaries/go/function-literals.json @@ -0,0 +1,372 @@ +[{ + "testCaseDescription": "go-function-literals-setup-test", + "expectedResult": { + "changes": { + "function-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-literals.go" + ], + "patch": [ + "diff --git a/function-literals.go b/function-literals.go", + "index e69de29b..79058077 100644", + "--- a/function-literals.go", + "+++ b/function-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0bd1a3a45c722927b5d7c0c96d296bc01c1b333c..e84e197d4ad2ff9748e305c50db4e72c1c1a3ddc" +} +,{ + "testCaseDescription": "go-function-literals-insert-test", + "expectedResult": { + "changes": { + "function-literals.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 7 + ], + "end": [ + 6, + 2 + ] + } + }, + "summary": "Added the 's1' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-literals.go" + ], + "patch": [ + "diff --git a/function-literals.go b/function-literals.go", + "index 79058077..1f4ead96 100644", + "--- a/function-literals.go", + "+++ b/function-literals.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "-", + "+const s1 = func(s string) (int, int) {", + "+return 1, 2", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e84e197d4ad2ff9748e305c50db4e72c1c1a3ddc..addd75371b5ff3d7fa0be9cde0077c7e1bfabc7f" +} +,{ + "testCaseDescription": "go-function-literals-replacement-test", + "expectedResult": { + "changes": { + "function-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 25 + ] + }, + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 22 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the s1 var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 17 + ], + "end": [ + 4, + 18 + ] + }, + { + "start": [ + 4, + 17 + ], + "end": [ + 4, + 18 + ] + } + ] + }, + "summary": "Replaced the 's' identifier with the 'b' identifier in the s1 var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-literals.go" + ], + "patch": [ + "diff --git a/function-literals.go b/function-literals.go", + "index 1f4ead96..7b034662 100644", + "--- a/function-literals.go", + "+++ b/function-literals.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-const s1 = func(s string) (int, int) {", + "+const s1 = func(b int) (string, string) {", + " return 1, 2", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "addd75371b5ff3d7fa0be9cde0077c7e1bfabc7f..21f5491b18b039ca6af88708ec576aa145bb7047" +} +,{ + "testCaseDescription": "go-function-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "function-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 22 + ] + }, + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 25 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the s1 var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 17 + ], + "end": [ + 4, + 18 + ] + }, + { + "start": [ + 4, + 17 + ], + "end": [ + 4, + 18 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 's' identifier in the s1 var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-literals.go" + ], + "patch": [ + "diff --git a/function-literals.go b/function-literals.go", + "index 7b034662..1f4ead96 100644", + "--- a/function-literals.go", + "+++ b/function-literals.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-const s1 = func(b int) (string, string) {", + "+const s1 = func(s string) (int, int) {", + " return 1, 2", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "21f5491b18b039ca6af88708ec576aa145bb7047..561ce05b87512b5ff6f76bba46d49525479a40d3" +} +,{ + "testCaseDescription": "go-function-literals-delete-insert-test", + "expectedResult": { + "changes": { + "function-literals.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 7 + ], + "end": [ + 6, + 2 + ] + } + }, + "summary": "Deleted the 's1' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-literals.go" + ], + "patch": [ + "diff --git a/function-literals.go b/function-literals.go", + "index 1f4ead96..79058077 100644", + "--- a/function-literals.go", + "+++ b/function-literals.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "-const s1 = func(s string) (int, int) {", + "-return 1, 2", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "561ce05b87512b5ff6f76bba46d49525479a40d3..61be591e14b1ffb3ddbbfda5d996c340a2b0d221" +} +,{ + "testCaseDescription": "go-function-literals-teardown-test", + "expectedResult": { + "changes": { + "function-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-literals.go" + ], + "patch": [ + "diff --git a/function-literals.go b/function-literals.go", + "index 79058077..e69de29b 100644", + "--- a/function-literals.go", + "+++ b/function-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "61be591e14b1ffb3ddbbfda5d996c340a2b0d221..d01762bbba4dab11931c77b7e92313b7e8ac8f8d" +}] diff --git a/test/corpus/diff-summaries/go/function-types.json b/test/corpus/diff-summaries/go/function-types.json new file mode 100644 index 000000000..68722561e --- /dev/null +++ b/test/corpus/diff-summaries/go/function-types.json @@ -0,0 +1,664 @@ +[{ + "testCaseDescription": "go-function-types-setup-test", + "expectedResult": { + "changes": { + "function-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-types.go" + ], + "patch": [ + "diff --git a/function-types.go b/function-types.go", + "index e69de29b..79058077 100644", + "--- a/function-types.go", + "+++ b/function-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4c1430949679a459f5530eccab8efc8046a3abc7..44bcc1bef35e52f11a6dcc5dc12eecdfd3a93835" +} +,{ + "testCaseDescription": "go-function-types-insert-test", + "expectedResult": { + "changes": { + "function-types.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 16 + ] + } + }, + "summary": "Added the 'a' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 34 + ] + } + }, + "summary": "Added the 'b' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-types.go" + ], + "patch": [ + "diff --git a/function-types.go b/function-types.go", + "index 79058077..eebe42e8 100644", + "--- a/function-types.go", + "+++ b/function-types.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+type (", + "+a func(int) int", + "+b func(int, string) (bool, error)", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "44bcc1bef35e52f11a6dcc5dc12eecdfd3a93835..683f9831d02133c7f3f525ebf76a30bdc840d653" +} +,{ + "testCaseDescription": "go-function-types-replacement-test", + "expectedResult": { + "changes": { + "function-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the 'x' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 11 + ] + }, + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 14 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the func(string) string function type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 13 + ], + "end": [ + 5, + 16 + ] + }, + { + "start": [ + 5, + 16 + ], + "end": [ + 5, + 22 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the func(string) string function type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the 'y' type declaration of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 8 + ], + "end": [ + 6, + 11 + ] + } + }, + "summary": "Deleted the 'int' identifier in the func(string, int) (chan, error) function type of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 16 + ], + "end": [ + 6, + 19 + ] + } + }, + "summary": "Added the 'int' identifier in the func(string, int) (chan, error) function type of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 22 + ], + "end": [ + 6, + 33 + ] + } + }, + "summary": "Added the 'chan, error' parameter declaration in the func(string, int) (chan, error) function type of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 22 + ], + "end": [ + 6, + 26 + ] + } + }, + "summary": "Deleted the 'bool' identifier in the func(string, int) (chan, error) function type of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 28 + ], + "end": [ + 6, + 33 + ] + } + }, + "summary": "Deleted the 'error' identifier in the func(string, int) (chan, error) function type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-types.go" + ], + "patch": [ + "diff --git a/function-types.go b/function-types.go", + "index eebe42e8..2ae1953b 100644", + "--- a/function-types.go", + "+++ b/function-types.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " type (", + "-a func(int) int", + "-b func(int, string) (bool, error)", + "+x func(string) string", + "+y func(string, int) (chan, error)", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "683f9831d02133c7f3f525ebf76a30bdc840d653..153f9a956d3f1b0c8003db879adc015402b483f2" +} +,{ + "testCaseDescription": "go-function-types-delete-replacement-test", + "expectedResult": { + "changes": { + "function-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 14 + ] + }, + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 11 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the func(int) int function type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 16 + ], + "end": [ + 5, + 22 + ] + }, + { + "start": [ + 5, + 13 + ], + "end": [ + 5, + 16 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the func(int) int function type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the 'b' type declaration of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 8 + ], + "end": [ + 6, + 14 + ] + } + }, + "summary": "Deleted the 'string' identifier in the func(int, string) (bool, error) function type of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 13 + ], + "end": [ + 6, + 19 + ] + } + }, + "summary": "Added the 'string' identifier in the func(int, string) (bool, error) function type of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 22 + ], + "end": [ + 6, + 26 + ] + } + }, + "summary": "Added the 'bool' identifier in the func(int, string) (bool, error) function type of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 28 + ], + "end": [ + 6, + 33 + ] + } + }, + "summary": "Added the 'error' identifier in the func(int, string) (bool, error) function type of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 22 + ], + "end": [ + 6, + 33 + ] + } + }, + "summary": "Deleted the 'chan, error' parameter declaration in the func(int, string) (bool, error) function type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-types.go" + ], + "patch": [ + "diff --git a/function-types.go b/function-types.go", + "index 2ae1953b..eebe42e8 100644", + "--- a/function-types.go", + "+++ b/function-types.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " type (", + "-x func(string) string", + "-y func(string, int) (chan, error)", + "+a func(int) int", + "+b func(int, string) (bool, error)", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "153f9a956d3f1b0c8003db879adc015402b483f2..a3517d72e1f9ebf404d3b3dca5c70f64e70da7ca" +} +,{ + "testCaseDescription": "go-function-types-delete-insert-test", + "expectedResult": { + "changes": { + "function-types.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 16 + ] + } + }, + "summary": "Deleted the 'a' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 34 + ] + } + }, + "summary": "Deleted the 'b' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-types.go" + ], + "patch": [ + "diff --git a/function-types.go b/function-types.go", + "index eebe42e8..79058077 100644", + "--- a/function-types.go", + "+++ b/function-types.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-type (", + "-a func(int) int", + "-b func(int, string) (bool, error)", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a3517d72e1f9ebf404d3b3dca5c70f64e70da7ca..89769cc54aeef8364ec696d7b360e3f03355eb07" +} +,{ + "testCaseDescription": "go-function-types-teardown-test", + "expectedResult": { + "changes": { + "function-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-types.go" + ], + "patch": [ + "diff --git a/function-types.go b/function-types.go", + "index 79058077..e69de29b 100644", + "--- a/function-types.go", + "+++ b/function-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "89769cc54aeef8364ec696d7b360e3f03355eb07..f9b33be201f4f793e957567b70eebec7be3a69a2" +}] diff --git a/test/corpus/diff-summaries/go/go-and-defer-statements.json b/test/corpus/diff-summaries/go/go-and-defer-statements.json new file mode 100644 index 000000000..8450aca26 --- /dev/null +++ b/test/corpus/diff-summaries/go/go-and-defer-statements.json @@ -0,0 +1,508 @@ +[{ + "testCaseDescription": "go-go-and-defer-statements-setup-test", + "expectedResult": { + "changes": { + "go-and-defer-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "go-and-defer-statements.go" + ], + "patch": [ + "diff --git a/go-and-defer-statements.go b/go-and-defer-statements.go", + "index e69de29b..79058077 100644", + "--- a/go-and-defer-statements.go", + "+++ b/go-and-defer-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3ae31b84db1d8419897111182e8fdc9cad60fbbc..6ed2edc3b4005b0719c48ab5feb3ea1b6b3daa9e" +} +,{ + "testCaseDescription": "go-go-and-defer-statements-insert-test", + "expectedResult": { + "changes": { + "go-and-defer-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 12 + ] + } + }, + "summary": "Added the 'x[y]()' defer statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the 'x[y]()' go statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "go-and-defer-statements.go" + ], + "patch": [ + "diff --git a/go-and-defer-statements.go b/go-and-defer-statements.go", + "index 79058077..4eab4994 100644", + "--- a/go-and-defer-statements.go", + "+++ b/go-and-defer-statements.go", + "@@ -1,5 +1,6 @@", + " package main", + " ", + " func main() {", + "-", + "+defer x.y()", + "+go x.y()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6ed2edc3b4005b0719c48ab5feb3ea1b6b3daa9e..a38b696b502320ca19a328372be89961fb958841" +} +,{ + "testCaseDescription": "go-go-and-defer-statements-replacement-test", + "expectedResult": { + "changes": { + "go-and-defer-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the a[b] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the a[b] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 5 + ] + }, + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 5 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'c' identifier in the c[d] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'd' identifier in the c[d] subscript access of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "go-and-defer-statements.go" + ], + "patch": [ + "diff --git a/go-and-defer-statements.go b/go-and-defer-statements.go", + "index 4eab4994..0537c4bc 100644", + "--- a/go-and-defer-statements.go", + "+++ b/go-and-defer-statements.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-defer x.y()", + "-go x.y()", + "+defer a.b()", + "+go c.d()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a38b696b502320ca19a328372be89961fb958841..740493f5b68581152933f89ec89f7e31859ad26e" +} +,{ + "testCaseDescription": "go-go-and-defer-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "go-and-defer-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the x[y] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the x[y] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 5 + ] + }, + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 5 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'x' identifier in the x[y] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + } + ] + }, + "summary": "Replaced the 'd' identifier with the 'y' identifier in the x[y] subscript access of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "go-and-defer-statements.go" + ], + "patch": [ + "diff --git a/go-and-defer-statements.go b/go-and-defer-statements.go", + "index 0537c4bc..4eab4994 100644", + "--- a/go-and-defer-statements.go", + "+++ b/go-and-defer-statements.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-defer a.b()", + "-go c.d()", + "+defer x.y()", + "+go x.y()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "740493f5b68581152933f89ec89f7e31859ad26e..5f8b90d561badd65eac8ae43d7dfb57aa81c060f" +} +,{ + "testCaseDescription": "go-go-and-defer-statements-delete-insert-test", + "expectedResult": { + "changes": { + "go-and-defer-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 12 + ] + } + }, + "summary": "Deleted the 'x[y]()' defer statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the 'x[y]()' go statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "go-and-defer-statements.go" + ], + "patch": [ + "diff --git a/go-and-defer-statements.go b/go-and-defer-statements.go", + "index 4eab4994..79058077 100644", + "--- a/go-and-defer-statements.go", + "+++ b/go-and-defer-statements.go", + "@@ -1,6 +1,5 @@", + " package main", + " ", + " func main() {", + "-defer x.y()", + "-go x.y()", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5f8b90d561badd65eac8ae43d7dfb57aa81c060f..4db2085bcd5be639e82d878fd9ac0090e2c13caf" +} +,{ + "testCaseDescription": "go-go-and-defer-statements-teardown-test", + "expectedResult": { + "changes": { + "go-and-defer-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "go-and-defer-statements.go" + ], + "patch": [ + "diff --git a/go-and-defer-statements.go b/go-and-defer-statements.go", + "index 79058077..e69de29b 100644", + "--- a/go-and-defer-statements.go", + "+++ b/go-and-defer-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4db2085bcd5be639e82d878fd9ac0090e2c13caf..3b8c04146e306d10e05370f01c662eccc49a57d3" +}] diff --git a/test/corpus/diff-summaries/go/grouped-import-declarations.json b/test/corpus/diff-summaries/go/grouped-import-declarations.json new file mode 100644 index 000000000..e835f2bdc --- /dev/null +++ b/test/corpus/diff-summaries/go/grouped-import-declarations.json @@ -0,0 +1,502 @@ +[{ + "testCaseDescription": "go-grouped-import-declarations-setup-test", + "expectedResult": { + "changes": { + "grouped-import-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-import-declarations.go" + ], + "patch": [ + "diff --git a/grouped-import-declarations.go b/grouped-import-declarations.go", + "index e69de29b..79058077 100644", + "--- a/grouped-import-declarations.go", + "+++ b/grouped-import-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "12035f69827bc37748c981b2b49d8642aaa48689..eff2e3eee4a7e0856d96a64e59118c6dbae4910e" +} +,{ + "testCaseDescription": "go-grouped-import-declarations-insert-test", + "expectedResult": { + "changes": { + "grouped-import-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added the 'import' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 11 + ] + } + }, + "summary": "Added the \"net/http\" string in the main function" + } + ] + }, + "errors": { + "grouped-import-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 6, + 3 + ], + "end": [ + 7, + 23 + ] + } + }, + "summary": "Added '. \"some/dsl\"\n alias \"some/package\"' at line 6, column 3 - line 7, column 23 in the main function" + } + ] + } + }, + "filePaths": [ + "grouped-import-declarations.go" + ], + "patch": [ + "diff --git a/grouped-import-declarations.go b/grouped-import-declarations.go", + "index 79058077..b544dded 100644", + "--- a/grouped-import-declarations.go", + "+++ b/grouped-import-declarations.go", + "@@ -1,5 +1,9 @@", + " package main", + " ", + " func main() {", + "-", + "+import (", + "+\"net/http\"", + "+ . \"some/dsl\"", + "+ alias \"some/package\"", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "eff2e3eee4a7e0856d96a64e59118c6dbae4910e..295d40d0bc277f37497e652ee55447ee4c5ac0a7" +} +,{ + "testCaseDescription": "go-grouped-import-declarations-replacement-test", + "expectedResult": { + "changes": { + "grouped-import-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 11 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced the \"net/http\" string with the \"net/socket\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 15 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 16 + ] + } + ] + }, + "summary": "Replaced the \"some/dsl\" string with the \"types/dsl\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 9 + ], + "end": [ + 7, + 23 + ] + }, + { + "start": [ + 7, + 9 + ], + "end": [ + 7, + 26 + ] + } + ] + }, + "summary": "Replaced the \"some/package\" string with the \"awesome/package\" string in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-import-declarations.go" + ], + "patch": [ + "diff --git a/grouped-import-declarations.go b/grouped-import-declarations.go", + "index b544dded..1fd89e1d 100644", + "--- a/grouped-import-declarations.go", + "+++ b/grouped-import-declarations.go", + "@@ -2,8 +2,8 @@ package main", + " ", + " func main() {", + " import (", + "-\"net/http\"", + "- . \"some/dsl\"", + "- alias \"some/package\"", + "+\"net/socket\"", + "+ . \"types/dsl\"", + "+ alias \"awesome/package\"", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "295d40d0bc277f37497e652ee55447ee4c5ac0a7..c32dfbb52c8204e14270d26c78a68a58bc479515" +} +,{ + "testCaseDescription": "go-grouped-import-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "grouped-import-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 11 + ] + } + ] + }, + "summary": "Replaced the \"net/socket\" string with the \"net/http\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 16 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 15 + ] + } + ] + }, + "summary": "Replaced the \"types/dsl\" string with the \"some/dsl\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 9 + ], + "end": [ + 7, + 26 + ] + }, + { + "start": [ + 7, + 9 + ], + "end": [ + 7, + 23 + ] + } + ] + }, + "summary": "Replaced the \"awesome/package\" string with the \"some/package\" string in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-import-declarations.go" + ], + "patch": [ + "diff --git a/grouped-import-declarations.go b/grouped-import-declarations.go", + "index 1fd89e1d..b544dded 100644", + "--- a/grouped-import-declarations.go", + "+++ b/grouped-import-declarations.go", + "@@ -2,8 +2,8 @@ package main", + " ", + " func main() {", + " import (", + "-\"net/socket\"", + "- . \"types/dsl\"", + "- alias \"awesome/package\"", + "+\"net/http\"", + "+ . \"some/dsl\"", + "+ alias \"some/package\"", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c32dfbb52c8204e14270d26c78a68a58bc479515..e7a6284b55079ce702e22d5969233216eab277bd" +} +,{ + "testCaseDescription": "go-grouped-import-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "grouped-import-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Deleted the 'import' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 11 + ] + } + }, + "summary": "Deleted the \"net/http\" string in the main function" + } + ] + }, + "errors": { + "grouped-import-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 6, + 3 + ], + "end": [ + 7, + 23 + ] + } + }, + "summary": "Deleted '. \"some/dsl\"\n alias \"some/package\"' at line 6, column 3 - line 7, column 23 in the main function" + } + ] + } + }, + "filePaths": [ + "grouped-import-declarations.go" + ], + "patch": [ + "diff --git a/grouped-import-declarations.go b/grouped-import-declarations.go", + "index b544dded..79058077 100644", + "--- a/grouped-import-declarations.go", + "+++ b/grouped-import-declarations.go", + "@@ -1,9 +1,5 @@", + " package main", + " ", + " func main() {", + "-import (", + "-\"net/http\"", + "- . \"some/dsl\"", + "- alias \"some/package\"", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e7a6284b55079ce702e22d5969233216eab277bd..f6d4df70af940f4460d01709872dbb2bc95fab0b" +} +,{ + "testCaseDescription": "go-grouped-import-declarations-teardown-test", + "expectedResult": { + "changes": { + "grouped-import-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-import-declarations.go" + ], + "patch": [ + "diff --git a/grouped-import-declarations.go b/grouped-import-declarations.go", + "index 79058077..e69de29b 100644", + "--- a/grouped-import-declarations.go", + "+++ b/grouped-import-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f6d4df70af940f4460d01709872dbb2bc95fab0b..c578d4a9262098e37c81793dbf2fcdb3834ed7fc" +}] diff --git a/test/corpus/diff-summaries/go/grouped-var-declarations.json b/test/corpus/diff-summaries/go/grouped-var-declarations.json new file mode 100644 index 000000000..f1586394b --- /dev/null +++ b/test/corpus/diff-summaries/go/grouped-var-declarations.json @@ -0,0 +1,406 @@ +[{ + "testCaseDescription": "go-grouped-var-declarations-setup-test", + "expectedResult": { + "changes": { + "grouped-var-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-var-declarations.go" + ], + "patch": [ + "diff --git a/grouped-var-declarations.go b/grouped-var-declarations.go", + "index e69de29b..79058077 100644", + "--- a/grouped-var-declarations.go", + "+++ b/grouped-var-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "2962e40e4009fc06a09468b0ecd4187635094a76..884bc1a5d0bacd67e3a02792464ea8213a4126c3" +} +,{ + "testCaseDescription": "go-grouped-var-declarations-insert-test", + "expectedResult": { + "changes": { + "grouped-var-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the 'zero' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Added the 'one' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-var-declarations.go" + ], + "patch": [ + "diff --git a/grouped-var-declarations.go b/grouped-var-declarations.go", + "index 79058077..cdb45b39 100644", + "--- a/grouped-var-declarations.go", + "+++ b/grouped-var-declarations.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+var (", + "+zero = 0", + "+one = 1", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "884bc1a5d0bacd67e3a02792464ea8213a4126c3..df53f451e366a34ba6fd6baee18b2e444fc434ee" +} +,{ + "testCaseDescription": "go-grouped-var-declarations-replacement-test", + "expectedResult": { + "changes": { + "grouped-var-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 5 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + } + ] + }, + "summary": "Replaced the 'zero' identifier with the 'a' identifier in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 4 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'b' identifier in the b var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-var-declarations.go" + ], + "patch": [ + "diff --git a/grouped-var-declarations.go b/grouped-var-declarations.go", + "index cdb45b39..806a5935 100644", + "--- a/grouped-var-declarations.go", + "+++ b/grouped-var-declarations.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " var (", + "-zero = 0", + "-one = 1", + "+a = 0", + "+b = 1", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "df53f451e366a34ba6fd6baee18b2e444fc434ee..7f1ce25e524ed238858cb98d017ac74e41165eed" +} +,{ + "testCaseDescription": "go-grouped-var-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "grouped-var-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 2 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 5 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'zero' identifier in the zero var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 2 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 4 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'one' identifier in the one var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-var-declarations.go" + ], + "patch": [ + "diff --git a/grouped-var-declarations.go b/grouped-var-declarations.go", + "index 806a5935..cdb45b39 100644", + "--- a/grouped-var-declarations.go", + "+++ b/grouped-var-declarations.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " var (", + "-a = 0", + "-b = 1", + "+zero = 0", + "+one = 1", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7f1ce25e524ed238858cb98d017ac74e41165eed..4dfb3932039d2ff238e0ea11fc1bec4873399ef7" +} +,{ + "testCaseDescription": "go-grouped-var-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "grouped-var-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the 'zero' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Deleted the 'one' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-var-declarations.go" + ], + "patch": [ + "diff --git a/grouped-var-declarations.go b/grouped-var-declarations.go", + "index cdb45b39..79058077 100644", + "--- a/grouped-var-declarations.go", + "+++ b/grouped-var-declarations.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-var (", + "-zero = 0", + "-one = 1", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4dfb3932039d2ff238e0ea11fc1bec4873399ef7..a9b559a84f698fe454c016fcb5458c3e71fd5416" +} +,{ + "testCaseDescription": "go-grouped-var-declarations-teardown-test", + "expectedResult": { + "changes": { + "grouped-var-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "grouped-var-declarations.go" + ], + "patch": [ + "diff --git a/grouped-var-declarations.go b/grouped-var-declarations.go", + "index 79058077..e69de29b 100644", + "--- a/grouped-var-declarations.go", + "+++ b/grouped-var-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a9b559a84f698fe454c016fcb5458c3e71fd5416..4b10b6ade6ce2758e1727d4e03710722cb374ec6" +}] diff --git a/test/corpus/diff-summaries/go/if-statements.json b/test/corpus/diff-summaries/go/if-statements.json new file mode 100644 index 000000000..6df9ef2d5 --- /dev/null +++ b/test/corpus/diff-summaries/go/if-statements.json @@ -0,0 +1,518 @@ +[{ + "testCaseDescription": "go-if-statements-setup-test", + "expectedResult": { + "changes": { + "if-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-statements.go" + ], + "patch": [ + "diff --git a/if-statements.go b/if-statements.go", + "index e69de29b..79058077 100644", + "--- a/if-statements.go", + "+++ b/if-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "844563260fa09b99d4cf94ec2ba5a65d9a5e6ded..7f05d434eeb7d4e475e8a5fefb8921bb958cc60d" +} +,{ + "testCaseDescription": "go-if-statements-insert-test", + "expectedResult": { + "changes": { + "if-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 2 + ] + } + }, + "summary": "Added the 'a()' if statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 9, + 2 + ] + } + }, + "summary": "Added the 'a := b()' if statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 14, + 2 + ] + } + }, + "summary": "Added the 'a()' if statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-statements.go" + ], + "patch": [ + "diff --git a/if-statements.go b/if-statements.go", + "index 79058077..76a6f335 100644", + "--- a/if-statements.go", + "+++ b/if-statements.go", + "@@ -1,5 +1,15 @@", + " package main", + " ", + " func main() {", + "-", + "+if a() {", + "+b()", + "+}", + "+if a := b(); c {", + "+d()", + "+}", + "+if a() {", + "+b()", + "+} else {", + "+c()", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7f05d434eeb7d4e475e8a5fefb8921bb958cc60d..045dae9fcac53782ce8bc04cd7d8b97eec6c13ca" +} +,{ + "testCaseDescription": "go-if-statements-replacement-test", + "expectedResult": { + "changes": { + "if-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the x() function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 4 + ], + "end": [ + 7, + 5 + ] + }, + { + "start": [ + 7, + 4 + ], + "end": [ + 7, + 5 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'y' identifier in the 'y := b()' if statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 10, + 4 + ], + "end": [ + 10, + 5 + ] + }, + { + "start": [ + 10, + 4 + ], + "end": [ + 10, + 5 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'z' identifier in the z() function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-statements.go" + ], + "patch": [ + "diff --git a/if-statements.go b/if-statements.go", + "index 76a6f335..39dfc0da 100644", + "--- a/if-statements.go", + "+++ b/if-statements.go", + "@@ -1,13 +1,13 @@", + " package main", + " ", + " func main() {", + "-if a() {", + "+if x() {", + " b()", + " }", + "-if a := b(); c {", + "+if y := b(); c {", + " d()", + " }", + "-if a() {", + "+if z() {", + " b()", + " } else {", + " c()" + ], + "gitDir": "test/corpus/repos/go", + "shas": "045dae9fcac53782ce8bc04cd7d8b97eec6c13ca..868fa819f5e273f493e8292b74593b773aa86193" +} +,{ + "testCaseDescription": "go-if-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "if-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the a() function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 4 + ], + "end": [ + 7, + 5 + ] + }, + { + "start": [ + 7, + 4 + ], + "end": [ + 7, + 5 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'a' identifier in the 'a := b()' if statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 10, + 4 + ], + "end": [ + 10, + 5 + ] + }, + { + "start": [ + 10, + 4 + ], + "end": [ + 10, + 5 + ] + } + ] + }, + "summary": "Replaced the 'z' identifier with the 'a' identifier in the a() function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-statements.go" + ], + "patch": [ + "diff --git a/if-statements.go b/if-statements.go", + "index 39dfc0da..76a6f335 100644", + "--- a/if-statements.go", + "+++ b/if-statements.go", + "@@ -1,13 +1,13 @@", + " package main", + " ", + " func main() {", + "-if x() {", + "+if a() {", + " b()", + " }", + "-if y := b(); c {", + "+if a := b(); c {", + " d()", + " }", + "-if z() {", + "+if a() {", + " b()", + " } else {", + " c()" + ], + "gitDir": "test/corpus/repos/go", + "shas": "868fa819f5e273f493e8292b74593b773aa86193..53b5caeb25eac5493b68833e1139e280166f49ac" +} +,{ + "testCaseDescription": "go-if-statements-delete-insert-test", + "expectedResult": { + "changes": { + "if-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 2 + ] + } + }, + "summary": "Deleted the 'a()' if statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 9, + 2 + ] + } + }, + "summary": "Deleted the 'a := b()' if statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 14, + 2 + ] + } + }, + "summary": "Deleted the 'a()' if statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-statements.go" + ], + "patch": [ + "diff --git a/if-statements.go b/if-statements.go", + "index 76a6f335..79058077 100644", + "--- a/if-statements.go", + "+++ b/if-statements.go", + "@@ -1,15 +1,5 @@", + " package main", + " ", + " func main() {", + "-if a() {", + "-b()", + "-}", + "-if a := b(); c {", + "-d()", + "-}", + "-if a() {", + "-b()", + "-} else {", + "-c()", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "53b5caeb25eac5493b68833e1139e280166f49ac..0e1909c5e43a050032b2698a2f3e00d8598de19b" +} +,{ + "testCaseDescription": "go-if-statements-teardown-test", + "expectedResult": { + "changes": { + "if-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-statements.go" + ], + "patch": [ + "diff --git a/if-statements.go b/if-statements.go", + "index 79058077..e69de29b 100644", + "--- a/if-statements.go", + "+++ b/if-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0e1909c5e43a050032b2698a2f3e00d8598de19b..1f7119ceb53f8159ac2330bdb3c78e76a19a5ed0" +}] diff --git a/test/corpus/diff-summaries/go/imaginary-literals.json b/test/corpus/diff-summaries/go/imaginary-literals.json new file mode 100644 index 000000000..a34e2f6a2 --- /dev/null +++ b/test/corpus/diff-summaries/go/imaginary-literals.json @@ -0,0 +1,406 @@ +[{ + "testCaseDescription": "go-imaginary-literals-setup-test", + "expectedResult": { + "changes": { + "imaginary-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "imaginary-literals.go" + ], + "patch": [ + "diff --git a/imaginary-literals.go b/imaginary-literals.go", + "index e69de29b..79058077 100644", + "--- a/imaginary-literals.go", + "+++ b/imaginary-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d16e448af6bd6f785de25d685b7bceabce571049..f71342e1048bf05281d4e8df930dcdb62f2a6cd3" +} +,{ + "testCaseDescription": "go-imaginary-literals-insert-test", + "expectedResult": { + "changes": { + "imaginary-literals.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Added the 'a' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 13 + ] + } + }, + "summary": "Added the 'b' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "imaginary-literals.go" + ], + "patch": [ + "diff --git a/imaginary-literals.go b/imaginary-literals.go", + "index 79058077..25a97daf 100644", + "--- a/imaginary-literals.go", + "+++ b/imaginary-literals.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+const (", + "+a = 01i", + "+b = 1.e+100i", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f71342e1048bf05281d4e8df930dcdb62f2a6cd3..9457a18efe8999b143097ce802e90ab5a9020d1d" +} +,{ + "testCaseDescription": "go-imaginary-literals-replacement-test", + "expectedResult": { + "changes": { + "imaginary-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the '01i' imaginary_literal with the '02i' imaginary_literal in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 13 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 13 + ] + } + ] + }, + "summary": "Replaced the '1.e+100i' imaginary_literal with the '1.e+103i' imaginary_literal in the b var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "imaginary-literals.go" + ], + "patch": [ + "diff --git a/imaginary-literals.go b/imaginary-literals.go", + "index 25a97daf..151a5338 100644", + "--- a/imaginary-literals.go", + "+++ b/imaginary-literals.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " const (", + "-a = 01i", + "-b = 1.e+100i", + "+a = 02i", + "+b = 1.e+103i", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9457a18efe8999b143097ce802e90ab5a9020d1d..1aab20401433fa70de2977b9e184e5ed176041a1" +} +,{ + "testCaseDescription": "go-imaginary-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "imaginary-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the '02i' imaginary_literal with the '01i' imaginary_literal in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 13 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 13 + ] + } + ] + }, + "summary": "Replaced the '1.e+103i' imaginary_literal with the '1.e+100i' imaginary_literal in the b var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "imaginary-literals.go" + ], + "patch": [ + "diff --git a/imaginary-literals.go b/imaginary-literals.go", + "index 151a5338..25a97daf 100644", + "--- a/imaginary-literals.go", + "+++ b/imaginary-literals.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " const (", + "-a = 02i", + "-b = 1.e+103i", + "+a = 01i", + "+b = 1.e+100i", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1aab20401433fa70de2977b9e184e5ed176041a1..6e2594b50b22760d63f502a228d701e5124b005b" +} +,{ + "testCaseDescription": "go-imaginary-literals-delete-insert-test", + "expectedResult": { + "changes": { + "imaginary-literals.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Deleted the 'a' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 13 + ] + } + }, + "summary": "Deleted the 'b' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "imaginary-literals.go" + ], + "patch": [ + "diff --git a/imaginary-literals.go b/imaginary-literals.go", + "index 25a97daf..79058077 100644", + "--- a/imaginary-literals.go", + "+++ b/imaginary-literals.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-const (", + "-a = 01i", + "-b = 1.e+100i", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6e2594b50b22760d63f502a228d701e5124b005b..06b206c0083b17c4656006fdaf32ea3e228c94b8" +} +,{ + "testCaseDescription": "go-imaginary-literals-teardown-test", + "expectedResult": { + "changes": { + "imaginary-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "imaginary-literals.go" + ], + "patch": [ + "diff --git a/imaginary-literals.go b/imaginary-literals.go", + "index 79058077..e69de29b 100644", + "--- a/imaginary-literals.go", + "+++ b/imaginary-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "06b206c0083b17c4656006fdaf32ea3e228c94b8..eb189cbc2630347c2b2e4e69f5fb5f1cd5284c7d" +}] diff --git a/test/corpus/diff-summaries/go/increment-decrement-statements.json b/test/corpus/diff-summaries/go/increment-decrement-statements.json new file mode 100644 index 000000000..1b05715cc --- /dev/null +++ b/test/corpus/diff-summaries/go/increment-decrement-statements.json @@ -0,0 +1,406 @@ +[{ + "testCaseDescription": "go-increment-decrement-statements-setup-test", + "expectedResult": { + "changes": { + "increment-decrement-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "increment-decrement-statements.go" + ], + "patch": [ + "diff --git a/increment-decrement-statements.go b/increment-decrement-statements.go", + "index e69de29b..79058077 100644", + "--- a/increment-decrement-statements.go", + "+++ b/increment-decrement-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "759bcc1def9029c1f75c6355dc3d149aad453526..139accc79873485c0588a2cf9c5875872cd62038" +} +,{ + "testCaseDescription": "go-increment-decrement-statements-insert-test", + "expectedResult": { + "changes": { + "increment-decrement-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'i++' increment statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'j--' decrement statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "increment-decrement-statements.go" + ], + "patch": [ + "diff --git a/increment-decrement-statements.go b/increment-decrement-statements.go", + "index 79058077..18bf03a2 100644", + "--- a/increment-decrement-statements.go", + "+++ b/increment-decrement-statements.go", + "@@ -1,5 +1,6 @@", + " package main", + " ", + " func main() {", + "-", + "+i++", + "+j--", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "139accc79873485c0588a2cf9c5875872cd62038..8de9cb1905b2ebbc1ed26f35f80f40863b07a34a" +} +,{ + "testCaseDescription": "go-increment-decrement-statements-replacement-test", + "expectedResult": { + "changes": { + "increment-decrement-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the 'i++' increment statement with the 'foo++' increment statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'x++' increment statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'j--' decrement statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "increment-decrement-statements.go" + ], + "patch": [ + "diff --git a/increment-decrement-statements.go b/increment-decrement-statements.go", + "index 18bf03a2..08611ad4 100644", + "--- a/increment-decrement-statements.go", + "+++ b/increment-decrement-statements.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-i++", + "-j--", + "+foo++", + "+x++", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8de9cb1905b2ebbc1ed26f35f80f40863b07a34a..cf96716d214016e3d91b7389e07e3ad195f2a70d" +} +,{ + "testCaseDescription": "go-increment-decrement-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "increment-decrement-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + } + ] + }, + "summary": "Replaced the 'foo++' increment statement with the 'i++' increment statement in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'j--' decrement statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'x++' increment statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "increment-decrement-statements.go" + ], + "patch": [ + "diff --git a/increment-decrement-statements.go b/increment-decrement-statements.go", + "index 08611ad4..18bf03a2 100644", + "--- a/increment-decrement-statements.go", + "+++ b/increment-decrement-statements.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-foo++", + "-x++", + "+i++", + "+j--", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "cf96716d214016e3d91b7389e07e3ad195f2a70d..7f8c0bda49b47fff895e40cad8f3e0ad35e71dc4" +} +,{ + "testCaseDescription": "go-increment-decrement-statements-delete-insert-test", + "expectedResult": { + "changes": { + "increment-decrement-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'i++' increment statement in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'j--' decrement statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "increment-decrement-statements.go" + ], + "patch": [ + "diff --git a/increment-decrement-statements.go b/increment-decrement-statements.go", + "index 18bf03a2..79058077 100644", + "--- a/increment-decrement-statements.go", + "+++ b/increment-decrement-statements.go", + "@@ -1,6 +1,5 @@", + " package main", + " ", + " func main() {", + "-i++", + "-j--", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7f8c0bda49b47fff895e40cad8f3e0ad35e71dc4..c26c44c5f60f2dc0187f577920eb720df9fcd429" +} +,{ + "testCaseDescription": "go-increment-decrement-statements-teardown-test", + "expectedResult": { + "changes": { + "increment-decrement-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "increment-decrement-statements.go" + ], + "patch": [ + "diff --git a/increment-decrement-statements.go b/increment-decrement-statements.go", + "index 79058077..e69de29b 100644", + "--- a/increment-decrement-statements.go", + "+++ b/increment-decrement-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c26c44c5f60f2dc0187f577920eb720df9fcd429..676a4c0466e117135c3df59c9af1dbe709f9d8f6" +}] diff --git a/test/corpus/diff-summaries/go/indexing-expressions.json b/test/corpus/diff-summaries/go/indexing-expressions.json new file mode 100644 index 000000000..3a4768595 --- /dev/null +++ b/test/corpus/diff-summaries/go/indexing-expressions.json @@ -0,0 +1,815 @@ +[{ + "testCaseDescription": "go-indexing-expressions-setup-test", + "expectedResult": { + "changes": { + "indexing-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "indexing-expressions.go" + ], + "patch": [ + "diff --git a/indexing-expressions.go b/indexing-expressions.go", + "index e69de29b..79058077 100644", + "--- a/indexing-expressions.go", + "+++ b/indexing-expressions.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "da87539e91454e018a1ba3c704f8fceb37fc9f2b..f132a69a71e31122d4506b52fd27fa1d5b367289" +} +,{ + "testCaseDescription": "go-indexing-expressions-insert-test", + "expectedResult": { + "changes": { + "indexing-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added the 'a[1]' index expression in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 3 + ] + } + }, + "summary": "Added the 'b' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the 'c[1]' slice literal in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 3 + ] + } + }, + "summary": "Added the 'd' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 4 + ], + "end": [ + 7, + 5 + ] + } + }, + "summary": "Added '1' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 7 + ] + } + }, + "summary": "Added '2' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 2 + ], + "end": [ + 8, + 3 + ] + } + }, + "summary": "Added the 'e' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 5 + ], + "end": [ + 8, + 6 + ] + } + }, + "summary": "Added '2' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 8 + ] + } + }, + "summary": "Added '3' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 9, + 2 + ], + "end": [ + 9, + 3 + ] + } + }, + "summary": "Added the 'f' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 9, + 4 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Added '1' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 7 + ] + } + }, + "summary": "Added '2' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 9, + 8 + ], + "end": [ + 9, + 9 + ] + } + }, + "summary": "Added '3' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "indexing-expressions.go" + ], + "patch": [ + "diff --git a/indexing-expressions.go b/indexing-expressions.go", + "index 79058077..c2c76934 100644", + "--- a/indexing-expressions.go", + "+++ b/indexing-expressions.go", + "@@ -1,5 +1,10 @@", + " package main", + " ", + " func main() {", + "-", + "+a[1]", + "+ b[:]", + "+ c[1:]", + "+ d[1:2]", + "+ e[:2:3]", + "+ f[1:2:3]", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f132a69a71e31122d4506b52fd27fa1d5b367289..958b85f05779da81cf8949f9de3ed3e244f77fec" +} +,{ + "testCaseDescription": "go-indexing-expressions-replacement-test", + "expectedResult": { + "changes": { + "indexing-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'z[2]' slice literal in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Added the 'y[1]' slice literal in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the 'x[1]' slice literal in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Deleted the 'a[1]' index expression in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 3 + ] + } + }, + "summary": "Deleted the 'b' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Deleted the 'c[1]' slice literal in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "indexing-expressions.go" + ], + "patch": [ + "diff --git a/indexing-expressions.go b/indexing-expressions.go", + "index c2c76934..68a76340 100644", + "--- a/indexing-expressions.go", + "+++ b/indexing-expressions.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-a[1]", + "- b[:]", + "- c[1:]", + "+z[:2]", + "+ y[:1]", + "+ x[1:]", + " d[1:2]", + " e[:2:3]", + " f[1:2:3]" + ], + "gitDir": "test/corpus/repos/go", + "shas": "958b85f05779da81cf8949f9de3ed3e244f77fec..8e2c38aa8f9dda4962cdcb4c16ac10152f00a4b5" +} +,{ + "testCaseDescription": "go-indexing-expressions-delete-replacement-test", + "expectedResult": { + "changes": { + "indexing-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added the 'a[1]' index expression in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 3 + ] + } + ] + }, + "summary": "Replaced the 'z[2]' slice literal with the 'b' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the 'c[1]' slice literal in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Deleted the 'y[1]' slice literal in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Deleted the 'x[1]' slice literal in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "indexing-expressions.go" + ], + "patch": [ + "diff --git a/indexing-expressions.go b/indexing-expressions.go", + "index 68a76340..c2c76934 100644", + "--- a/indexing-expressions.go", + "+++ b/indexing-expressions.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-z[:2]", + "- y[:1]", + "- x[1:]", + "+a[1]", + "+ b[:]", + "+ c[1:]", + " d[1:2]", + " e[:2:3]", + " f[1:2:3]" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8e2c38aa8f9dda4962cdcb4c16ac10152f00a4b5..e95df8ac4c46f9edf98ea3352f8318e02621e5e4" +} +,{ + "testCaseDescription": "go-indexing-expressions-delete-insert-test", + "expectedResult": { + "changes": { + "indexing-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Deleted the 'a[1]' index expression in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 3 + ] + } + }, + "summary": "Deleted the 'b' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Deleted the 'c[1]' slice literal in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 3 + ] + } + }, + "summary": "Deleted the 'd' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 4 + ], + "end": [ + 7, + 5 + ] + } + }, + "summary": "Deleted '1' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 7 + ] + } + }, + "summary": "Deleted '2' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 2 + ], + "end": [ + 8, + 3 + ] + } + }, + "summary": "Deleted the 'e' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 5 + ], + "end": [ + 8, + 6 + ] + } + }, + "summary": "Deleted '2' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 8 + ] + } + }, + "summary": "Deleted '3' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 9, + 2 + ], + "end": [ + 9, + 3 + ] + } + }, + "summary": "Deleted the 'f' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 9, + 4 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Deleted '1' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 7 + ] + } + }, + "summary": "Deleted '2' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 9, + 8 + ], + "end": [ + 9, + 9 + ] + } + }, + "summary": "Deleted '3' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "indexing-expressions.go" + ], + "patch": [ + "diff --git a/indexing-expressions.go b/indexing-expressions.go", + "index c2c76934..79058077 100644", + "--- a/indexing-expressions.go", + "+++ b/indexing-expressions.go", + "@@ -1,10 +1,5 @@", + " package main", + " ", + " func main() {", + "-a[1]", + "- b[:]", + "- c[1:]", + "- d[1:2]", + "- e[:2:3]", + "- f[1:2:3]", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e95df8ac4c46f9edf98ea3352f8318e02621e5e4..3ee7d179d6043f9db5b58bf1dd4b8756999b34f2" +} +,{ + "testCaseDescription": "go-indexing-expressions-teardown-test", + "expectedResult": { + "changes": { + "indexing-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "indexing-expressions.go" + ], + "patch": [ + "diff --git a/indexing-expressions.go b/indexing-expressions.go", + "index 79058077..e69de29b 100644", + "--- a/indexing-expressions.go", + "+++ b/indexing-expressions.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3ee7d179d6043f9db5b58bf1dd4b8756999b34f2..16a71383b1105b6ba32fa5b1498ab5294acea29b" +}] diff --git a/test/corpus/diff-summaries/go/int-literals.json b/test/corpus/diff-summaries/go/int-literals.json new file mode 100644 index 000000000..0a43f35dd --- /dev/null +++ b/test/corpus/diff-summaries/go/int-literals.json @@ -0,0 +1,424 @@ +[{ + "testCaseDescription": "go-int-literals-setup-test", + "expectedResult": { + "changes": { + "int-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "int-literals.go" + ], + "patch": [ + "diff --git a/int-literals.go b/int-literals.go", + "index e69de29b..79058077 100644", + "--- a/int-literals.go", + "+++ b/int-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c578d4a9262098e37c81793dbf2fcdb3834ed7fc..bf4c2fa143c7b8ec844770a1137017f2fb9e7d42" +} +,{ + "testCaseDescription": "go-int-literals-insert-test", + "expectedResult": { + "changes": {}, + "errors": { + "int-literals.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Added 'a = 1, b = 2, c = 3' at line 5, column 1 - line 5, column 20 in the main function" + } + ] + } + }, + "filePaths": [ + "int-literals.go" + ], + "patch": [ + "diff --git a/int-literals.go b/int-literals.go", + "index 79058077..38d36eca 100644", + "--- a/int-literals.go", + "+++ b/int-literals.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "-", + "+const (", + "+a = 1, b = 2, c = 3", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "bf4c2fa143c7b8ec844770a1137017f2fb9e7d42..21106fed3fd8c3e31494c282edc82c5429c92869" +} +,{ + "testCaseDescription": "go-int-literals-replacement-test", + "expectedResult": { + "changes": { + "int-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 6 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 6 + ] + } + ] + }, + "summary": "Replaced '1' with '4' in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced '2' with '5' in an assignment to 5, c of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 19 + ], + "end": [ + 5, + 20 + ] + }, + { + "start": [ + 5, + 19 + ], + "end": [ + 5, + 20 + ] + } + ] + }, + "summary": "Replaced '3' with '6' in an assignment to 5, c of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "int-literals.go" + ], + "patch": [ + "diff --git a/int-literals.go b/int-literals.go", + "index 38d36eca..4f07c130 100644", + "--- a/int-literals.go", + "+++ b/int-literals.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " const (", + "-a = 1, b = 2, c = 3", + "+a = 4, b = 5, c = 6", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "21106fed3fd8c3e31494c282edc82c5429c92869..cfd6ec82951166ab2361dd233a256b7913534d9f" +} +,{ + "testCaseDescription": "go-int-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "int-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 6 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 6 + ] + } + ] + }, + "summary": "Replaced '4' with '1' in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced '5' with '2' in an assignment to 2, c of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 19 + ], + "end": [ + 5, + 20 + ] + }, + { + "start": [ + 5, + 19 + ], + "end": [ + 5, + 20 + ] + } + ] + }, + "summary": "Replaced '6' with '3' in an assignment to 2, c of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "int-literals.go" + ], + "patch": [ + "diff --git a/int-literals.go b/int-literals.go", + "index 4f07c130..38d36eca 100644", + "--- a/int-literals.go", + "+++ b/int-literals.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " const (", + "-a = 4, b = 5, c = 6", + "+a = 1, b = 2, c = 3", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "cfd6ec82951166ab2361dd233a256b7913534d9f..8c66b33e09eaea83addec2ac2330089768519921" +} +,{ + "testCaseDescription": "go-int-literals-delete-insert-test", + "expectedResult": { + "changes": {}, + "errors": { + "int-literals.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Deleted 'a = 1, b = 2, c = 3' at line 5, column 1 - line 5, column 20 in the main function" + } + ] + } + }, + "filePaths": [ + "int-literals.go" + ], + "patch": [ + "diff --git a/int-literals.go b/int-literals.go", + "index 38d36eca..79058077 100644", + "--- a/int-literals.go", + "+++ b/int-literals.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "-const (", + "-a = 1, b = 2, c = 3", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8c66b33e09eaea83addec2ac2330089768519921..1d6bcf3782d0b1f80d454b369648f5e7a9dff34e" +} +,{ + "testCaseDescription": "go-int-literals-teardown-test", + "expectedResult": { + "changes": { + "int-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "int-literals.go" + ], + "patch": [ + "diff --git a/int-literals.go b/int-literals.go", + "index 79058077..e69de29b 100644", + "--- a/int-literals.go", + "+++ b/int-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1d6bcf3782d0b1f80d454b369648f5e7a9dff34e..e2c2101dadc49e784ab17192eba4aad3c2c5d13b" +}] diff --git a/test/corpus/diff-summaries/go/interface-types.json b/test/corpus/diff-summaries/go/interface-types.json new file mode 100644 index 000000000..8a8bac44e --- /dev/null +++ b/test/corpus/diff-summaries/go/interface-types.json @@ -0,0 +1,502 @@ +[{ + "testCaseDescription": "go-interface-types-setup-test", + "expectedResult": { + "changes": { + "interface-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interface-types.go" + ], + "patch": [ + "diff --git a/interface-types.go b/interface-types.go", + "index e69de29b..79058077 100644", + "--- a/interface-types.go", + "+++ b/interface-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5f287115383794ba8f417807b7e523efa7fef3b6..5308a7c67998f85b5cc12e0cdf882315608caeeb" +} +,{ + "testCaseDescription": "go-interface-types-insert-test", + "expectedResult": { + "changes": { + "interface-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 21 + ] + } + }, + "summary": "Added the 'i1' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 32 + ] + } + }, + "summary": "Added the 'i2' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 6 + ], + "end": [ + 10, + 2 + ] + } + }, + "summary": "Added the 'i3' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interface-types.go" + ], + "patch": [ + "diff --git a/interface-types.go b/interface-types.go", + "index 79058077..9b2ca4a9 100644", + "--- a/interface-types.go", + "+++ b/interface-types.go", + "@@ -1,5 +1,11 @@", + " package main", + " ", + " func main() {", + "-", + "+type i1 interface {}", + "+type i2 interface { io.Reader }", + "+type i3 interface {", + "+i1", + "+io.Reader", + "+ SomeMethod(s string) error", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5308a7c67998f85b5cc12e0cdf882315608caeeb..f5d85befb6bf9b0e5b8b4c4e2fa67fd3ed2da75e" +} +,{ + "testCaseDescription": "go-interface-types-replacement-test", + "expectedResult": { + "changes": { + "interface-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'i1' identifier with the 'j1' identifier in the 'j1' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'i2' identifier with the 'j2' identifier in the 'j2' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'i3' identifier with the 'j3' identifier in the 'j3' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interface-types.go" + ], + "patch": [ + "diff --git a/interface-types.go b/interface-types.go", + "index 9b2ca4a9..cba5600b 100644", + "--- a/interface-types.go", + "+++ b/interface-types.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-type i1 interface {}", + "-type i2 interface { io.Reader }", + "-type i3 interface {", + "+type j1 interface {}", + "+type j2 interface { io.Reader }", + "+type j3 interface {", + " i1", + " io.Reader", + " SomeMethod(s string) error" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f5d85befb6bf9b0e5b8b4c4e2fa67fd3ed2da75e..475be5898131719a2e51ef7face3bfe6193bb645" +} +,{ + "testCaseDescription": "go-interface-types-delete-replacement-test", + "expectedResult": { + "changes": { + "interface-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'j1' identifier with the 'i1' identifier in the 'i1' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'j2' identifier with the 'i2' identifier in the 'i2' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'j3' identifier with the 'i3' identifier in the 'i3' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interface-types.go" + ], + "patch": [ + "diff --git a/interface-types.go b/interface-types.go", + "index cba5600b..9b2ca4a9 100644", + "--- a/interface-types.go", + "+++ b/interface-types.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-type j1 interface {}", + "-type j2 interface { io.Reader }", + "-type j3 interface {", + "+type i1 interface {}", + "+type i2 interface { io.Reader }", + "+type i3 interface {", + " i1", + " io.Reader", + " SomeMethod(s string) error" + ], + "gitDir": "test/corpus/repos/go", + "shas": "475be5898131719a2e51ef7face3bfe6193bb645..00cf7b9dd146bbc791d81381b47a46abb9a138ce" +} +,{ + "testCaseDescription": "go-interface-types-delete-insert-test", + "expectedResult": { + "changes": { + "interface-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 21 + ] + } + }, + "summary": "Deleted the 'i1' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 32 + ] + } + }, + "summary": "Deleted the 'i2' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 6 + ], + "end": [ + 10, + 2 + ] + } + }, + "summary": "Deleted the 'i3' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interface-types.go" + ], + "patch": [ + "diff --git a/interface-types.go b/interface-types.go", + "index 9b2ca4a9..79058077 100644", + "--- a/interface-types.go", + "+++ b/interface-types.go", + "@@ -1,11 +1,5 @@", + " package main", + " ", + " func main() {", + "-type i1 interface {}", + "-type i2 interface { io.Reader }", + "-type i3 interface {", + "-i1", + "-io.Reader", + "- SomeMethod(s string) error", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "00cf7b9dd146bbc791d81381b47a46abb9a138ce..9839bea33814300762ed1bb4fb86bd75e316f8ac" +} +,{ + "testCaseDescription": "go-interface-types-teardown-test", + "expectedResult": { + "changes": { + "interface-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interface-types.go" + ], + "patch": [ + "diff --git a/interface-types.go b/interface-types.go", + "index 79058077..e69de29b 100644", + "--- a/interface-types.go", + "+++ b/interface-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9839bea33814300762ed1bb4fb86bd75e316f8ac..ac0992c169e071be4495a4b8731e72c391fb7863" +}] diff --git a/test/corpus/diff-summaries/go/label-statements.json b/test/corpus/diff-summaries/go/label-statements.json new file mode 100644 index 000000000..28e69ee05 --- /dev/null +++ b/test/corpus/diff-summaries/go/label-statements.json @@ -0,0 +1,316 @@ +[{ + "testCaseDescription": "go-label-statements-setup-test", + "expectedResult": { + "changes": { + "label-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "label-statements.go" + ], + "patch": [ + "diff --git a/label-statements.go b/label-statements.go", + "index e69de29b..79058077 100644", + "--- a/label-statements.go", + "+++ b/label-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3b8c04146e306d10e05370f01c662eccc49a57d3..57ed8dedb7bf3c601f9e69e85985f53d45987fa6" +} +,{ + "testCaseDescription": "go-label-statements-insert-test", + "expectedResult": { + "changes": { + "label-statements.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 15 + ] + } + }, + "summary": "Added the 'insert_label' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "label-statements.go" + ], + "patch": [ + "diff --git a/label-statements.go b/label-statements.go", + "index 79058077..b0a29697 100644", + "--- a/label-statements.go", + "+++ b/label-statements.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "-", + "+{", + "+ insert_label:", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "57ed8dedb7bf3c601f9e69e85985f53d45987fa6..bce262b3d8e0c0bb6ecd7868b7f1803becf81dc0" +} +,{ + "testCaseDescription": "go-label-statements-replacement-test", + "expectedResult": { + "changes": { + "label-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 15 + ] + }, + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 20 + ] + } + ] + }, + "summary": "Replaced the 'insert_label' identifier with the 'replacement_label' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "label-statements.go" + ], + "patch": [ + "diff --git a/label-statements.go b/label-statements.go", + "index b0a29697..3d3cf164 100644", + "--- a/label-statements.go", + "+++ b/label-statements.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " {", + "- insert_label:", + "+ replacement_label:", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "bce262b3d8e0c0bb6ecd7868b7f1803becf81dc0..b494a966e834feb39879a93b81b6db2f3c02da0a" +} +,{ + "testCaseDescription": "go-label-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "label-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 20 + ] + }, + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 15 + ] + } + ] + }, + "summary": "Replaced the 'replacement_label' identifier with the 'insert_label' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "label-statements.go" + ], + "patch": [ + "diff --git a/label-statements.go b/label-statements.go", + "index 3d3cf164..b0a29697 100644", + "--- a/label-statements.go", + "+++ b/label-statements.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " {", + "- replacement_label:", + "+ insert_label:", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "b494a966e834feb39879a93b81b6db2f3c02da0a..898ee4bc471eb5701491310314d6798e2754f6ba" +} +,{ + "testCaseDescription": "go-label-statements-delete-insert-test", + "expectedResult": { + "changes": { + "label-statements.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 15 + ] + } + }, + "summary": "Deleted the 'insert_label' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "label-statements.go" + ], + "patch": [ + "diff --git a/label-statements.go b/label-statements.go", + "index b0a29697..79058077 100644", + "--- a/label-statements.go", + "+++ b/label-statements.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "-{", + "- insert_label:", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "898ee4bc471eb5701491310314d6798e2754f6ba..6ad29ac732fa4ca88ade6068c03047620ccf81e3" +} +,{ + "testCaseDescription": "go-label-statements-teardown-test", + "expectedResult": { + "changes": { + "label-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "label-statements.go" + ], + "patch": [ + "diff --git a/label-statements.go b/label-statements.go", + "index 79058077..e69de29b 100644", + "--- a/label-statements.go", + "+++ b/label-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6ad29ac732fa4ca88ade6068c03047620ccf81e3..05733ec654b2b20d054881640e8c5726bbe00f6d" +}] diff --git a/test/corpus/diff-summaries/go/map-literals.json b/test/corpus/diff-summaries/go/map-literals.json new file mode 100644 index 000000000..b4209b8c1 --- /dev/null +++ b/test/corpus/diff-summaries/go/map-literals.json @@ -0,0 +1,491 @@ +[{ + "testCaseDescription": "go-map-literals-setup-test", + "expectedResult": { + "changes": { + "map-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-literals.go" + ], + "patch": [ + "diff --git a/map-literals.go b/map-literals.go", + "index e69de29b..79058077 100644", + "--- a/map-literals.go", + "+++ b/map-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fad96915d832ac6e13a3a067b6bc46fb5150823d..f0ec6f384d6a27dab3caeaf2ba5cc644b9c3e628" +} +,{ + "testCaseDescription": "go-map-literals-insert-test", + "expectedResult": { + "changes": { + "map-literals.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 7 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Added the 's' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-literals.go" + ], + "patch": [ + "diff --git a/map-literals.go b/map-literals.go", + "index 79058077..bb99b5ba 100644", + "--- a/map-literals.go", + "+++ b/map-literals.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+const s = map[string]string{", + "+\"hi\": \"hello\",", + "+\"bye\": \"goodbye\",", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f0ec6f384d6a27dab3caeaf2ba5cc644b9c3e628..42d34535c7ed3286963cc35a05c1d7a6a7bfdb11" +} +,{ + "testCaseDescription": "go-map-literals-replacement-test", + "expectedResult": { + "changes": { + "map-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 22 + ], + "end": [ + 4, + 28 + ] + }, + { + "start": [ + 4, + 22 + ], + "end": [ + 4, + 25 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the map[string]int composite_literal of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the '\"foo\": \"bar\"' pair in the map[string]int composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 5 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + ] + }, + "summary": "Replaced the \"hi\" string with the \"baz\" string in the \"baz\": \"hello\" pair of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 17 + ] + } + }, + "summary": "Deleted the '\"bye\": \"goodbye\"' pair in the map[string]int composite_literal of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-literals.go" + ], + "patch": [ + "diff --git a/map-literals.go b/map-literals.go", + "index bb99b5ba..a9e0b664 100644", + "--- a/map-literals.go", + "+++ b/map-literals.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-const s = map[string]string{", + "-\"hi\": \"hello\",", + "-\"bye\": \"goodbye\",", + "+const s = map[string]int{", + "+\"foo\": \"bar\",", + "+\"baz\": \"hello\",", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "42d34535c7ed3286963cc35a05c1d7a6a7bfdb11..39303df07d763621e7a8928173ee0c822c520bfe" +} +,{ + "testCaseDescription": "go-map-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "map-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 22 + ], + "end": [ + 4, + 25 + ] + }, + { + "start": [ + 4, + 22 + ], + "end": [ + 4, + 28 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the map[string]string composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 6 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 5 + ] + } + ] + }, + "summary": "Replaced the \"foo\" string with the \"hi\" string in the \"hi\": \"hello\" pair of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 7 + ], + "end": [ + 5, + 14 + ] + } + ] + }, + "summary": "Replaced the \"bar\" string with the \"hello\" string in the \"hi\": \"hello\" pair of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + ] + }, + "summary": "Replaced the \"baz\" string with the \"bye\" string in the \"bye\": \"goodbye\" pair of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 8 + ], + "end": [ + 6, + 15 + ] + }, + { + "start": [ + 6, + 8 + ], + "end": [ + 6, + 17 + ] + } + ] + }, + "summary": "Replaced the \"hello\" string with the \"goodbye\" string in the \"bye\": \"goodbye\" pair of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-literals.go" + ], + "patch": [ + "diff --git a/map-literals.go b/map-literals.go", + "index a9e0b664..bb99b5ba 100644", + "--- a/map-literals.go", + "+++ b/map-literals.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-const s = map[string]int{", + "-\"foo\": \"bar\",", + "-\"baz\": \"hello\",", + "+const s = map[string]string{", + "+\"hi\": \"hello\",", + "+\"bye\": \"goodbye\",", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "39303df07d763621e7a8928173ee0c822c520bfe..f22e0d32dba611ac58ef475923feac6ffe185a2e" +} +,{ + "testCaseDescription": "go-map-literals-delete-insert-test", + "expectedResult": { + "changes": { + "map-literals.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 7 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Deleted the 's' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-literals.go" + ], + "patch": [ + "diff --git a/map-literals.go b/map-literals.go", + "index bb99b5ba..79058077 100644", + "--- a/map-literals.go", + "+++ b/map-literals.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-const s = map[string]string{", + "-\"hi\": \"hello\",", + "-\"bye\": \"goodbye\",", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f22e0d32dba611ac58ef475923feac6ffe185a2e..a68c251ad02bdd43dce19cdceae22c139bb5ac40" +} +,{ + "testCaseDescription": "go-map-literals-teardown-test", + "expectedResult": { + "changes": { + "map-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-literals.go" + ], + "patch": [ + "diff --git a/map-literals.go b/map-literals.go", + "index 79058077..e69de29b 100644", + "--- a/map-literals.go", + "+++ b/map-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a68c251ad02bdd43dce19cdceae22c139bb5ac40..6c6fe03e1ce4f7369c5cd528025e7e80a78cb2e3" +}] diff --git a/test/corpus/diff-summaries/go/map-types.json b/test/corpus/diff-summaries/go/map-types.json new file mode 100644 index 000000000..8817679c6 --- /dev/null +++ b/test/corpus/diff-summaries/go/map-types.json @@ -0,0 +1,310 @@ +[{ + "testCaseDescription": "go-map-types-setup-test", + "expectedResult": { + "changes": { + "map-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-types.go" + ], + "patch": [ + "diff --git a/map-types.go b/map-types.go", + "index e69de29b..79058077 100644", + "--- a/map-types.go", + "+++ b/map-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ac0992c169e071be4495a4b8731e72c391fb7863..626c85412642113270ec1bf0e1ff32d5ae4a97d3" +} +,{ + "testCaseDescription": "go-map-types-insert-test", + "expectedResult": { + "changes": { + "map-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 25 + ] + } + }, + "summary": "Added the 'm1' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-types.go" + ], + "patch": [ + "diff --git a/map-types.go b/map-types.go", + "index 79058077..01004b30 100644", + "--- a/map-types.go", + "+++ b/map-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+type m1 map[string]error", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "626c85412642113270ec1bf0e1ff32d5ae4a97d3..0944d3cf9d44029109a0dd2360ceb2807990c76e" +} +,{ + "testCaseDescription": "go-map-types-replacement-test", + "expectedResult": { + "changes": { + "map-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 19 + ] + }, + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 16 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the 'm1' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-types.go" + ], + "patch": [ + "diff --git a/map-types.go b/map-types.go", + "index 01004b30..a118e920 100644", + "--- a/map-types.go", + "+++ b/map-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type m1 map[string]error", + "+type m1 map[int]error", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0944d3cf9d44029109a0dd2360ceb2807990c76e..e0b1f3a190da6f2f2b39d8f1fdea20cc86091a26" +} +,{ + "testCaseDescription": "go-map-types-delete-replacement-test", + "expectedResult": { + "changes": { + "map-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 16 + ] + }, + { + "start": [ + 4, + 13 + ], + "end": [ + 4, + 19 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the 'm1' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-types.go" + ], + "patch": [ + "diff --git a/map-types.go b/map-types.go", + "index a118e920..01004b30 100644", + "--- a/map-types.go", + "+++ b/map-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type m1 map[int]error", + "+type m1 map[string]error", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e0b1f3a190da6f2f2b39d8f1fdea20cc86091a26..749359cd5af467d046b9f2797e1b38e607a3acc5" +} +,{ + "testCaseDescription": "go-map-types-delete-insert-test", + "expectedResult": { + "changes": { + "map-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 25 + ] + } + }, + "summary": "Deleted the 'm1' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-types.go" + ], + "patch": [ + "diff --git a/map-types.go b/map-types.go", + "index 01004b30..79058077 100644", + "--- a/map-types.go", + "+++ b/map-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type m1 map[string]error", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "749359cd5af467d046b9f2797e1b38e607a3acc5..3964860791c193f4560ace0d778b11bf8d29de03" +} +,{ + "testCaseDescription": "go-map-types-teardown-test", + "expectedResult": { + "changes": { + "map-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "map-types.go" + ], + "patch": [ + "diff --git a/map-types.go b/map-types.go", + "index 79058077..e69de29b 100644", + "--- a/map-types.go", + "+++ b/map-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3964860791c193f4560ace0d778b11bf8d29de03..a1c5e30a9f0396b299eca4b60affb5c0e1ba1e98" +}] diff --git a/test/corpus/diff-summaries/go/method-declarations.json b/test/corpus/diff-summaries/go/method-declarations.json new file mode 100644 index 000000000..1e40a1ace --- /dev/null +++ b/test/corpus/diff-summaries/go/method-declarations.json @@ -0,0 +1,360 @@ +[{ + "testCaseDescription": "go-method-declarations-setup-test", + "expectedResult": { + "changes": { + "method-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 15 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declarations.go" + ], + "patch": [ + "diff --git a/method-declarations.go b/method-declarations.go", + "index e69de29b..6aaca9ef 100644", + "--- a/method-declarations.go", + "+++ b/method-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {}", + "+", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "852d29d2b9a695875dd0e15454330bbf7c5e49ff..8dbfd03f829f633e03994c029050d4c04facf13a" +} +,{ + "testCaseDescription": "go-method-declarations-insert-test", + "expectedResult": { + "changes": { + "method-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 48 + ] + } + }, + "summary": "Added the '(self Person).Equals(…)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declarations.go" + ], + "patch": [ + "diff --git a/method-declarations.go b/method-declarations.go", + "index 6aaca9ef..e556c016 100644", + "--- a/method-declarations.go", + "+++ b/method-declarations.go", + "@@ -2,4 +2,4 @@ package main", + " ", + " func main() {}", + " ", + "-", + "+func (self Person) Equals(other Person) bool {}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8dbfd03f829f633e03994c029050d4c04facf13a..0c19c3d818bc2c0bac5168d3e77f4e54e382a2d3" +} +,{ + "testCaseDescription": "go-method-declarations-replacement-test", + "expectedResult": { + "changes": { + "method-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 18 + ] + }, + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 15 + ] + } + ] + }, + "summary": "Replaced the 'Person' identifier with the 'Num' identifier in the '(self Num).Equals(…)' method" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 33 + ], + "end": [ + 5, + 39 + ] + }, + { + "start": [ + 5, + 30 + ], + "end": [ + 5, + 33 + ] + } + ] + }, + "summary": "Replaced the 'Person' identifier with the 'Num' identifier in the '(self Num).Equals(…)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declarations.go" + ], + "patch": [ + "diff --git a/method-declarations.go b/method-declarations.go", + "index e556c016..1be6d205 100644", + "--- a/method-declarations.go", + "+++ b/method-declarations.go", + "@@ -2,4 +2,4 @@ package main", + " ", + " func main() {}", + " ", + "-func (self Person) Equals(other Person) bool {}", + "+func (self Num) Equals(other Num) bool {}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0c19c3d818bc2c0bac5168d3e77f4e54e382a2d3..973f19351649422c552bebc3caa6b543f7edde31" +} +,{ + "testCaseDescription": "go-method-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "method-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 15 + ] + }, + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 18 + ] + } + ] + }, + "summary": "Replaced the 'Num' identifier with the 'Person' identifier in the '(self Person).Equals(…)' method" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 30 + ], + "end": [ + 5, + 33 + ] + }, + { + "start": [ + 5, + 33 + ], + "end": [ + 5, + 39 + ] + } + ] + }, + "summary": "Replaced the 'Num' identifier with the 'Person' identifier in the '(self Person).Equals(…)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declarations.go" + ], + "patch": [ + "diff --git a/method-declarations.go b/method-declarations.go", + "index 1be6d205..e556c016 100644", + "--- a/method-declarations.go", + "+++ b/method-declarations.go", + "@@ -2,4 +2,4 @@ package main", + " ", + " func main() {}", + " ", + "-func (self Num) Equals(other Num) bool {}", + "+func (self Person) Equals(other Person) bool {}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "973f19351649422c552bebc3caa6b543f7edde31..322c0af27ab61337490585a423787b8dd90cdb4d" +} +,{ + "testCaseDescription": "go-method-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "method-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 48 + ] + } + }, + "summary": "Deleted the '(self Person).Equals(…)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declarations.go" + ], + "patch": [ + "diff --git a/method-declarations.go b/method-declarations.go", + "index e556c016..6aaca9ef 100644", + "--- a/method-declarations.go", + "+++ b/method-declarations.go", + "@@ -2,4 +2,4 @@ package main", + " ", + " func main() {}", + " ", + "-func (self Person) Equals(other Person) bool {}", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "322c0af27ab61337490585a423787b8dd90cdb4d..02fce651f253788ced60704a9f32342bbae010a8" +} +,{ + "testCaseDescription": "go-method-declarations-teardown-test", + "expectedResult": { + "changes": { + "method-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 15 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declarations.go" + ], + "patch": [ + "diff --git a/method-declarations.go b/method-declarations.go", + "index 6aaca9ef..e69de29b 100644", + "--- a/method-declarations.go", + "+++ b/method-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {}", + "-", + "-" + ], + "gitDir": "test/corpus/repos/go", + "shas": "02fce651f253788ced60704a9f32342bbae010a8..7edc6135ad00c9c21d6159bf897deac80d7f7b99" +}] diff --git a/test/corpus/diff-summaries/go/modifying-struct-fields.json b/test/corpus/diff-summaries/go/modifying-struct-fields.json new file mode 100644 index 000000000..f5d3406bb --- /dev/null +++ b/test/corpus/diff-summaries/go/modifying-struct-fields.json @@ -0,0 +1,346 @@ +[{ + "testCaseDescription": "go-modifying-struct-fields-setup-test", + "expectedResult": { + "changes": { + "modifying-struct-fields.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "modifying-struct-fields.go" + ], + "patch": [ + "diff --git a/modifying-struct-fields.go b/modifying-struct-fields.go", + "index e69de29b..79058077 100644", + "--- a/modifying-struct-fields.go", + "+++ b/modifying-struct-fields.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8566e6b82b82cdb946f31050cd67e81c7a70a4f8..4c6ba0cec79bc7bc4f19f23ec290129743c33ab0" +} +,{ + "testCaseDescription": "go-modifying-struct-fields-insert-test", + "expectedResult": { + "changes": { + "modifying-struct-fields.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'ctx' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 8 + ], + "end": [ + 6, + 2 + ] + } + }, + "summary": "Added the '&uploadContext{\n Remote: remote\n}' operator in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "modifying-struct-fields.go" + ], + "patch": [ + "diff --git a/modifying-struct-fields.go b/modifying-struct-fields.go", + "index 79058077..8b8c10e6 100644", + "--- a/modifying-struct-fields.go", + "+++ b/modifying-struct-fields.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "-", + "+ctx := &uploadContext{", + "+ Remote: remote", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4c6ba0cec79bc7bc4f19f23ec290129743c33ab0..ce4c1df86303fc418b251ee6c3cdb8a5e19c1ddc" +} +,{ + "testCaseDescription": "go-modifying-struct-fields-replacement-test", + "expectedResult": { + "changes": { + "modifying-struct-fields.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 18 + ] + }, + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 35 + ] + } + ] + }, + "summary": "Replaced the 'Remote: remote' pair with the 'trackedLocksMu: new(sync.Mutex)' pair in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "modifying-struct-fields.go" + ], + "patch": [ + "diff --git a/modifying-struct-fields.go b/modifying-struct-fields.go", + "index 8b8c10e6..e16cd243 100644", + "--- a/modifying-struct-fields.go", + "+++ b/modifying-struct-fields.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " ctx := &uploadContext{", + "- Remote: remote", + "+ trackedLocksMu: new(sync.Mutex)", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ce4c1df86303fc418b251ee6c3cdb8a5e19c1ddc..914f29c058eacd9c592d304947d46feaa25e7b33" +} +,{ + "testCaseDescription": "go-modifying-struct-fields-delete-replacement-test", + "expectedResult": { + "changes": { + "modifying-struct-fields.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 35 + ] + }, + { + "start": [ + 5, + 4 + ], + "end": [ + 5, + 18 + ] + } + ] + }, + "summary": "Replaced the 'trackedLocksMu: new(sync.Mutex)' pair with the 'Remote: remote' pair in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "modifying-struct-fields.go" + ], + "patch": [ + "diff --git a/modifying-struct-fields.go b/modifying-struct-fields.go", + "index e16cd243..8b8c10e6 100644", + "--- a/modifying-struct-fields.go", + "+++ b/modifying-struct-fields.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " ctx := &uploadContext{", + "- trackedLocksMu: new(sync.Mutex)", + "+ Remote: remote", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "914f29c058eacd9c592d304947d46feaa25e7b33..697657a456eb527a797dcae7f135a1e6d37a3df6" +} +,{ + "testCaseDescription": "go-modifying-struct-fields-delete-insert-test", + "expectedResult": { + "changes": { + "modifying-struct-fields.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'ctx' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 8 + ], + "end": [ + 6, + 2 + ] + } + }, + "summary": "Deleted the '&uploadContext{\n Remote: remote\n}' operator in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "modifying-struct-fields.go" + ], + "patch": [ + "diff --git a/modifying-struct-fields.go b/modifying-struct-fields.go", + "index 8b8c10e6..79058077 100644", + "--- a/modifying-struct-fields.go", + "+++ b/modifying-struct-fields.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "-ctx := &uploadContext{", + "- Remote: remote", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "697657a456eb527a797dcae7f135a1e6d37a3df6..46a167a5893ffbcd888ea7adedf5cd4f9411280a" +} +,{ + "testCaseDescription": "go-modifying-struct-fields-teardown-test", + "expectedResult": { + "changes": { + "modifying-struct-fields.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "modifying-struct-fields.go" + ], + "patch": [ + "diff --git a/modifying-struct-fields.go b/modifying-struct-fields.go", + "index 79058077..e69de29b 100644", + "--- a/modifying-struct-fields.go", + "+++ b/modifying-struct-fields.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "46a167a5893ffbcd888ea7adedf5cd4f9411280a..177fb35939c02b4bc6067142eab57a6cc2237513" +}] diff --git a/test/corpus/diff-summaries/go/parameter-declarations-with-types.json b/test/corpus/diff-summaries/go/parameter-declarations-with-types.json new file mode 100644 index 000000000..6befca823 --- /dev/null +++ b/test/corpus/diff-summaries/go/parameter-declarations-with-types.json @@ -0,0 +1,423 @@ +[{ + "testCaseDescription": "go-parameter-declarations-with-types-setup-test", + "expectedResult": { + "changes": { + "parameter-declarations-with-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "parameter-declarations-with-types.go" + ], + "patch": [ + "diff --git a/parameter-declarations-with-types.go b/parameter-declarations-with-types.go", + "index e69de29b..a92cefed 100644", + "--- a/parameter-declarations-with-types.go", + "+++ b/parameter-declarations-with-types.go", + "@@ -0,0 +1,6 @@", + "+package main", + "+", + "+func main() {", + "+}", + "+", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f9b33be201f4f793e957567b70eebec7be3a69a2..19ff35cdac4d90df64eccad2f9cf12a3d6c950b9" +} +,{ + "testCaseDescription": "go-parameter-declarations-with-types-insert-test", + "expectedResult": { + "changes": { + "parameter-declarations-with-types.go": [ + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Added the 'foo' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "parameter-declarations-with-types.go" + ], + "patch": [ + "diff --git a/parameter-declarations-with-types.go b/parameter-declarations-with-types.go", + "index a92cefed..ed6bff2d 100644", + "--- a/parameter-declarations-with-types.go", + "+++ b/parameter-declarations-with-types.go", + "@@ -3,4 +3,5 @@ package main", + " func main() {", + " }", + " ", + "-", + "+func foo(a int, b string) {", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "19ff35cdac4d90df64eccad2f9cf12a3d6c950b9..a2ecd8bc1cdd44e1accd506a4fe3122567c493a4" +} +,{ + "testCaseDescription": "go-parameter-declarations-with-types-replacement-test", + "expectedResult": { + "changes": { + "parameter-declarations-with-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 6, + 12 + ], + "end": [ + 6, + 15 + ] + }, + { + "start": [ + 6, + 12 + ], + "end": [ + 6, + 18 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the foo function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 10 + ], + "end": [ + 6, + 11 + ] + }, + { + "start": [ + 6, + 10 + ], + "end": [ + 6, + 11 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the foo function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 19 + ], + "end": [ + 6, + 25 + ] + }, + { + "start": [ + 6, + 22 + ], + "end": [ + 6, + 28 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'uint64' identifier in the foo function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 17 + ], + "end": [ + 6, + 18 + ] + }, + { + "start": [ + 6, + 20 + ], + "end": [ + 6, + 21 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the foo function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "parameter-declarations-with-types.go" + ], + "patch": [ + "diff --git a/parameter-declarations-with-types.go b/parameter-declarations-with-types.go", + "index ed6bff2d..fcb6a303 100644", + "--- a/parameter-declarations-with-types.go", + "+++ b/parameter-declarations-with-types.go", + "@@ -3,5 +3,5 @@ package main", + " func main() {", + " }", + " ", + "-func foo(a int, b string) {", + "+func foo(x string, y uint64) {", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a2ecd8bc1cdd44e1accd506a4fe3122567c493a4..31def9170cabd38fe5f30be4751911e10abe4964" +} +,{ + "testCaseDescription": "go-parameter-declarations-with-types-delete-replacement-test", + "expectedResult": { + "changes": { + "parameter-declarations-with-types.go": [ + { + "span": { + "insert": { + "start": [ + 6, + 10 + ], + "end": [ + 6, + 15 + ] + } + }, + "summary": "Added the 'a int' parameter declaration in the foo function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 10 + ], + "end": [ + 6, + 11 + ] + }, + { + "start": [ + 6, + 17 + ], + "end": [ + 6, + 18 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'b' identifier in the foo function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 20 + ], + "end": [ + 6, + 28 + ] + } + }, + "summary": "Deleted the 'y uint64' parameter declaration in the foo function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "parameter-declarations-with-types.go" + ], + "patch": [ + "diff --git a/parameter-declarations-with-types.go b/parameter-declarations-with-types.go", + "index fcb6a303..ed6bff2d 100644", + "--- a/parameter-declarations-with-types.go", + "+++ b/parameter-declarations-with-types.go", + "@@ -3,5 +3,5 @@ package main", + " func main() {", + " }", + " ", + "-func foo(x string, y uint64) {", + "+func foo(a int, b string) {", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "31def9170cabd38fe5f30be4751911e10abe4964..98386c034c992e7638defec009ee4600dced2505" +} +,{ + "testCaseDescription": "go-parameter-declarations-with-types-delete-insert-test", + "expectedResult": { + "changes": { + "parameter-declarations-with-types.go": [ + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Deleted the 'foo' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "parameter-declarations-with-types.go" + ], + "patch": [ + "diff --git a/parameter-declarations-with-types.go b/parameter-declarations-with-types.go", + "index ed6bff2d..a92cefed 100644", + "--- a/parameter-declarations-with-types.go", + "+++ b/parameter-declarations-with-types.go", + "@@ -3,5 +3,4 @@ package main", + " func main() {", + " }", + " ", + "-func foo(a int, b string) {", + "-}", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "98386c034c992e7638defec009ee4600dced2505..112ba7ce5a90f5e9652583e4be6f61022f677522" +} +,{ + "testCaseDescription": "go-parameter-declarations-with-types-teardown-test", + "expectedResult": { + "changes": { + "parameter-declarations-with-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "parameter-declarations-with-types.go" + ], + "patch": [ + "diff --git a/parameter-declarations-with-types.go b/parameter-declarations-with-types.go", + "index a92cefed..e69de29b 100644", + "--- a/parameter-declarations-with-types.go", + "+++ b/parameter-declarations-with-types.go", + "@@ -1,6 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-}", + "-", + "-" + ], + "gitDir": "test/corpus/repos/go", + "shas": "112ba7ce5a90f5e9652583e4be6f61022f677522..084c915d8b993e13da207d668c798c4e3e6f3baa" +}] diff --git a/test/corpus/diff-summaries/go/pointer-types.json b/test/corpus/diff-summaries/go/pointer-types.json new file mode 100644 index 000000000..4a7524656 --- /dev/null +++ b/test/corpus/diff-summaries/go/pointer-types.json @@ -0,0 +1,406 @@ +[{ + "testCaseDescription": "go-pointer-types-setup-test", + "expectedResult": { + "changes": { + "pointer-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pointer-types.go" + ], + "patch": [ + "diff --git a/pointer-types.go b/pointer-types.go", + "index e69de29b..79058077 100644", + "--- a/pointer-types.go", + "+++ b/pointer-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a1c5e30a9f0396b299eca4b60affb5c0e1ba1e98..38caa16942d0a4ecb8e98061b6dd973729a8754d" +} +,{ + "testCaseDescription": "go-pointer-types-insert-test", + "expectedResult": { + "changes": { + "pointer-types.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 11 + ] + } + }, + "summary": "Added the 'p1' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Added the 'p2' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pointer-types.go" + ], + "patch": [ + "diff --git a/pointer-types.go b/pointer-types.go", + "index 79058077..98e7b8a9 100644", + "--- a/pointer-types.go", + "+++ b/pointer-types.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+type (", + "+p1 *string", + "+p2 **p1", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "38caa16942d0a4ecb8e98061b6dd973729a8754d..785321c8694252386cb4203639d091b2476044c7" +} +,{ + "testCaseDescription": "go-pointer-types-replacement-test", + "expectedResult": { + "changes": { + "pointer-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 11 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'string' identifier with the 'int' identifier in the *int pointer type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'p1' identifier with the 'p3' identifier in the *p3 pointer type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pointer-types.go" + ], + "patch": [ + "diff --git a/pointer-types.go b/pointer-types.go", + "index 98e7b8a9..36eb5ffb 100644", + "--- a/pointer-types.go", + "+++ b/pointer-types.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " type (", + "-p1 *string", + "-p2 **p1", + "+p1 *int", + "+p2 **p3", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "785321c8694252386cb4203639d091b2476044c7..d100c7776455e0c6822fe0de1ab0440ee491aa1a" +} +,{ + "testCaseDescription": "go-pointer-types-delete-replacement-test", + "expectedResult": { + "changes": { + "pointer-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 11 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'string' identifier in the *string pointer type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'p3' identifier with the 'p1' identifier in the *p1 pointer type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pointer-types.go" + ], + "patch": [ + "diff --git a/pointer-types.go b/pointer-types.go", + "index 36eb5ffb..98e7b8a9 100644", + "--- a/pointer-types.go", + "+++ b/pointer-types.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " type (", + "-p1 *int", + "-p2 **p3", + "+p1 *string", + "+p2 **p1", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d100c7776455e0c6822fe0de1ab0440ee491aa1a..1c96162ce730ef41ab63d53e451b78417b26550d" +} +,{ + "testCaseDescription": "go-pointer-types-delete-insert-test", + "expectedResult": { + "changes": { + "pointer-types.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 11 + ] + } + }, + "summary": "Deleted the 'p1' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Deleted the 'p2' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pointer-types.go" + ], + "patch": [ + "diff --git a/pointer-types.go b/pointer-types.go", + "index 98e7b8a9..79058077 100644", + "--- a/pointer-types.go", + "+++ b/pointer-types.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-type (", + "-p1 *string", + "-p2 **p1", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1c96162ce730ef41ab63d53e451b78417b26550d..ad649dd982f31edda625f2d3a6a36ebe14f1b656" +} +,{ + "testCaseDescription": "go-pointer-types-teardown-test", + "expectedResult": { + "changes": { + "pointer-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pointer-types.go" + ], + "patch": [ + "diff --git a/pointer-types.go b/pointer-types.go", + "index 79058077..e69de29b 100644", + "--- a/pointer-types.go", + "+++ b/pointer-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ad649dd982f31edda625f2d3a6a36ebe14f1b656..a85665c66f8582bcde0abe05f4203f3696378040" +}] diff --git a/test/corpus/diff-summaries/go/qualified-types.json b/test/corpus/diff-summaries/go/qualified-types.json new file mode 100644 index 000000000..3b1021f4a --- /dev/null +++ b/test/corpus/diff-summaries/go/qualified-types.json @@ -0,0 +1,364 @@ +[{ + "testCaseDescription": "go-qualified-types-setup-test", + "expectedResult": { + "changes": { + "qualified-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "qualified-types.go" + ], + "patch": [ + "diff --git a/qualified-types.go b/qualified-types.go", + "index e69de29b..79058077 100644", + "--- a/qualified-types.go", + "+++ b/qualified-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "676a4c0466e117135c3df59c9af1dbe709f9d8f6..e8d71c1a8dfe4ff96f6d1c4216453cb1afd21bdc" +} +,{ + "testCaseDescription": "go-qualified-types-insert-test", + "expectedResult": { + "changes": { + "qualified-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the 'a' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "qualified-types.go" + ], + "patch": [ + "diff --git a/qualified-types.go b/qualified-types.go", + "index 79058077..e03cf221 100644", + "--- a/qualified-types.go", + "+++ b/qualified-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+type a b.c", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e8d71c1a8dfe4ff96f6d1c4216453cb1afd21bdc..fd11ba471e110d42e74a96e0a2cd11446503ecc3" +} +,{ + "testCaseDescription": "go-qualified-types-replacement-test", + "expectedResult": { + "changes": { + "qualified-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the 'x' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 11 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 11 + ] + } + ] + }, + "summary": "Replaced the 'b.c' qualified identifier with the 'y.z' qualified identifier in the 'x' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "qualified-types.go" + ], + "patch": [ + "diff --git a/qualified-types.go b/qualified-types.go", + "index e03cf221..241e5267 100644", + "--- a/qualified-types.go", + "+++ b/qualified-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type a b.c", + "+type x y.z", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fd11ba471e110d42e74a96e0a2cd11446503ecc3..92bfcc4e2b8e3801215766007b7025e471ec4872" +} +,{ + "testCaseDescription": "go-qualified-types-delete-replacement-test", + "expectedResult": { + "changes": { + "qualified-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 11 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 11 + ] + } + ] + }, + "summary": "Replaced the 'y.z' qualified identifier with the 'b.c' qualified identifier in the 'a' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "qualified-types.go" + ], + "patch": [ + "diff --git a/qualified-types.go b/qualified-types.go", + "index 241e5267..e03cf221 100644", + "--- a/qualified-types.go", + "+++ b/qualified-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type x y.z", + "+type a b.c", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "92bfcc4e2b8e3801215766007b7025e471ec4872..1905583e34b2196bf717834f81e4460d5084ee0b" +} +,{ + "testCaseDescription": "go-qualified-types-delete-insert-test", + "expectedResult": { + "changes": { + "qualified-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted the 'a' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "qualified-types.go" + ], + "patch": [ + "diff --git a/qualified-types.go b/qualified-types.go", + "index e03cf221..79058077 100644", + "--- a/qualified-types.go", + "+++ b/qualified-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-type a b.c", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1905583e34b2196bf717834f81e4460d5084ee0b..a3c65aa4032c38ed5600a9ead4823b8ad66a0f58" +} +,{ + "testCaseDescription": "go-qualified-types-teardown-test", + "expectedResult": { + "changes": { + "qualified-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "qualified-types.go" + ], + "patch": [ + "diff --git a/qualified-types.go b/qualified-types.go", + "index 79058077..e69de29b 100644", + "--- a/qualified-types.go", + "+++ b/qualified-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a3c65aa4032c38ed5600a9ead4823b8ad66a0f58..dd275c4f09cc46a085621fe3f9d293f9e0c3427d" +}] diff --git a/test/corpus/diff-summaries/go/rune-literals.json b/test/corpus/diff-summaries/go/rune-literals.json new file mode 100644 index 000000000..fa2700794 --- /dev/null +++ b/test/corpus/diff-summaries/go/rune-literals.json @@ -0,0 +1,720 @@ +[{ + "testCaseDescription": "go-rune-literals-setup-test", + "expectedResult": { + "changes": { + "rune-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rune-literals.go" + ], + "patch": [ + "diff --git a/rune-literals.go b/rune-literals.go", + "index e69de29b..c9ecbf5e 100644", + "--- a/rune-literals.go", + "+++ b/rune-literals.go", + "@@ -0,0 +1,2 @@", + "+package main", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "b33ba59ecc38b2543059f17e99013c5f619a0295..6562a24e5a10c2dcddf50a6e030d21c62309eed4" +} +,{ + "testCaseDescription": "go-rune-literals-insert-test", + "expectedResult": { + "changes": { + "rune-literals.go": [ + { + "span": { + "insert": { + "start": [ + 3, + 3 + ], + "end": [ + 3, + 10 + ] + } + }, + "summary": "Added the 'a' var assignment" + }, + { + "span": { + "insert": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Added the 'b' var assignment" + }, + { + "span": { + "insert": { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Added the 'c' var assignment" + }, + { + "span": { + "insert": { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the 'd' var assignment" + }, + { + "span": { + "insert": { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 10 + ] + } + }, + "summary": "Added the 'e' var assignment" + }, + { + "span": { + "insert": { + "start": [ + 8, + 3 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Added the 'f' var assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rune-literals.go" + ], + "patch": [ + "diff --git a/rune-literals.go b/rune-literals.go", + "index c9ecbf5e..e97de4c1 100644", + "--- a/rune-literals.go", + "+++ b/rune-literals.go", + "@@ -1,2 +1,9 @@", + " package main", + "-", + "+const (", + "+ a = 'δ'", + "+ b = '⌘'", + "+ c = '⌘'", + "+ d = '⌘'", + "+ e = '⌘'", + "+ f = '⌘'", + "+)" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6562a24e5a10c2dcddf50a6e030d21c62309eed4..4170bf9052b2ada9be6045f32867d440c3bc1452" +} +,{ + "testCaseDescription": "go-rune-literals-replacement-test", + "expectedResult": { + "changes": { + "rune-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 3, + 7 + ], + "end": [ + 3, + 10 + ] + }, + { + "start": [ + 3, + 7 + ], + "end": [ + 3, + 10 + ] + } + ] + }, + "summary": "Replaced the ''δ'' rune literal with the ''©'' rune literal in the a var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the ''⌘'' rune literal with the ''©'' rune literal in the b var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 7 + ], + "end": [ + 5, + 10 + ] + }, + { + "start": [ + 5, + 7 + ], + "end": [ + 5, + 10 + ] + } + ] + }, + "summary": "Replaced the ''⌘'' rune literal with the ''©'' rune literal in the c var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 7 + ], + "end": [ + 6, + 10 + ] + }, + { + "start": [ + 6, + 7 + ], + "end": [ + 6, + 10 + ] + } + ] + }, + "summary": "Replaced the ''⌘'' rune literal with the ''©'' rune literal in the d var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 7 + ], + "end": [ + 7, + 10 + ] + }, + { + "start": [ + 7, + 7 + ], + "end": [ + 7, + 10 + ] + } + ] + }, + "summary": "Replaced the ''⌘'' rune literal with the ''©'' rune literal in the e var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 10 + ] + }, + { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 10 + ] + } + ] + }, + "summary": "Replaced the ''⌘'' rune literal with the ''©'' rune literal in the f var assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rune-literals.go" + ], + "patch": [ + "diff --git a/rune-literals.go b/rune-literals.go", + "index e97de4c1..346d5d96 100644", + "--- a/rune-literals.go", + "+++ b/rune-literals.go", + "@@ -1,9 +1,9 @@", + " package main", + " const (", + "- a = 'δ'", + "- b = '⌘'", + "- c = '⌘'", + "- d = '⌘'", + "- e = '⌘'", + "- f = '⌘'", + "+ a = '©'", + "+ b = '©'", + "+ c = '©'", + "+ d = '©'", + "+ e = '©'", + "+ f = '©'", + " )" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4170bf9052b2ada9be6045f32867d440c3bc1452..d1fff006ee9383445d9d45ca3790f2c62d415295" +} +,{ + "testCaseDescription": "go-rune-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "rune-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 3, + 7 + ], + "end": [ + 3, + 10 + ] + }, + { + "start": [ + 3, + 7 + ], + "end": [ + 3, + 10 + ] + } + ] + }, + "summary": "Replaced the ''©'' rune literal with the ''δ'' rune literal in the a var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the ''©'' rune literal with the ''⌘'' rune literal in the b var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 7 + ], + "end": [ + 5, + 10 + ] + }, + { + "start": [ + 5, + 7 + ], + "end": [ + 5, + 10 + ] + } + ] + }, + "summary": "Replaced the ''©'' rune literal with the ''⌘'' rune literal in the c var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 7 + ], + "end": [ + 6, + 10 + ] + }, + { + "start": [ + 6, + 7 + ], + "end": [ + 6, + 10 + ] + } + ] + }, + "summary": "Replaced the ''©'' rune literal with the ''⌘'' rune literal in the d var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 7 + ], + "end": [ + 7, + 10 + ] + }, + { + "start": [ + 7, + 7 + ], + "end": [ + 7, + 10 + ] + } + ] + }, + "summary": "Replaced the ''©'' rune literal with the ''⌘'' rune literal in the e var assignment" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 10 + ] + }, + { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 10 + ] + } + ] + }, + "summary": "Replaced the ''©'' rune literal with the ''⌘'' rune literal in the f var assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rune-literals.go" + ], + "patch": [ + "diff --git a/rune-literals.go b/rune-literals.go", + "index 346d5d96..e97de4c1 100644", + "--- a/rune-literals.go", + "+++ b/rune-literals.go", + "@@ -1,9 +1,9 @@", + " package main", + " const (", + "- a = '©'", + "- b = '©'", + "- c = '©'", + "- d = '©'", + "- e = '©'", + "- f = '©'", + "+ a = 'δ'", + "+ b = '⌘'", + "+ c = '⌘'", + "+ d = '⌘'", + "+ e = '⌘'", + "+ f = '⌘'", + " )" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d1fff006ee9383445d9d45ca3790f2c62d415295..3317c28671471c9a8a940ca59f1a929b77da6851" +} +,{ + "testCaseDescription": "go-rune-literals-delete-insert-test", + "expectedResult": { + "changes": { + "rune-literals.go": [ + { + "span": { + "delete": { + "start": [ + 3, + 3 + ], + "end": [ + 3, + 10 + ] + } + }, + "summary": "Deleted the 'a' var assignment" + }, + { + "span": { + "delete": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Deleted the 'b' var assignment" + }, + { + "span": { + "delete": { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Deleted the 'c' var assignment" + }, + { + "span": { + "delete": { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the 'd' var assignment" + }, + { + "span": { + "delete": { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 10 + ] + } + }, + "summary": "Deleted the 'e' var assignment" + }, + { + "span": { + "delete": { + "start": [ + 8, + 3 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Deleted the 'f' var assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rune-literals.go" + ], + "patch": [ + "diff --git a/rune-literals.go b/rune-literals.go", + "index e97de4c1..c9ecbf5e 100644", + "--- a/rune-literals.go", + "+++ b/rune-literals.go", + "@@ -1,9 +1,2 @@", + " package main", + "-const (", + "- a = 'δ'", + "- b = '⌘'", + "- c = '⌘'", + "- d = '⌘'", + "- e = '⌘'", + "- f = '⌘'", + "-)", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3317c28671471c9a8a940ca59f1a929b77da6851..66e9950fcf1ad093302ce35b8541e08c4c9ca808" +} +,{ + "testCaseDescription": "go-rune-literals-teardown-test", + "expectedResult": { + "changes": { + "rune-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rune-literals.go" + ], + "patch": [ + "diff --git a/rune-literals.go b/rune-literals.go", + "index c9ecbf5e..e69de29b 100644", + "--- a/rune-literals.go", + "+++ b/rune-literals.go", + "@@ -1,2 +0,0 @@", + "-package main", + "-" + ], + "gitDir": "test/corpus/repos/go", + "shas": "66e9950fcf1ad093302ce35b8541e08c4c9ca808..d16e448af6bd6f785de25d685b7bceabce571049" +}] diff --git a/test/corpus/diff-summaries/go/select-statements.json b/test/corpus/diff-summaries/go/select-statements.json new file mode 100644 index 000000000..17e4e7557 --- /dev/null +++ b/test/corpus/diff-summaries/go/select-statements.json @@ -0,0 +1,452 @@ +[{ + "testCaseDescription": "go-select-statements-setup-test", + "expectedResult": { + "changes": { + "select-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "select-statements.go" + ], + "patch": [ + "diff --git a/select-statements.go b/select-statements.go", + "index e69de29b..79058077 100644", + "--- a/select-statements.go", + "+++ b/select-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4966b945ba5393d1f1e64efadf0af83c41425f11..b490190f8902330d676348583217eee062b8bb76" +} +,{ + "testCaseDescription": "go-select-statements-insert-test", + "expectedResult": { + "changes": { + "select-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 13, + 2 + ] + } + }, + "summary": "Added a select statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "select-statements.go" + ], + "patch": [ + "diff --git a/select-statements.go b/select-statements.go", + "index 79058077..6806fa67 100644", + "--- a/select-statements.go", + "+++ b/select-statements.go", + "@@ -1,5 +1,14 @@", + " package main", + " ", + " func main() {", + "-", + "+select {", + "+ case x := <-c:", + "+ println(x)", + "+ case y <- c:", + "+ println(5)", + "+ case <-time.After(1):", + "+ println(6)", + "+ default:", + "+ return", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "b490190f8902330d676348583217eee062b8bb76..f981714e374e7edd602f4b2e423d2d3651534f65" +} +,{ + "testCaseDescription": "go-select-statements-replacement-test", + "expectedResult": { + "changes": { + "select-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 9 + ] + }, + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 9 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + }, + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 21 + ], + "end": [ + 9, + 22 + ] + }, + { + "start": [ + 9, + 21 + ], + "end": [ + 9, + 22 + ] + } + ] + }, + "summary": "Replaced '1' with '2' in the time[After](2) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "select-statements.go" + ], + "patch": [ + "diff --git a/select-statements.go b/select-statements.go", + "index 6806fa67..1ca26fb9 100644", + "--- a/select-statements.go", + "+++ b/select-statements.go", + "@@ -2,11 +2,11 @@ package main", + " ", + " func main() {", + " select {", + "- case x := <-c:", + "+ case a := <-c:", + " println(x)", + "- case y <- c:", + "+ case b <- c:", + " println(5)", + "- case <-time.After(1):", + "+ case <-time.After(2):", + " println(6)", + " default:", + " return" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f981714e374e7edd602f4b2e423d2d3651534f65..3b29e2cdce6c5e5e3c3c1e88104fd7593eeada08" +} +,{ + "testCaseDescription": "go-select-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "select-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 9 + ] + }, + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 9 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + }, + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 21 + ], + "end": [ + 9, + 22 + ] + }, + { + "start": [ + 9, + 21 + ], + "end": [ + 9, + 22 + ] + } + ] + }, + "summary": "Replaced '2' with '1' in the time[After](1) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "select-statements.go" + ], + "patch": [ + "diff --git a/select-statements.go b/select-statements.go", + "index 1ca26fb9..6806fa67 100644", + "--- a/select-statements.go", + "+++ b/select-statements.go", + "@@ -2,11 +2,11 @@ package main", + " ", + " func main() {", + " select {", + "- case a := <-c:", + "+ case x := <-c:", + " println(x)", + "- case b <- c:", + "+ case y <- c:", + " println(5)", + "- case <-time.After(2):", + "+ case <-time.After(1):", + " println(6)", + " default:", + " return" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3b29e2cdce6c5e5e3c3c1e88104fd7593eeada08..0958411ec5eb18df1fb4d5897509d0d5476e4151" +} +,{ + "testCaseDescription": "go-select-statements-delete-insert-test", + "expectedResult": { + "changes": { + "select-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 13, + 2 + ] + } + }, + "summary": "Deleted a select statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "select-statements.go" + ], + "patch": [ + "diff --git a/select-statements.go b/select-statements.go", + "index 6806fa67..79058077 100644", + "--- a/select-statements.go", + "+++ b/select-statements.go", + "@@ -1,14 +1,5 @@", + " package main", + " ", + " func main() {", + "-select {", + "- case x := <-c:", + "- println(x)", + "- case y <- c:", + "- println(5)", + "- case <-time.After(1):", + "- println(6)", + "- default:", + "- return", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0958411ec5eb18df1fb4d5897509d0d5476e4151..f5e07ec87b0833ce3f9549a3e91e013115c7327d" +} +,{ + "testCaseDescription": "go-select-statements-teardown-test", + "expectedResult": { + "changes": { + "select-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "select-statements.go" + ], + "patch": [ + "diff --git a/select-statements.go b/select-statements.go", + "index 79058077..e69de29b 100644", + "--- a/select-statements.go", + "+++ b/select-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f5e07ec87b0833ce3f9549a3e91e013115c7327d..3ae31b84db1d8419897111182e8fdc9cad60fbbc" +}] diff --git a/test/corpus/diff-summaries/go/selector-expressions.json b/test/corpus/diff-summaries/go/selector-expressions.json new file mode 100644 index 000000000..5bf24b578 --- /dev/null +++ b/test/corpus/diff-summaries/go/selector-expressions.json @@ -0,0 +1,418 @@ +[{ + "testCaseDescription": "go-selector-expressions-setup-test", + "expectedResult": { + "changes": { + "selector-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "selector-expressions.go" + ], + "patch": [ + "diff --git a/selector-expressions.go b/selector-expressions.go", + "index e69de29b..79058077 100644", + "--- a/selector-expressions.go", + "+++ b/selector-expressions.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "39da12378f56efc6f5a7d91aa4cfd6dd9b410d0d..fd9b31c4cd54e4c44d98269cce2faff0c3da907b" +} +,{ + "testCaseDescription": "go-selector-expressions-insert-test", + "expectedResult": { + "changes": { + "selector-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 8 + ] + } + }, + "summary": "Added the 'a[b][c]()' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "selector-expressions.go" + ], + "patch": [ + "diff --git a/selector-expressions.go b/selector-expressions.go", + "index 79058077..8b4c745e 100644", + "--- a/selector-expressions.go", + "+++ b/selector-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+a.b.c()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fd9b31c4cd54e4c44d98269cce2faff0c3da907b..cb44fc99de5de15b963742ff38de9b05f6cf5759" +} +,{ + "testCaseDescription": "go-selector-expressions-replacement-test", + "expectedResult": { + "changes": { + "selector-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the x[y] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 4 + ] + }, + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 4 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the x[y] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'z' identifier in the x[y][z] subscript access of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "selector-expressions.go" + ], + "patch": [ + "diff --git a/selector-expressions.go b/selector-expressions.go", + "index 8b4c745e..0e519e3e 100644", + "--- a/selector-expressions.go", + "+++ b/selector-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-a.b.c()", + "+x.y.z()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "cb44fc99de5de15b963742ff38de9b05f6cf5759..d34c5acd304d3d054b62cdcd2e32e4e2e1535dcd" +} +,{ + "testCaseDescription": "go-selector-expressions-delete-replacement-test", + "expectedResult": { + "changes": { + "selector-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the a[b] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 4 + ] + }, + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 4 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the a[b] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the 'z' identifier with the 'c' identifier in the a[b][c] subscript access of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "selector-expressions.go" + ], + "patch": [ + "diff --git a/selector-expressions.go b/selector-expressions.go", + "index 0e519e3e..8b4c745e 100644", + "--- a/selector-expressions.go", + "+++ b/selector-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-x.y.z()", + "+a.b.c()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d34c5acd304d3d054b62cdcd2e32e4e2e1535dcd..683e206087e8d3c5235e9521999ee08b7c069913" +} +,{ + "testCaseDescription": "go-selector-expressions-delete-insert-test", + "expectedResult": { + "changes": { + "selector-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 8 + ] + } + }, + "summary": "Deleted the 'a[b][c]()' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "selector-expressions.go" + ], + "patch": [ + "diff --git a/selector-expressions.go b/selector-expressions.go", + "index 8b4c745e..79058077 100644", + "--- a/selector-expressions.go", + "+++ b/selector-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-a.b.c()", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "683e206087e8d3c5235e9521999ee08b7c069913..f2164e8ee879b26e7c0ac1b5ffa21fccf8a9bbac" +} +,{ + "testCaseDescription": "go-selector-expressions-teardown-test", + "expectedResult": { + "changes": { + "selector-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "selector-expressions.go" + ], + "patch": [ + "diff --git a/selector-expressions.go b/selector-expressions.go", + "index 79058077..e69de29b 100644", + "--- a/selector-expressions.go", + "+++ b/selector-expressions.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f2164e8ee879b26e7c0ac1b5ffa21fccf8a9bbac..da87539e91454e018a1ba3c704f8fceb37fc9f2b" +}] diff --git a/test/corpus/diff-summaries/go/send-statements.json b/test/corpus/diff-summaries/go/send-statements.json new file mode 100644 index 000000000..a810e8df6 --- /dev/null +++ b/test/corpus/diff-summaries/go/send-statements.json @@ -0,0 +1,364 @@ +[{ + "testCaseDescription": "go-send-statements-setup-test", + "expectedResult": { + "changes": { + "send-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "send-statements.go" + ], + "patch": [ + "diff --git a/send-statements.go b/send-statements.go", + "index e69de29b..79058077 100644", + "--- a/send-statements.go", + "+++ b/send-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "bd83133c1e3a033c4f1414f48bd415a48fca1973..e74984740c82a22d0ca71bfc69aacabbb4428c66" +} +,{ + "testCaseDescription": "go-send-statements-insert-test", + "expectedResult": { + "changes": { + "send-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Added the 'foo <- 5' send statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "send-statements.go" + ], + "patch": [ + "diff --git a/send-statements.go b/send-statements.go", + "index 79058077..5f327d16 100644", + "--- a/send-statements.go", + "+++ b/send-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+foo <- 5", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e74984740c82a22d0ca71bfc69aacabbb4428c66..41889c162f171b5861141abf350934bc372e48bc" +} +,{ + "testCaseDescription": "go-send-statements-replacement-test", + "expectedResult": { + "changes": { + "send-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced '5' with '6' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "send-statements.go" + ], + "patch": [ + "diff --git a/send-statements.go b/send-statements.go", + "index 5f327d16..3829478b 100644", + "--- a/send-statements.go", + "+++ b/send-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-foo <- 5", + "+bar <- 6", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "41889c162f171b5861141abf350934bc372e48bc..1765e31ee6e69075b5ffd7e96212ca465ad10699" +} +,{ + "testCaseDescription": "go-send-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "send-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 4 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced '6' with '5' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "send-statements.go" + ], + "patch": [ + "diff --git a/send-statements.go b/send-statements.go", + "index 3829478b..5f327d16 100644", + "--- a/send-statements.go", + "+++ b/send-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-bar <- 6", + "+foo <- 5", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1765e31ee6e69075b5ffd7e96212ca465ad10699..082482dfb2533204de96eb1e9331a85e576dd14c" +} +,{ + "testCaseDescription": "go-send-statements-delete-insert-test", + "expectedResult": { + "changes": { + "send-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Deleted the 'foo <- 5' send statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "send-statements.go" + ], + "patch": [ + "diff --git a/send-statements.go b/send-statements.go", + "index 5f327d16..79058077 100644", + "--- a/send-statements.go", + "+++ b/send-statements.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-foo <- 5", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "082482dfb2533204de96eb1e9331a85e576dd14c..5d09d4703ac53030caa3504aff8ebc9e5d63f795" +} +,{ + "testCaseDescription": "go-send-statements-teardown-test", + "expectedResult": { + "changes": { + "send-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "send-statements.go" + ], + "patch": [ + "diff --git a/send-statements.go b/send-statements.go", + "index 79058077..e69de29b 100644", + "--- a/send-statements.go", + "+++ b/send-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5d09d4703ac53030caa3504aff8ebc9e5d63f795..759bcc1def9029c1f75c6355dc3d149aad453526" +}] diff --git a/test/corpus/diff-summaries/go/short-var-declarations.json b/test/corpus/diff-summaries/go/short-var-declarations.json new file mode 100644 index 000000000..9c5678c8b --- /dev/null +++ b/test/corpus/diff-summaries/go/short-var-declarations.json @@ -0,0 +1,562 @@ +[{ + "testCaseDescription": "go-short-var-declarations-setup-test", + "expectedResult": { + "changes": { + "short-var-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "short-var-declarations.go" + ], + "patch": [ + "diff --git a/short-var-declarations.go b/short-var-declarations.go", + "index e69de29b..79058077 100644", + "--- a/short-var-declarations.go", + "+++ b/short-var-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1f7119ceb53f8159ac2330bdb3c78e76a19a5ed0..a2e7c4375e7fc045b6a99635256eabab7fa6b622" +} +,{ + "testCaseDescription": "go-short-var-declarations-insert-test", + "expectedResult": { + "changes": { + "short-var-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Added the 'a' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added the 'b' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Added '1' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Added '2' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "short-var-declarations.go" + ], + "patch": [ + "diff --git a/short-var-declarations.go b/short-var-declarations.go", + "index 79058077..4ca1ce37 100644", + "--- a/short-var-declarations.go", + "+++ b/short-var-declarations.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+a, b := 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a2e7c4375e7fc045b6a99635256eabab7fa6b622..b139d1556c66800c51df4d0dbd144853e2ca4b7d" +} +,{ + "testCaseDescription": "go-short-var-declarations-replacement-test", + "expectedResult": { + "changes": { + "short-var-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced '1' with '3' in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + }, + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + } + ] + }, + "summary": "Replaced '2' with '4' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "short-var-declarations.go" + ], + "patch": [ + "diff --git a/short-var-declarations.go b/short-var-declarations.go", + "index 4ca1ce37..bbbf9372 100644", + "--- a/short-var-declarations.go", + "+++ b/short-var-declarations.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-a, b := 1, 2", + "+x, y := 3, 4", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "b139d1556c66800c51df4d0dbd144853e2ca4b7d..7c16d07d891846d3d1ba2f4af66d03e7562261ad" +} +,{ + "testCaseDescription": "go-short-var-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "short-var-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced '3' with '1' in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + }, + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + } + ] + }, + "summary": "Replaced '4' with '2' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "short-var-declarations.go" + ], + "patch": [ + "diff --git a/short-var-declarations.go b/short-var-declarations.go", + "index bbbf9372..4ca1ce37 100644", + "--- a/short-var-declarations.go", + "+++ b/short-var-declarations.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-x, y := 3, 4", + "+a, b := 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7c16d07d891846d3d1ba2f4af66d03e7562261ad..6bdb4bee2e8545c02ec5e1ee43b8db9d9bbe3bcd" +} +,{ + "testCaseDescription": "go-short-var-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "short-var-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Deleted the 'a' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Deleted the 'b' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Deleted '1' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Deleted '2' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "short-var-declarations.go" + ], + "patch": [ + "diff --git a/short-var-declarations.go b/short-var-declarations.go", + "index 4ca1ce37..79058077 100644", + "--- a/short-var-declarations.go", + "+++ b/short-var-declarations.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-a, b := 1, 2", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6bdb4bee2e8545c02ec5e1ee43b8db9d9bbe3bcd..dc4bbc0a8f7d2a0ab806dd181cc75f881d14d9fd" +} +,{ + "testCaseDescription": "go-short-var-declarations-teardown-test", + "expectedResult": { + "changes": { + "short-var-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "short-var-declarations.go" + ], + "patch": [ + "diff --git a/short-var-declarations.go b/short-var-declarations.go", + "index 79058077..e69de29b 100644", + "--- a/short-var-declarations.go", + "+++ b/short-var-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "dc4bbc0a8f7d2a0ab806dd181cc75f881d14d9fd..373c46bee0b8179cf5d2f00412173597e503cdd3" +}] diff --git a/test/corpus/diff-summaries/go/single-import-declarations.json b/test/corpus/diff-summaries/go/single-import-declarations.json new file mode 100644 index 000000000..38fe5b961 --- /dev/null +++ b/test/corpus/diff-summaries/go/single-import-declarations.json @@ -0,0 +1,586 @@ +[{ + "testCaseDescription": "go-single-import-declarations-setup-test", + "expectedResult": { + "changes": { + "single-import-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-import-declarations.go" + ], + "patch": [ + "diff --git a/single-import-declarations.go b/single-import-declarations.go", + "index e69de29b..79058077 100644", + "--- a/single-import-declarations.go", + "+++ b/single-import-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e99d953fe89c051fc6ddd94acdb17fbbe4fd60ff..64b452d739eb84b670362434274cbd98792eb957" +} +,{ + "testCaseDescription": "go-single-import-declarations-insert-test", + "expectedResult": { + "changes": { + "single-import-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 18 + ] + } + }, + "summary": "Added the \"net/http\" string in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Added the \"some/dsl\" string in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the 'import' identifier in the main function" + } + ] + }, + "errors": { + "single-import-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added 'import' at line 4, column 1 - line 4, column 7 in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added 'import .' at line 5, column 1 - line 5, column 9 in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 8 + ], + "end": [ + 6, + 28 + ] + } + }, + "summary": "Added 'alias \"some/package\"' at line 6, column 8 - line 6, column 28 in the main function" + } + ] + } + }, + "filePaths": [ + "single-import-declarations.go" + ], + "patch": [ + "diff --git a/single-import-declarations.go b/single-import-declarations.go", + "index 79058077..bf7f515f 100644", + "--- a/single-import-declarations.go", + "+++ b/single-import-declarations.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "-", + "+import \"net/http\"", + "+import . \"some/dsl\"", + "+import alias \"some/package\"", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "64b452d739eb84b670362434274cbd98792eb957..9ece1e7c2f5678dc31fd153ac454222d929f4143" +} +,{ + "testCaseDescription": "go-single-import-declarations-replacement-test", + "expectedResult": { + "changes": { + "single-import-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 18 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 17 + ] + } + ] + }, + "summary": "Replaced the \"net/http\" string with the \"foo/bar\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 20 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 21 + ] + } + ] + }, + "summary": "Replaced the \"some/dsl\" string with the \"types/dsl\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 28 + ] + }, + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 32 + ] + } + ] + }, + "summary": "Replaced the \"some/package\" string with the \"awesome/packages\" string in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-import-declarations.go" + ], + "patch": [ + "diff --git a/single-import-declarations.go b/single-import-declarations.go", + "index bf7f515f..7710f5e3 100644", + "--- a/single-import-declarations.go", + "+++ b/single-import-declarations.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-import \"net/http\"", + "-import . \"some/dsl\"", + "-import alias \"some/package\"", + "+import \"foo/bar\"", + "+import . \"types/dsl\"", + "+import alias \"awesome/packages\"", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9ece1e7c2f5678dc31fd153ac454222d929f4143..1b550d979eeb4488916a19aeb6486b8d97dddde5" +} +,{ + "testCaseDescription": "go-single-import-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "single-import-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 17 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 18 + ] + } + ] + }, + "summary": "Replaced the \"foo/bar\" string with the \"net/http\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 21 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 20 + ] + } + ] + }, + "summary": "Replaced the \"types/dsl\" string with the \"some/dsl\" string in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 32 + ] + }, + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 28 + ] + } + ] + }, + "summary": "Replaced the \"awesome/packages\" string with the \"some/package\" string in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-import-declarations.go" + ], + "patch": [ + "diff --git a/single-import-declarations.go b/single-import-declarations.go", + "index 7710f5e3..bf7f515f 100644", + "--- a/single-import-declarations.go", + "+++ b/single-import-declarations.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-import \"foo/bar\"", + "-import . \"types/dsl\"", + "-import alias \"awesome/packages\"", + "+import \"net/http\"", + "+import . \"some/dsl\"", + "+import alias \"some/package\"", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1b550d979eeb4488916a19aeb6486b8d97dddde5..6ee950fe0e956a5453217e29f28a88f657835a5c" +} +,{ + "testCaseDescription": "go-single-import-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "single-import-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 18 + ] + } + }, + "summary": "Deleted the \"net/http\" string in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Deleted the \"some/dsl\" string in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Deleted the 'import' identifier in the main function" + } + ] + }, + "errors": { + "single-import-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Deleted 'import' at line 4, column 1 - line 4, column 7 in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted 'import .' at line 5, column 1 - line 5, column 9 in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 8 + ], + "end": [ + 6, + 28 + ] + } + }, + "summary": "Deleted 'alias \"some/package\"' at line 6, column 8 - line 6, column 28 in the main function" + } + ] + } + }, + "filePaths": [ + "single-import-declarations.go" + ], + "patch": [ + "diff --git a/single-import-declarations.go b/single-import-declarations.go", + "index bf7f515f..79058077 100644", + "--- a/single-import-declarations.go", + "+++ b/single-import-declarations.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "-import \"net/http\"", + "-import . \"some/dsl\"", + "-import alias \"some/package\"", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6ee950fe0e956a5453217e29f28a88f657835a5c..219e74492fbc41999128954070a9907d4eae5d8c" +} +,{ + "testCaseDescription": "go-single-import-declarations-teardown-test", + "expectedResult": { + "changes": { + "single-import-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-import-declarations.go" + ], + "patch": [ + "diff --git a/single-import-declarations.go b/single-import-declarations.go", + "index 79058077..e69de29b 100644", + "--- a/single-import-declarations.go", + "+++ b/single-import-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "219e74492fbc41999128954070a9907d4eae5d8c..12035f69827bc37748c981b2b49d8642aaa48689" +}] diff --git a/test/corpus/diff-summaries/go/single-line-function-declarations.json b/test/corpus/diff-summaries/go/single-line-function-declarations.json new file mode 100644 index 000000000..611b3c582 --- /dev/null +++ b/test/corpus/diff-summaries/go/single-line-function-declarations.json @@ -0,0 +1,490 @@ +[{ + "testCaseDescription": "go-single-line-function-declarations-setup-test", + "expectedResult": { + "changes": { + "single-line-function-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-line-function-declarations.go" + ], + "patch": [ + "diff --git a/single-line-function-declarations.go b/single-line-function-declarations.go", + "index e69de29b..9d7dcf23 100644", + "--- a/single-line-function-declarations.go", + "+++ b/single-line-function-declarations.go", + "@@ -0,0 +1,7 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}", + "+", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a2dfb03fc1f7dc5419ac9aa570a15071f5eeeeea..225fddd3d11be429342a0d4e7c9abb54b42a8c32" +} +,{ + "testCaseDescription": "go-single-line-function-declarations-insert-test", + "expectedResult": { + "changes": { + "single-line-function-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 18 + ] + } + }, + "summary": "Added the 'f1' function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 23 + ] + } + }, + "summary": "Added the 'f2' function" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 24 + ] + } + }, + "summary": "Added the 'f3' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-line-function-declarations.go" + ], + "patch": [ + "diff --git a/single-line-function-declarations.go b/single-line-function-declarations.go", + "index 9d7dcf23..23973728 100644", + "--- a/single-line-function-declarations.go", + "+++ b/single-line-function-declarations.go", + "@@ -4,4 +4,6 @@ func main() {", + " ", + " }", + " ", + "-", + "+func f1() { a() }", + "+func f2() { a(); b() }", + "+func f3() { a(); b(); }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "225fddd3d11be429342a0d4e7c9abb54b42a8c32..1d7c3c92138adb7630b33ba6a33d71ad86d32c51" +} +,{ + "testCaseDescription": "go-single-line-function-declarations-replacement-test", + "expectedResult": { + "changes": { + "single-line-function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f1' identifier with the 'g1' identifier in the g1 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + }, + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f2' identifier with the 'g2' identifier in the g2 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + }, + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f3' identifier with the 'g3' identifier in the g3 function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-line-function-declarations.go" + ], + "patch": [ + "diff --git a/single-line-function-declarations.go b/single-line-function-declarations.go", + "index 23973728..d075492b 100644", + "--- a/single-line-function-declarations.go", + "+++ b/single-line-function-declarations.go", + "@@ -4,6 +4,6 @@ func main() {", + " ", + " }", + " ", + "-func f1() { a() }", + "-func f2() { a(); b() }", + "-func f3() { a(); b(); }", + "+func g1() { a() }", + "+func g2() { a(); b() }", + "+func g3() { a(); b(); }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1d7c3c92138adb7630b33ba6a33d71ad86d32c51..5493986986093afdce7620f83e5e2182f270aa4a" +} +,{ + "testCaseDescription": "go-single-line-function-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "single-line-function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + } + ] + }, + "summary": "Replaced the 'g1' identifier with the 'f1' identifier in the f1 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + }, + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + } + ] + }, + "summary": "Replaced the 'g2' identifier with the 'f2' identifier in the f2 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + }, + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + } + ] + }, + "summary": "Replaced the 'g3' identifier with the 'f3' identifier in the f3 function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-line-function-declarations.go" + ], + "patch": [ + "diff --git a/single-line-function-declarations.go b/single-line-function-declarations.go", + "index d075492b..23973728 100644", + "--- a/single-line-function-declarations.go", + "+++ b/single-line-function-declarations.go", + "@@ -4,6 +4,6 @@ func main() {", + " ", + " }", + " ", + "-func g1() { a() }", + "-func g2() { a(); b() }", + "-func g3() { a(); b(); }", + "+func f1() { a() }", + "+func f2() { a(); b() }", + "+func f3() { a(); b(); }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5493986986093afdce7620f83e5e2182f270aa4a..a802ffab66887909c08e59655bdec11282ce864d" +} +,{ + "testCaseDescription": "go-single-line-function-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "single-line-function-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 18 + ] + } + }, + "summary": "Deleted the 'f1' function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 23 + ] + } + }, + "summary": "Deleted the 'f2' function" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 24 + ] + } + }, + "summary": "Deleted the 'f3' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-line-function-declarations.go" + ], + "patch": [ + "diff --git a/single-line-function-declarations.go b/single-line-function-declarations.go", + "index 23973728..9d7dcf23 100644", + "--- a/single-line-function-declarations.go", + "+++ b/single-line-function-declarations.go", + "@@ -4,6 +4,4 @@ func main() {", + " ", + " }", + " ", + "-func f1() { a() }", + "-func f2() { a(); b() }", + "-func f3() { a(); b(); }", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a802ffab66887909c08e59655bdec11282ce864d..17f4c946d0e3b2964d88a98346928973d40ebab0" +} +,{ + "testCaseDescription": "go-single-line-function-declarations-teardown-test", + "expectedResult": { + "changes": { + "single-line-function-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "single-line-function-declarations.go" + ], + "patch": [ + "diff --git a/single-line-function-declarations.go b/single-line-function-declarations.go", + "index 9d7dcf23..e69de29b 100644", + "--- a/single-line-function-declarations.go", + "+++ b/single-line-function-declarations.go", + "@@ -1,7 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}", + "-", + "-" + ], + "gitDir": "test/corpus/repos/go", + "shas": "17f4c946d0e3b2964d88a98346928973d40ebab0..ba5ad24cc5920db43a2b1942f11e4737fe450953" +}] diff --git a/test/corpus/diff-summaries/go/slice-literals.json b/test/corpus/diff-summaries/go/slice-literals.json new file mode 100644 index 000000000..5ef40986c --- /dev/null +++ b/test/corpus/diff-summaries/go/slice-literals.json @@ -0,0 +1,558 @@ +[{ + "testCaseDescription": "go-slice-literals-setup-test", + "expectedResult": { + "changes": { + "slice-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-literals.go" + ], + "patch": [ + "diff --git a/slice-literals.go b/slice-literals.go", + "index e69de29b..79058077 100644", + "--- a/slice-literals.go", + "+++ b/slice-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "287aea0892f667dc55ebc7ed257b311e9b4af708..cb75e26422058cecf4da56dc4f42c1689800851b" +} +,{ + "testCaseDescription": "go-slice-literals-insert-test", + "expectedResult": { + "changes": { + "slice-literals.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 22 + ] + } + }, + "summary": "Added the 's1' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 7 + ], + "end": [ + 5, + 26 + ] + } + }, + "summary": "Added the 's2' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 7 + ], + "end": [ + 9, + 2 + ] + } + }, + "summary": "Added the 's3' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-literals.go" + ], + "patch": [ + "diff --git a/slice-literals.go b/slice-literals.go", + "index 79058077..3c94936e 100644", + "--- a/slice-literals.go", + "+++ b/slice-literals.go", + "@@ -1,5 +1,10 @@", + " package main", + " ", + " func main() {", + "-", + "+const s1 = []string{}", + "+const s2 = []string{\"hi\"}", + "+const s3 = []string{", + "+\"hi\",", + "+ \"hello\",", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "cb75e26422058cecf4da56dc4f42c1689800851b..4b05b850e884ceeb2303af9b6f82d4e8f1099ea9" +} +,{ + "testCaseDescription": "go-slice-literals-replacement-test", + "expectedResult": { + "changes": { + "slice-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 20 + ], + "end": [ + 4, + 22 + ] + }, + { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 26 + ] + } + ] + }, + "summary": "Replaced the '{}' literal with the \"sup\" string in the []string\"sup\" composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 21 + ], + "end": [ + 5, + 25 + ] + }, + { + "start": [ + 5, + 21 + ], + "end": [ + 5, + 28 + ] + } + ] + }, + "summary": "Replaced the \"hi\" string with the \"hello\" string in the []string\"hello\" composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 5 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + ] + }, + "summary": "Replaced the \"hi\" string with the \"bar\" string in the []string\"bar\", \"baz\" composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 2 + ], + "end": [ + 8, + 9 + ] + }, + { + "start": [ + 8, + 2 + ], + "end": [ + 8, + 7 + ] + } + ] + }, + "summary": "Replaced the \"hello\" string with the \"baz\" string in the []string\"bar\", \"baz\" composite_literal of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-literals.go" + ], + "patch": [ + "diff --git a/slice-literals.go b/slice-literals.go", + "index 3c94936e..caefc004 100644", + "--- a/slice-literals.go", + "+++ b/slice-literals.go", + "@@ -1,10 +1,10 @@", + " package main", + " ", + " func main() {", + "-const s1 = []string{}", + "-const s2 = []string{\"hi\"}", + "+const s1 = []string{\"sup\"}", + "+const s2 = []string{\"hello\"}", + " const s3 = []string{", + "-\"hi\",", + "- \"hello\",", + "+\"bar\",", + "+ \"baz\",", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4b05b850e884ceeb2303af9b6f82d4e8f1099ea9..61061e5be759a097f5d1545791ca59022b01bbc9" +} +,{ + "testCaseDescription": "go-slice-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "slice-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 21 + ], + "end": [ + 4, + 26 + ] + }, + { + "start": [ + 4, + 20 + ], + "end": [ + 4, + 22 + ] + } + ] + }, + "summary": "Replaced the \"sup\" string with the '{}' literal in the []string{} composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 21 + ], + "end": [ + 5, + 28 + ] + }, + { + "start": [ + 5, + 21 + ], + "end": [ + 5, + 25 + ] + } + ] + }, + "summary": "Replaced the \"hello\" string with the \"hi\" string in the []string\"hi\" composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 5 + ] + } + ] + }, + "summary": "Replaced the \"bar\" string with the \"hi\" string in the []string\"hi\", \"hello\" composite_literal of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 2 + ], + "end": [ + 8, + 7 + ] + }, + { + "start": [ + 8, + 2 + ], + "end": [ + 8, + 9 + ] + } + ] + }, + "summary": "Replaced the \"baz\" string with the \"hello\" string in the []string\"hi\", \"hello\" composite_literal of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-literals.go" + ], + "patch": [ + "diff --git a/slice-literals.go b/slice-literals.go", + "index caefc004..3c94936e 100644", + "--- a/slice-literals.go", + "+++ b/slice-literals.go", + "@@ -1,10 +1,10 @@", + " package main", + " ", + " func main() {", + "-const s1 = []string{\"sup\"}", + "-const s2 = []string{\"hello\"}", + "+const s1 = []string{}", + "+const s2 = []string{\"hi\"}", + " const s3 = []string{", + "-\"bar\",", + "- \"baz\",", + "+\"hi\",", + "+ \"hello\",", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "61061e5be759a097f5d1545791ca59022b01bbc9..76bb2f7baf2a225af4728bb745b4a482d1d56807" +} +,{ + "testCaseDescription": "go-slice-literals-delete-insert-test", + "expectedResult": { + "changes": { + "slice-literals.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 22 + ] + } + }, + "summary": "Deleted the 's1' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 7 + ], + "end": [ + 5, + 26 + ] + } + }, + "summary": "Deleted the 's2' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 7 + ], + "end": [ + 9, + 2 + ] + } + }, + "summary": "Deleted the 's3' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-literals.go" + ], + "patch": [ + "diff --git a/slice-literals.go b/slice-literals.go", + "index 3c94936e..79058077 100644", + "--- a/slice-literals.go", + "+++ b/slice-literals.go", + "@@ -1,10 +1,5 @@", + " package main", + " ", + " func main() {", + "-const s1 = []string{}", + "-const s2 = []string{\"hi\"}", + "-const s3 = []string{", + "-\"hi\",", + "- \"hello\",", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "76bb2f7baf2a225af4728bb745b4a482d1d56807..17f7655ce5e4179807e1d7c1ba9a53e67d2ee9bd" +} +,{ + "testCaseDescription": "go-slice-literals-teardown-test", + "expectedResult": { + "changes": { + "slice-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-literals.go" + ], + "patch": [ + "diff --git a/slice-literals.go b/slice-literals.go", + "index 79058077..e69de29b 100644", + "--- a/slice-literals.go", + "+++ b/slice-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "17f7655ce5e4179807e1d7c1ba9a53e67d2ee9bd..bcd4bf3659a22076c572c879141d7ef13cadf8ba" +}] diff --git a/test/corpus/diff-summaries/go/slice-types.json b/test/corpus/diff-summaries/go/slice-types.json new file mode 100644 index 000000000..dc12e4555 --- /dev/null +++ b/test/corpus/diff-summaries/go/slice-types.json @@ -0,0 +1,412 @@ +[{ + "testCaseDescription": "go-slice-types-setup-test", + "expectedResult": { + "changes": { + "slice-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-types.go" + ], + "patch": [ + "diff --git a/slice-types.go b/slice-types.go", + "index e69de29b..79058077 100644", + "--- a/slice-types.go", + "+++ b/slice-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9ff6020ed6d316a29f1c88377d7c240617263a9f..882254ed7b0cd722dfff46407510724c9f0b2c61" +} +,{ + "testCaseDescription": "go-slice-types-insert-test", + "expectedResult": { + "changes": { + "slice-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the 'a' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the 'c' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-types.go" + ], + "patch": [ + "diff --git a/slice-types.go b/slice-types.go", + "index 79058077..4880791f 100644", + "--- a/slice-types.go", + "+++ b/slice-types.go", + "@@ -1,5 +1,6 @@", + " package main", + " ", + " func main() {", + "-", + "+type a []b", + "+type c [][]d", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "882254ed7b0cd722dfff46407510724c9f0b2c61..164404521e2aa4b521832bb7fe71c9cd035a5e8b" +} +,{ + "testCaseDescription": "go-slice-types-replacement-test", + "expectedResult": { + "changes": { + "slice-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Added the 'p' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted the 'b' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + } + }, + "summary": "Added the 'y' identifier in the 'c' type declaration of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Deleted the 'd' identifier in the 'c' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-types.go" + ], + "patch": [ + "diff --git a/slice-types.go b/slice-types.go", + "index 4880791f..b48b280a 100644", + "--- a/slice-types.go", + "+++ b/slice-types.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-type a []b", + "-type c [][]d", + "+type a [][]p", + "+type c []y", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "164404521e2aa4b521832bb7fe71c9cd035a5e8b..196296f9a4479d125a98799bb9cf01644ee3796f" +} +,{ + "testCaseDescription": "go-slice-types-delete-replacement-test", + "expectedResult": { + "changes": { + "slice-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the 'b' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Deleted the 'p' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the 'd' identifier in the 'c' type declaration of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + } + }, + "summary": "Deleted the 'y' identifier in the 'c' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-types.go" + ], + "patch": [ + "diff --git a/slice-types.go b/slice-types.go", + "index b48b280a..4880791f 100644", + "--- a/slice-types.go", + "+++ b/slice-types.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-type a [][]p", + "-type c []y", + "+type a []b", + "+type c [][]d", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "196296f9a4479d125a98799bb9cf01644ee3796f..e9beaa9fd710512677d12b205f2be667af0869b5" +} +,{ + "testCaseDescription": "go-slice-types-delete-insert-test", + "expectedResult": { + "changes": { + "slice-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted the 'a' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Deleted the 'c' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-types.go" + ], + "patch": [ + "diff --git a/slice-types.go b/slice-types.go", + "index 4880791f..79058077 100644", + "--- a/slice-types.go", + "+++ b/slice-types.go", + "@@ -1,6 +1,5 @@", + " package main", + " ", + " func main() {", + "-type a []b", + "-type c [][]d", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e9beaa9fd710512677d12b205f2be667af0869b5..48fe4f70691385cc7742257be3b10df76de66b87" +} +,{ + "testCaseDescription": "go-slice-types-teardown-test", + "expectedResult": { + "changes": { + "slice-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "slice-types.go" + ], + "patch": [ + "diff --git a/slice-types.go b/slice-types.go", + "index 79058077..e69de29b 100644", + "--- a/slice-types.go", + "+++ b/slice-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "48fe4f70691385cc7742257be3b10df76de66b87..5bfb56b9cae6ca1acf2adedeff9e9132c784d4fa" +}] diff --git a/test/corpus/diff-summaries/go/string-literals.json b/test/corpus/diff-summaries/go/string-literals.json new file mode 100644 index 000000000..90ac59c10 --- /dev/null +++ b/test/corpus/diff-summaries/go/string-literals.json @@ -0,0 +1,406 @@ +[{ + "testCaseDescription": "go-string-literals-setup-test", + "expectedResult": { + "changes": { + "string-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string-literals.go" + ], + "patch": [ + "diff --git a/string-literals.go b/string-literals.go", + "index e69de29b..79058077 100644", + "--- a/string-literals.go", + "+++ b/string-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "eb189cbc2630347c2b2e4e69f5fb5f1cd5284c7d..98712aa02acde0f78ba193135f9b9e0f90a890f5" +} +,{ + "testCaseDescription": "go-string-literals-insert-test", + "expectedResult": { + "changes": { + "string-literals.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Added the 'a' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 18 + ] + } + }, + "summary": "Added the 'b' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string-literals.go" + ], + "patch": [ + "diff --git a/string-literals.go b/string-literals.go", + "index 79058077..9a69966c 100644", + "--- a/string-literals.go", + "+++ b/string-literals.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+const (", + "+a = \"0\"", + "+b = \"hello world\"", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "98712aa02acde0f78ba193135f9b9e0f90a890f5..cf76340fd6ab133430d4e296f79a4188e4f134ed" +} +,{ + "testCaseDescription": "go-string-literals-replacement-test", + "expectedResult": { + "changes": { + "string-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the \"0\" string with the \"2\" string in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 18 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 9 + ] + } + ] + }, + "summary": "Replaced the \"hello world\" string with the \"hi\" string in the b var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string-literals.go" + ], + "patch": [ + "diff --git a/string-literals.go b/string-literals.go", + "index 9a69966c..fbbdb93e 100644", + "--- a/string-literals.go", + "+++ b/string-literals.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " const (", + "-a = \"0\"", + "-b = \"hello world\"", + "+a = \"2\"", + "+b = \"hi\"", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "cf76340fd6ab133430d4e296f79a4188e4f134ed..9b4dbad3c63251f51aca5d0d2cd0b983787cf813" +} +,{ + "testCaseDescription": "go-string-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "string-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the \"2\" string with the \"0\" string in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 9 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 18 + ] + } + ] + }, + "summary": "Replaced the \"hi\" string with the \"hello world\" string in the b var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string-literals.go" + ], + "patch": [ + "diff --git a/string-literals.go b/string-literals.go", + "index fbbdb93e..9a69966c 100644", + "--- a/string-literals.go", + "+++ b/string-literals.go", + "@@ -2,7 +2,7 @@ package main", + " ", + " func main() {", + " const (", + "-a = \"2\"", + "-b = \"hi\"", + "+a = \"0\"", + "+b = \"hello world\"", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9b4dbad3c63251f51aca5d0d2cd0b983787cf813..0d7bc860e3463955df73fbe5aaf6f5b7f81dd101" +} +,{ + "testCaseDescription": "go-string-literals-delete-insert-test", + "expectedResult": { + "changes": { + "string-literals.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Deleted the 'a' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 18 + ] + } + }, + "summary": "Deleted the 'b' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string-literals.go" + ], + "patch": [ + "diff --git a/string-literals.go b/string-literals.go", + "index 9a69966c..79058077 100644", + "--- a/string-literals.go", + "+++ b/string-literals.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-const (", + "-a = \"0\"", + "-b = \"hello world\"", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0d7bc860e3463955df73fbe5aaf6f5b7f81dd101..2afc59eda943429fd1f7e0dad6050887d184caf0" +} +,{ + "testCaseDescription": "go-string-literals-teardown-test", + "expectedResult": { + "changes": { + "string-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string-literals.go" + ], + "patch": [ + "diff --git a/string-literals.go b/string-literals.go", + "index 79058077..e69de29b 100644", + "--- a/string-literals.go", + "+++ b/string-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "2afc59eda943429fd1f7e0dad6050887d184caf0..287aea0892f667dc55ebc7ed257b311e9b4af708" +}] diff --git a/test/corpus/diff-summaries/go/struct-field-declarations.json b/test/corpus/diff-summaries/go/struct-field-declarations.json new file mode 100644 index 000000000..958809466 --- /dev/null +++ b/test/corpus/diff-summaries/go/struct-field-declarations.json @@ -0,0 +1,316 @@ +[{ + "testCaseDescription": "go-struct-field-declarations-setup-test", + "expectedResult": { + "changes": { + "struct-field-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-field-declarations.go" + ], + "patch": [ + "diff --git a/struct-field-declarations.go b/struct-field-declarations.go", + "index e69de29b..60d13f45 100644", + "--- a/struct-field-declarations.go", + "+++ b/struct-field-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+ type s3 struct {} ", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d42e8128993c8291af25742eee205e792ec356b4..aa9a6bac722c813f549ecef687567de30e818e77" +} +,{ + "testCaseDescription": "go-struct-field-declarations-insert-test", + "expectedResult": { + "changes": { + "struct-field-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Added the 'g int' field declaration in the struct {\n g int\n} struct type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-field-declarations.go" + ], + "patch": [ + "diff --git a/struct-field-declarations.go b/struct-field-declarations.go", + "index 60d13f45..bc84b146 100644", + "--- a/struct-field-declarations.go", + "+++ b/struct-field-declarations.go", + "@@ -1,5 +1,7 @@", + " package main", + " ", + " func main() {", + "- type s3 struct {} ", + "+ type s3 struct {", + "+ g int", + "+} ", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "aa9a6bac722c813f549ecef687567de30e818e77..228e2feb3493eca39ac4291b2c14c5447412b1d6" +} +,{ + "testCaseDescription": "go-struct-field-declarations-replacement-test", + "expectedResult": { + "changes": { + "struct-field-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 4 + ] + } + ] + }, + "summary": "Replaced the 'g int' field declaration with the 'h' identifier in the struct {\n h, i int\n} struct type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-field-declarations.go" + ], + "patch": [ + "diff --git a/struct-field-declarations.go b/struct-field-declarations.go", + "index bc84b146..f3ca9a51 100644", + "--- a/struct-field-declarations.go", + "+++ b/struct-field-declarations.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " type s3 struct {", + "- g int", + "+ h, i int", + " } ", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "228e2feb3493eca39ac4291b2c14c5447412b1d6..9d18bc2fb559b19afa3cee10781604781deba41b" +} +,{ + "testCaseDescription": "go-struct-field-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "struct-field-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 4 + ] + }, + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'g int' field declaration in the struct {\n g int\n} struct type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-field-declarations.go" + ], + "patch": [ + "diff --git a/struct-field-declarations.go b/struct-field-declarations.go", + "index f3ca9a51..bc84b146 100644", + "--- a/struct-field-declarations.go", + "+++ b/struct-field-declarations.go", + "@@ -2,6 +2,6 @@ package main", + " ", + " func main() {", + " type s3 struct {", + "- h, i int", + "+ g int", + " } ", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9d18bc2fb559b19afa3cee10781604781deba41b..796b9996727b5a3c012b03ba0c5854237745daaa" +} +,{ + "testCaseDescription": "go-struct-field-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "struct-field-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Deleted the 'g int' field declaration in the struct {} struct type of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-field-declarations.go" + ], + "patch": [ + "diff --git a/struct-field-declarations.go b/struct-field-declarations.go", + "index bc84b146..60d13f45 100644", + "--- a/struct-field-declarations.go", + "+++ b/struct-field-declarations.go", + "@@ -1,7 +1,5 @@", + " package main", + " ", + " func main() {", + "- type s3 struct {", + "- g int", + "-} ", + "+ type s3 struct {} ", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "796b9996727b5a3c012b03ba0c5854237745daaa..e7b66389f2592cfa36c690d7c8a3762cdbf1dafb" +} +,{ + "testCaseDescription": "go-struct-field-declarations-teardown-test", + "expectedResult": { + "changes": { + "struct-field-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-field-declarations.go" + ], + "patch": [ + "diff --git a/struct-field-declarations.go b/struct-field-declarations.go", + "index 60d13f45..e69de29b 100644", + "--- a/struct-field-declarations.go", + "+++ b/struct-field-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "- type s3 struct {} ", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e7b66389f2592cfa36c690d7c8a3762cdbf1dafb..a1fc9648f91cfb841a93722bdf033369a8b2ec1c" +}] diff --git a/test/corpus/diff-summaries/go/struct-literals.json b/test/corpus/diff-summaries/go/struct-literals.json new file mode 100644 index 000000000..3f16cba92 --- /dev/null +++ b/test/corpus/diff-summaries/go/struct-literals.json @@ -0,0 +1,610 @@ +[{ + "testCaseDescription": "go-struct-literals-setup-test", + "expectedResult": { + "changes": { + "struct-literals.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-literals.go" + ], + "patch": [ + "diff --git a/struct-literals.go b/struct-literals.go", + "index e69de29b..79058077 100644", + "--- a/struct-literals.go", + "+++ b/struct-literals.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6c6fe03e1ce4f7369c5cd528025e7e80a78cb2e3..98ca68a371b88e4f49719feef7f05c0ace8294d1" +} +,{ + "testCaseDescription": "go-struct-literals-insert-test", + "expectedResult": { + "changes": { + "struct-literals.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 7 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Added the 's1' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 32 + ] + } + }, + "summary": "Added the 's2' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 9, + 7 + ], + "end": [ + 9, + 23 + ] + } + }, + "summary": "Added the 's3' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-literals.go" + ], + "patch": [ + "diff --git a/struct-literals.go b/struct-literals.go", + "index 79058077..e6fd4f15 100644", + "--- a/struct-literals.go", + "+++ b/struct-literals.go", + "@@ -1,5 +1,10 @@", + " package main", + " ", + " func main() {", + "-", + "+const s1 = Person{", + "+name: \"Frank\",", + "+Age: \"5 months\",", + "+}", + "+const s2 = struct{i int;}{i: 5}", + "+const s3 = time.Time{}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "98ca68a371b88e4f49719feef7f05c0ace8294d1..16546622d6d5c3abb229f1efd401797b70d45e78" +} +,{ + "testCaseDescription": "go-struct-literals-replacement-test", + "expectedResult": { + "changes": { + "struct-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 18 + ] + }, + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + } + ] + }, + "summary": "Replaced the 'Person' identifier with the 'Dog' identifier in the s1 var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 21 + ], + "end": [ + 8, + 24 + ] + }, + { + "start": [ + 8, + 21 + ], + "end": [ + 8, + 26 + ] + } + ] + }, + "summary": "Replaced the 'int' identifier with the 'float' identifier in the struct{i float;} struct type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 27 + ], + "end": [ + 8, + 28 + ] + }, + { + "start": [ + 8, + 29 + ], + "end": [ + 8, + 30 + ] + } + ] + }, + "summary": "Replaced the 'i' identifier with the 'j' identifier in the j: 6 pair of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 30 + ], + "end": [ + 8, + 31 + ] + }, + { + "start": [ + 8, + 32 + ], + "end": [ + 8, + 33 + ] + } + ] + }, + "summary": "Replaced '5' with '6' in the j: 6 pair of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 12 + ], + "end": [ + 9, + 21 + ] + }, + { + "start": [ + 9, + 12 + ], + "end": [ + 9, + 22 + ] + } + ] + }, + "summary": "Replaced the 'time.Time' qualified identifier with the 'time.Month' qualified identifier in the s3 var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-literals.go" + ], + "patch": [ + "diff --git a/struct-literals.go b/struct-literals.go", + "index e6fd4f15..06724a46 100644", + "--- a/struct-literals.go", + "+++ b/struct-literals.go", + "@@ -1,10 +1,10 @@", + " package main", + " ", + " func main() {", + "-const s1 = Person{", + "+const s1 = Dog{", + " name: \"Frank\",", + " Age: \"5 months\",", + " }", + "-const s2 = struct{i int;}{i: 5}", + "-const s3 = time.Time{}", + "+const s2 = struct{i float;}{j: 6}", + "+const s3 = time.Month{}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "16546622d6d5c3abb229f1efd401797b70d45e78..0cb9ec3d83dc736d63d0bd8d950df9a9d5817f54" +} +,{ + "testCaseDescription": "go-struct-literals-delete-replacement-test", + "expectedResult": { + "changes": { + "struct-literals.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 15 + ] + }, + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 18 + ] + } + ] + }, + "summary": "Replaced the 'Dog' identifier with the 'Person' identifier in the s1 var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 21 + ], + "end": [ + 8, + 26 + ] + }, + { + "start": [ + 8, + 21 + ], + "end": [ + 8, + 24 + ] + } + ] + }, + "summary": "Replaced the 'float' identifier with the 'int' identifier in the struct{i int;} struct type of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 29 + ], + "end": [ + 8, + 30 + ] + }, + { + "start": [ + 8, + 27 + ], + "end": [ + 8, + 28 + ] + } + ] + }, + "summary": "Replaced the 'j' identifier with the 'i' identifier in the i: 5 pair of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 32 + ], + "end": [ + 8, + 33 + ] + }, + { + "start": [ + 8, + 30 + ], + "end": [ + 8, + 31 + ] + } + ] + }, + "summary": "Replaced '6' with '5' in the i: 5 pair of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 12 + ], + "end": [ + 9, + 22 + ] + }, + { + "start": [ + 9, + 12 + ], + "end": [ + 9, + 21 + ] + } + ] + }, + "summary": "Replaced the 'time.Month' qualified identifier with the 'time.Time' qualified identifier in the s3 var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-literals.go" + ], + "patch": [ + "diff --git a/struct-literals.go b/struct-literals.go", + "index 06724a46..e6fd4f15 100644", + "--- a/struct-literals.go", + "+++ b/struct-literals.go", + "@@ -1,10 +1,10 @@", + " package main", + " ", + " func main() {", + "-const s1 = Dog{", + "+const s1 = Person{", + " name: \"Frank\",", + " Age: \"5 months\",", + " }", + "-const s2 = struct{i float;}{j: 6}", + "-const s3 = time.Month{}", + "+const s2 = struct{i int;}{i: 5}", + "+const s3 = time.Time{}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "0cb9ec3d83dc736d63d0bd8d950df9a9d5817f54..ce0bf5c7a2ed66e66f174364a29682569e599a85" +} +,{ + "testCaseDescription": "go-struct-literals-delete-insert-test", + "expectedResult": { + "changes": { + "struct-literals.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 7 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Deleted the 's1' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 7 + ], + "end": [ + 8, + 32 + ] + } + }, + "summary": "Deleted the 's2' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 9, + 7 + ], + "end": [ + 9, + 23 + ] + } + }, + "summary": "Deleted the 's3' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-literals.go" + ], + "patch": [ + "diff --git a/struct-literals.go b/struct-literals.go", + "index e6fd4f15..79058077 100644", + "--- a/struct-literals.go", + "+++ b/struct-literals.go", + "@@ -1,10 +1,5 @@", + " package main", + " ", + " func main() {", + "-const s1 = Person{", + "-name: \"Frank\",", + "-Age: \"5 months\",", + "-}", + "-const s2 = struct{i int;}{i: 5}", + "-const s3 = time.Time{}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ce0bf5c7a2ed66e66f174364a29682569e599a85..59ec940f0880a6faa2cd6c22817b321149d8edac" +} +,{ + "testCaseDescription": "go-struct-literals-teardown-test", + "expectedResult": { + "changes": { + "struct-literals.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-literals.go" + ], + "patch": [ + "diff --git a/struct-literals.go b/struct-literals.go", + "index 79058077..e69de29b 100644", + "--- a/struct-literals.go", + "+++ b/struct-literals.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "59ec940f0880a6faa2cd6c22817b321149d8edac..bd83133c1e3a033c4f1414f48bd415a48fca1973" +}] diff --git a/test/corpus/diff-summaries/go/struct-types.json b/test/corpus/diff-summaries/go/struct-types.json new file mode 100644 index 000000000..508a7a81b --- /dev/null +++ b/test/corpus/diff-summaries/go/struct-types.json @@ -0,0 +1,598 @@ +[{ + "testCaseDescription": "go-struct-types-setup-test", + "expectedResult": { + "changes": { + "struct-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-types.go" + ], + "patch": [ + "diff --git a/struct-types.go b/struct-types.go", + "index e69de29b..79058077 100644", + "--- a/struct-types.go", + "+++ b/struct-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5bfb56b9cae6ca1acf2adedeff9e9132c784d4fa..a223c4c972b5b13a6ad55ba1ee6cfbf04f867f3c" +} +,{ + "testCaseDescription": "go-struct-types-insert-test", + "expectedResult": { + "changes": { + "struct-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 18 + ] + } + }, + "summary": "Added the 's1' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 26 + ] + } + }, + "summary": "Added the 's2' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 6 + ], + "end": [ + 8, + 2 + ] + } + }, + "summary": "Added the 's3' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 9, + 6 + ], + "end": [ + 12, + 2 + ] + } + }, + "summary": "Added the 's4' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-types.go" + ], + "patch": [ + "diff --git a/struct-types.go b/struct-types.go", + "index 79058077..13c82f80 100644", + "--- a/struct-types.go", + "+++ b/struct-types.go", + "@@ -1,5 +1,13 @@", + " package main", + " ", + " func main() {", + "-", + "+type s1 struct {}", + "+type s2 struct { Person }", + "+type s3 struct {", + "+f, g int", + "+}", + "+type s4 struct {", + "+p.s1", + "+ h int `json:\"h\"`", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a223c4c972b5b13a6ad55ba1ee6cfbf04f867f3c..39c8f71001980e9214f0e1e66dea313e46047512" +} +,{ + "testCaseDescription": "go-struct-types-replacement-test", + "expectedResult": { + "changes": { + "struct-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 's1' identifier with the 't1' identifier in the 't1' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 's2' identifier with the 't2' identifier in the 't2' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 's3' identifier with the 't3' identifier in the 't3' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + }, + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + } + ] + }, + "summary": "Replaced the 's4' identifier with the 't4' identifier in the 't4' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-types.go" + ], + "patch": [ + "diff --git a/struct-types.go b/struct-types.go", + "index 13c82f80..d73e92a6 100644", + "--- a/struct-types.go", + "+++ b/struct-types.go", + "@@ -1,12 +1,12 @@", + " package main", + " ", + " func main() {", + "-type s1 struct {}", + "-type s2 struct { Person }", + "-type s3 struct {", + "+type t1 struct {}", + "+type t2 struct { Person }", + "+type t3 struct {", + " f, g int", + " }", + "-type s4 struct {", + "+type t4 struct {", + " p.s1", + " h int `json:\"h\"`", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "39c8f71001980e9214f0e1e66dea313e46047512..ac30ec6e88285d3dea860bd984cd97378566aacb" +} +,{ + "testCaseDescription": "go-struct-types-delete-replacement-test", + "expectedResult": { + "changes": { + "struct-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 't1' identifier with the 's1' identifier in the 's1' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 't2' identifier with the 's2' identifier in the 's2' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 't3' identifier with the 's3' identifier in the 's3' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + }, + { + "start": [ + 9, + 6 + ], + "end": [ + 9, + 8 + ] + } + ] + }, + "summary": "Replaced the 't4' identifier with the 's4' identifier in the 's4' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-types.go" + ], + "patch": [ + "diff --git a/struct-types.go b/struct-types.go", + "index d73e92a6..13c82f80 100644", + "--- a/struct-types.go", + "+++ b/struct-types.go", + "@@ -1,12 +1,12 @@", + " package main", + " ", + " func main() {", + "-type t1 struct {}", + "-type t2 struct { Person }", + "-type t3 struct {", + "+type s1 struct {}", + "+type s2 struct { Person }", + "+type s3 struct {", + " f, g int", + " }", + "-type t4 struct {", + "+type s4 struct {", + " p.s1", + " h int `json:\"h\"`", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ac30ec6e88285d3dea860bd984cd97378566aacb..f9c26d5a554b7735154a8bc8dfc7474407b70fc0" +} +,{ + "testCaseDescription": "go-struct-types-delete-insert-test", + "expectedResult": { + "changes": { + "struct-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 18 + ] + } + }, + "summary": "Deleted the 's1' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 26 + ] + } + }, + "summary": "Deleted the 's2' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 6 + ], + "end": [ + 8, + 2 + ] + } + }, + "summary": "Deleted the 's3' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 9, + 6 + ], + "end": [ + 12, + 2 + ] + } + }, + "summary": "Deleted the 's4' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-types.go" + ], + "patch": [ + "diff --git a/struct-types.go b/struct-types.go", + "index 13c82f80..79058077 100644", + "--- a/struct-types.go", + "+++ b/struct-types.go", + "@@ -1,13 +1,5 @@", + " package main", + " ", + " func main() {", + "-type s1 struct {}", + "-type s2 struct { Person }", + "-type s3 struct {", + "-f, g int", + "-}", + "-type s4 struct {", + "-p.s1", + "- h int `json:\"h\"`", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f9c26d5a554b7735154a8bc8dfc7474407b70fc0..6fe2bfcae57e30574d4dfe5dd47a69c97823b22e" +} +,{ + "testCaseDescription": "go-struct-types-teardown-test", + "expectedResult": { + "changes": { + "struct-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "struct-types.go" + ], + "patch": [ + "diff --git a/struct-types.go b/struct-types.go", + "index 79058077..e69de29b 100644", + "--- a/struct-types.go", + "+++ b/struct-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6fe2bfcae57e30574d4dfe5dd47a69c97823b22e..5f287115383794ba8f417807b7e523efa7fef3b6" +}] diff --git a/test/corpus/diff-summaries/go/switch-statements.json b/test/corpus/diff-summaries/go/switch-statements.json new file mode 100644 index 000000000..34dd4b367 --- /dev/null +++ b/test/corpus/diff-summaries/go/switch-statements.json @@ -0,0 +1,585 @@ +[{ + "testCaseDescription": "go-switch-statements-setup-test", + "expectedResult": { + "changes": { + "switch-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Deleted a switch statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statements.go" + ], + "patch": [ + "diff --git a/switch-statements.go b/switch-statements.go", + "index 5cdd438b..79058077 100644", + "--- a/switch-statements.go", + "+++ b/switch-statements.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-switch { case x < y: f1()", + "-case x < z: g()", + "-case x == 4: h()", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4b10b6ade6ce2758e1727d4e03710722cb374ec6..31e99cd5c6a71a2d9d6abcef071b3061447da30f" +} +,{ + "testCaseDescription": "go-switch-statements-insert-test", + "expectedResult": { + "changes": { + "switch-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Added a switch statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statements.go" + ], + "patch": [ + "diff --git a/switch-statements.go b/switch-statements.go", + "index 79058077..5cdd438b 100644", + "--- a/switch-statements.go", + "+++ b/switch-statements.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+switch { case x < y: f1()", + "+case x < z: g()", + "+case x == 4: h()", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "31e99cd5c6a71a2d9d6abcef071b3061447da30f..7bde0e45b5072c0754139ae007b5f7dcee5c7069" +} +,{ + "testCaseDescription": "go-switch-statements-replacement-test", + "expectedResult": { + "changes": { + "switch-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 15 + ], + "end": [ + 4, + 16 + ] + }, + { + "start": [ + 4, + 15 + ], + "end": [ + 4, + 16 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 20 + ] + }, + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 20 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'c' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + } + ] + }, + "summary": "Replaced the 'z' identifier with the 'd' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'e' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 15 + ] + }, + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 15 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'f' identifier in the f() function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statements.go" + ], + "patch": [ + "diff --git a/switch-statements.go b/switch-statements.go", + "index 5cdd438b..0b838937 100644", + "--- a/switch-statements.go", + "+++ b/switch-statements.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-switch { case x < y: f1()", + "-case x < z: g()", + "-case x == 4: h()", + "+switch { case a < b: f1()", + "+case c < d: g()", + "+case e == 4: f()", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "7bde0e45b5072c0754139ae007b5f7dcee5c7069..d533c76ca97482b211aae89d5dc7317c2da9ed08" +} +,{ + "testCaseDescription": "go-switch-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "switch-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 15 + ], + "end": [ + 4, + 16 + ] + }, + { + "start": [ + 4, + 15 + ], + "end": [ + 4, + 16 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 20 + ] + }, + { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 20 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'x' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + } + ] + }, + "summary": "Replaced the 'd' identifier with the 'z' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'x' identifier in a switch statement of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 15 + ] + }, + { + "start": [ + 6, + 14 + ], + "end": [ + 6, + 15 + ] + } + ] + }, + "summary": "Replaced the 'f' identifier with the 'h' identifier in the h() function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statements.go" + ], + "patch": [ + "diff --git a/switch-statements.go b/switch-statements.go", + "index 0b838937..5cdd438b 100644", + "--- a/switch-statements.go", + "+++ b/switch-statements.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-switch { case a < b: f1()", + "-case c < d: g()", + "-case e == 4: f()", + "+switch { case x < y: f1()", + "+case x < z: g()", + "+case x == 4: h()", + " }", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d533c76ca97482b211aae89d5dc7317c2da9ed08..53db9755dfc81f3e1c701ff964a502d60bd070a0" +} +,{ + "testCaseDescription": "go-switch-statements-delete-insert-test", + "expectedResult": { + "changes": { + "switch-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Deleted a switch statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statements.go" + ], + "patch": [ + "diff --git a/switch-statements.go b/switch-statements.go", + "index 5cdd438b..79058077 100644", + "--- a/switch-statements.go", + "+++ b/switch-statements.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-switch { case x < y: f1()", + "-case x < z: g()", + "-case x == 4: h()", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "53db9755dfc81f3e1c701ff964a502d60bd070a0..fadee35ca8a0bdc037adc0ba40b48a0e3d83d1a0" +} +,{ + "testCaseDescription": "go-switch-statements-teardown-test", + "expectedResult": { + "changes": { + "switch-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statements.go" + ], + "patch": [ + "diff --git a/switch-statements.go b/switch-statements.go", + "index 79058077..e69de29b 100644", + "--- a/switch-statements.go", + "+++ b/switch-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fadee35ca8a0bdc037adc0ba40b48a0e3d83d1a0..331d50d25e2927f7ec24d69b4f21552787a91ed6" +}] diff --git a/test/corpus/diff-summaries/go/type-assertion-expressions.json b/test/corpus/diff-summaries/go/type-assertion-expressions.json new file mode 100644 index 000000000..032856c80 --- /dev/null +++ b/test/corpus/diff-summaries/go/type-assertion-expressions.json @@ -0,0 +1,364 @@ +[{ + "testCaseDescription": "go-type-assertion-expressions-setup-test", + "expectedResult": { + "changes": { + "type-assertion-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-assertion-expressions.go" + ], + "patch": [ + "diff --git a/type-assertion-expressions.go b/type-assertion-expressions.go", + "index e69de29b..79058077 100644", + "--- a/type-assertion-expressions.go", + "+++ b/type-assertion-expressions.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "16a71383b1105b6ba32fa5b1498ab5294acea29b..67ded9bcf53dc1ca1b6349945197e05b2d1936fa" +} +,{ + "testCaseDescription": "go-type-assertion-expressions-insert-test", + "expectedResult": { + "changes": { + "type-assertion-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Added the 'x.(z.Person)' type assertion statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-assertion-expressions.go" + ], + "patch": [ + "diff --git a/type-assertion-expressions.go b/type-assertion-expressions.go", + "index 79058077..4f148f43 100644", + "--- a/type-assertion-expressions.go", + "+++ b/type-assertion-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+x.(z.Person)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "67ded9bcf53dc1ca1b6349945197e05b2d1936fa..ac57a2465a1a421b4957ec3c8503bedc827927e7" +} +,{ + "testCaseDescription": "go-type-assertion-expressions-replacement-test", + "expectedResult": { + "changes": { + "type-assertion-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'b' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 12 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'z.Person' qualified identifier with the 'c.Dog' qualified identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-assertion-expressions.go" + ], + "patch": [ + "diff --git a/type-assertion-expressions.go b/type-assertion-expressions.go", + "index 4f148f43..e7463b41 100644", + "--- a/type-assertion-expressions.go", + "+++ b/type-assertion-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-x.(z.Person)", + "+b.(c.Dog)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ac57a2465a1a421b4957ec3c8503bedc827927e7..13bba50587780c11387c9efab0f00137b87ec14e" +} +,{ + "testCaseDescription": "go-type-assertion-expressions-delete-replacement-test", + "expectedResult": { + "changes": { + "type-assertion-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'x' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 12 + ] + } + ] + }, + "summary": "Replaced the 'c.Dog' qualified identifier with the 'z.Person' qualified identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-assertion-expressions.go" + ], + "patch": [ + "diff --git a/type-assertion-expressions.go b/type-assertion-expressions.go", + "index e7463b41..4f148f43 100644", + "--- a/type-assertion-expressions.go", + "+++ b/type-assertion-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-b.(c.Dog)", + "+x.(z.Person)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "13bba50587780c11387c9efab0f00137b87ec14e..6ca70b97d2774dda78b9d009405f597a45ad505c" +} +,{ + "testCaseDescription": "go-type-assertion-expressions-delete-insert-test", + "expectedResult": { + "changes": { + "type-assertion-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Deleted the 'x.(z.Person)' type assertion statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-assertion-expressions.go" + ], + "patch": [ + "diff --git a/type-assertion-expressions.go b/type-assertion-expressions.go", + "index 4f148f43..79058077 100644", + "--- a/type-assertion-expressions.go", + "+++ b/type-assertion-expressions.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-x.(z.Person)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "6ca70b97d2774dda78b9d009405f597a45ad505c..4e837f29c881bda8e83fdc36969ec0771da4f4d5" +} +,{ + "testCaseDescription": "go-type-assertion-expressions-teardown-test", + "expectedResult": { + "changes": { + "type-assertion-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-assertion-expressions.go" + ], + "patch": [ + "diff --git a/type-assertion-expressions.go b/type-assertion-expressions.go", + "index 79058077..e69de29b 100644", + "--- a/type-assertion-expressions.go", + "+++ b/type-assertion-expressions.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "4e837f29c881bda8e83fdc36969ec0771da4f4d5..54691480a5b9bd6970a6332895602b591fabd7c2" +}] diff --git a/test/corpus/diff-summaries/go/type-conversion-expressions.json b/test/corpus/diff-summaries/go/type-conversion-expressions.json new file mode 100644 index 000000000..6940c8e80 --- /dev/null +++ b/test/corpus/diff-summaries/go/type-conversion-expressions.json @@ -0,0 +1,1012 @@ +[{ + "testCaseDescription": "go-type-conversion-expressions-setup-test", + "expectedResult": { + "changes": { + "type-conversion-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-conversion-expressions.go" + ], + "patch": [ + "diff --git a/type-conversion-expressions.go b/type-conversion-expressions.go", + "index e69de29b..79058077 100644", + "--- a/type-conversion-expressions.go", + "+++ b/type-conversion-expressions.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "54691480a5b9bd6970a6332895602b591fabd7c2..9464e763d94da18bf6b9ccee697e277d5e33cd76" +} +,{ + "testCaseDescription": "go-type-conversion-expressions-insert-test", + "expectedResult": { + "changes": { + "type-conversion-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the '[]a.b(c.d)' type conversion expression in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 14 + ] + } + }, + "summary": "Added the '([]a.b)(c.d)' type conversion expression in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Added the 'e[f](g)' function call in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 10 + ] + } + }, + "summary": "Added the 'e[f](g)' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-conversion-expressions.go" + ], + "patch": [ + "diff --git a/type-conversion-expressions.go b/type-conversion-expressions.go", + "index 79058077..c6d65a70 100644", + "--- a/type-conversion-expressions.go", + "+++ b/type-conversion-expressions.go", + "@@ -1,5 +1,8 @@", + " package main", + " ", + " func main() {", + "-", + "+[]a.b(c.d)", + "+ ([]a.b)(c.d)", + "+ e.f(g)", + "+ (e.f)(g)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9464e763d94da18bf6b9ccee697e277d5e33cd76..1df0c37e414926259cc02a092ab59a3149694a6f" +} +,{ + "testCaseDescription": "go-type-conversion-expressions-replacement-test", + "expectedResult": { + "changes": { + "type-conversion-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the 'a.b' qualified identifier with the 'x.y' qualified identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'z' identifier in the z[e] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the 'd' identifier with the 'e' identifier in the z[e] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'a.b' qualified identifier with the 'f.g' qualified identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'h' identifier in the h[i] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced the 'd' identifier with the 'i' identifier in the h[i] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 3 + ] + }, + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 3 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'j' identifier in the j[k] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 4 + ], + "end": [ + 6, + 5 + ] + }, + { + "start": [ + 6, + 4 + ], + "end": [ + 6, + 5 + ] + } + ] + }, + "summary": "Replaced the 'f' identifier with the 'k' identifier in the j[k] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + } + ] + }, + "summary": "Replaced the 'g' identifier with the 'l' identifier in the j[k](l) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + }, + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'm' identifier in the m[n] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + }, + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + } + ] + }, + "summary": "Replaced the 'f' identifier with the 'n' identifier in the m[n] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + }, + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + } + ] + }, + "summary": "Replaced the 'g' identifier with the 'o' identifier in the m[n](o) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-conversion-expressions.go" + ], + "patch": [ + "diff --git a/type-conversion-expressions.go b/type-conversion-expressions.go", + "index c6d65a70..4c4381a6 100644", + "--- a/type-conversion-expressions.go", + "+++ b/type-conversion-expressions.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-[]a.b(c.d)", + "- ([]a.b)(c.d)", + "- e.f(g)", + "- (e.f)(g)", + "+[]x.y(z.e)", + "+ ([]f.g)(h.i)", + "+ j.k(l)", + "+ (m.n)(o)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1df0c37e414926259cc02a092ab59a3149694a6f..aac88f8490444e6f5bbbad41514c6879914f2592" +} +,{ + "testCaseDescription": "go-type-conversion-expressions-delete-replacement-test", + "expectedResult": { + "changes": { + "type-conversion-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the 'x.y' qualified identifier with the 'a.b' qualified identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 7 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'z' identifier with the 'c' identifier in the c[d] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + }, + { + "start": [ + 4, + 9 + ], + "end": [ + 4, + 10 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'd' identifier in the c[d] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f.g' qualified identifier with the 'a.b' qualified identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 11 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'c' identifier in the c[d] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 12 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced the 'i' identifier with the 'd' identifier in the c[d] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 3 + ] + }, + { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 3 + ] + } + ] + }, + "summary": "Replaced the 'j' identifier with the 'e' identifier in the e[f] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 4 + ], + "end": [ + 6, + 5 + ] + }, + { + "start": [ + 6, + 4 + ], + "end": [ + 6, + 5 + ] + } + ] + }, + "summary": "Replaced the 'k' identifier with the 'f' identifier in the e[f] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 7 + ] + } + ] + }, + "summary": "Replaced the 'l' identifier with the 'g' identifier in the e[f](g) function call of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + }, + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + } + ] + }, + "summary": "Replaced the 'm' identifier with the 'e' identifier in the e[f] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + }, + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + } + ] + }, + "summary": "Replaced the 'n' identifier with the 'f' identifier in the e[f] subscript access of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + }, + { + "start": [ + 7, + 8 + ], + "end": [ + 7, + 9 + ] + } + ] + }, + "summary": "Replaced the 'o' identifier with the 'g' identifier in the e[f](g) function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-conversion-expressions.go" + ], + "patch": [ + "diff --git a/type-conversion-expressions.go b/type-conversion-expressions.go", + "index 4c4381a6..c6d65a70 100644", + "--- a/type-conversion-expressions.go", + "+++ b/type-conversion-expressions.go", + "@@ -1,8 +1,8 @@", + " package main", + " ", + " func main() {", + "-[]x.y(z.e)", + "- ([]f.g)(h.i)", + "- j.k(l)", + "- (m.n)(o)", + "+[]a.b(c.d)", + "+ ([]a.b)(c.d)", + "+ e.f(g)", + "+ (e.f)(g)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "aac88f8490444e6f5bbbad41514c6879914f2592..27b1979cda7ed9cb96664c0fb904f88b2c581801" +} +,{ + "testCaseDescription": "go-type-conversion-expressions-delete-insert-test", + "expectedResult": { + "changes": { + "type-conversion-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted the '[]a.b(c.d)' type conversion expression in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 14 + ] + } + }, + "summary": "Deleted the '([]a.b)(c.d)' type conversion expression in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 2 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Deleted the 'e[f](g)' function call in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 2 + ], + "end": [ + 7, + 10 + ] + } + }, + "summary": "Deleted the 'e[f](g)' function call in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-conversion-expressions.go" + ], + "patch": [ + "diff --git a/type-conversion-expressions.go b/type-conversion-expressions.go", + "index c6d65a70..79058077 100644", + "--- a/type-conversion-expressions.go", + "+++ b/type-conversion-expressions.go", + "@@ -1,8 +1,5 @@", + " package main", + " ", + " func main() {", + "-[]a.b(c.d)", + "- ([]a.b)(c.d)", + "- e.f(g)", + "- (e.f)(g)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "27b1979cda7ed9cb96664c0fb904f88b2c581801..c8c90cd9092ec1b637cf9f9032aff2e4f8b5b02d" +} +,{ + "testCaseDescription": "go-type-conversion-expressions-teardown-test", + "expectedResult": { + "changes": { + "type-conversion-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-conversion-expressions.go" + ], + "patch": [ + "diff --git a/type-conversion-expressions.go b/type-conversion-expressions.go", + "index 79058077..e69de29b 100644", + "--- a/type-conversion-expressions.go", + "+++ b/type-conversion-expressions.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "c8c90cd9092ec1b637cf9f9032aff2e4f8b5b02d..ff70e778d77d3022b1405f9959a49805cd7ec6e8" +}] diff --git a/test/corpus/diff-summaries/go/type-declarations.json b/test/corpus/diff-summaries/go/type-declarations.json new file mode 100644 index 000000000..eb824991a --- /dev/null +++ b/test/corpus/diff-summaries/go/type-declarations.json @@ -0,0 +1,660 @@ +[{ + "testCaseDescription": "go-type-declarations-setup-test", + "expectedResult": { + "changes": { + "type-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-declarations.go" + ], + "patch": [ + "diff --git a/type-declarations.go b/type-declarations.go", + "index e69de29b..79058077 100644", + "--- a/type-declarations.go", + "+++ b/type-declarations.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "957e7a284d3bbaebd707764ceac202343581ccdb..3048609b5633d2fcdca43de044e16eea7af90613" +} +,{ + "testCaseDescription": "go-type-declarations-insert-test", + "expectedResult": { + "changes": { + "type-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Added the 'a' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Added the 'a' type declaration in the main function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Added the 'c' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-declarations.go" + ], + "patch": [ + "diff --git a/type-declarations.go b/type-declarations.go", + "index 79058077..799c45c8 100644", + "--- a/type-declarations.go", + "+++ b/type-declarations.go", + "@@ -1,5 +1,9 @@", + " package main", + " ", + " func main() {", + "-", + "+type a b", + "+type (", + "+ a b", + "+ c d", + "+)", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "3048609b5633d2fcdca43de044e16eea7af90613..574de74cbac0d7902fe22135e3bc0da02ecfdfe3" +} +,{ + "testCaseDescription": "go-type-declarations-replacement-test", + "expectedResult": { + "changes": { + "type-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the 'x' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the 'x' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 4 + ] + }, + { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 4 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'x' identifier in the 'x' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 6 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 6 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'y' identifier in the 'x' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + }, + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'e' identifier in the 'e' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + }, + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + } + ] + }, + "summary": "Replaced the 'd' identifier with the 'f' identifier in the 'e' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-declarations.go" + ], + "patch": [ + "diff --git a/type-declarations.go b/type-declarations.go", + "index 799c45c8..364f246c 100644", + "--- a/type-declarations.go", + "+++ b/type-declarations.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-type a b", + "+type x y", + " type (", + "- a b", + "- c d", + "+ x y", + "+ e f", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "574de74cbac0d7902fe22135e3bc0da02ecfdfe3..1bfbb1167c66fbee072c4b4527584c874a8cffe8" +} +,{ + "testCaseDescription": "go-type-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "type-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + }, + { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 4 + ] + }, + { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 4 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'a' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 6 + ] + }, + { + "start": [ + 6, + 5 + ], + "end": [ + 6, + 6 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'b' identifier in the 'a' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + }, + { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 4 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'c' identifier in the 'c' type declaration of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + }, + { + "start": [ + 7, + 5 + ], + "end": [ + 7, + 6 + ] + } + ] + }, + "summary": "Replaced the 'f' identifier with the 'd' identifier in the 'c' type declaration of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-declarations.go" + ], + "patch": [ + "diff --git a/type-declarations.go b/type-declarations.go", + "index 364f246c..799c45c8 100644", + "--- a/type-declarations.go", + "+++ b/type-declarations.go", + "@@ -1,9 +1,9 @@", + " package main", + " ", + " func main() {", + "-type x y", + "+type a b", + " type (", + "- x y", + "- e f", + "+ a b", + "+ c d", + " )", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1bfbb1167c66fbee072c4b4527584c874a8cffe8..205d1fef5ce02db2f5101901eb78b3c8272ac29d" +} +,{ + "testCaseDescription": "go-type-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "type-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 6 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Deleted the 'a' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 6, + 3 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Deleted the 'a' type declaration in the main function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 3 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Deleted the 'c' type declaration in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-declarations.go" + ], + "patch": [ + "diff --git a/type-declarations.go b/type-declarations.go", + "index 799c45c8..79058077 100644", + "--- a/type-declarations.go", + "+++ b/type-declarations.go", + "@@ -1,9 +1,5 @@", + " package main", + " ", + " func main() {", + "-type a b", + "-type (", + "- a b", + "- c d", + "-)", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "205d1fef5ce02db2f5101901eb78b3c8272ac29d..98b4b5f5773b74fdcf8e680df7db0b193b1bd02a" +} +,{ + "testCaseDescription": "go-type-declarations-teardown-test", + "expectedResult": { + "changes": { + "type-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-declarations.go" + ], + "patch": [ + "diff --git a/type-declarations.go b/type-declarations.go", + "index 79058077..e69de29b 100644", + "--- a/type-declarations.go", + "+++ b/type-declarations.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "98b4b5f5773b74fdcf8e680df7db0b193b1bd02a..5caeef873494edf9110ed67e273e7c4df49d588e" +}] diff --git a/test/corpus/diff-summaries/go/type-switch-statements.json b/test/corpus/diff-summaries/go/type-switch-statements.json new file mode 100644 index 000000000..64b401b06 --- /dev/null +++ b/test/corpus/diff-summaries/go/type-switch-statements.json @@ -0,0 +1,324 @@ +[{ + "testCaseDescription": "go-type-switch-statements-setup-test", + "expectedResult": { + "changes": { + "type-switch-statements.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-switch-statements.go" + ], + "patch": [ + "diff --git a/type-switch-statements.go b/type-switch-statements.go", + "index e69de29b..79058077 100644", + "--- a/type-switch-statements.go", + "+++ b/type-switch-statements.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "331d50d25e2927f7ec24d69b4f21552787a91ed6..995bee43c13c56bc924eca6b3041d00d6c275587" +} +,{ + "testCaseDescription": "go-type-switch-statements-insert-test", + "expectedResult": { + "changes": { + "type-switch-statements.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 9, + 2 + ] + } + }, + "summary": "Added the 'e' switch statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-switch-statements.go" + ], + "patch": [ + "diff --git a/type-switch-statements.go b/type-switch-statements.go", + "index 79058077..fd377c7a 100644", + "--- a/type-switch-statements.go", + "+++ b/type-switch-statements.go", + "@@ -1,5 +1,10 @@", + " package main", + " ", + " func main() {", + "-", + "+switch e.(type) {", + "+ case []Person:", + "+ a()", + "+ case *Dog:", + "+ break", + "+}", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "995bee43c13c56bc924eca6b3041d00d6c275587..5ca7d93e03a0c7b1c0b4ad603e18df64472fbf88" +} +,{ + "testCaseDescription": "go-type-switch-statements-replacement-test", + "expectedResult": { + "changes": { + "type-switch-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'b' identifier in the 'b' switch statement of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-switch-statements.go" + ], + "patch": [ + "diff --git a/type-switch-statements.go b/type-switch-statements.go", + "index fd377c7a..f5ef4d87 100644", + "--- a/type-switch-statements.go", + "+++ b/type-switch-statements.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-switch e.(type) {", + "+switch b.(type) {", + " case []Person:", + " a()", + " case *Dog:" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5ca7d93e03a0c7b1c0b4ad603e18df64472fbf88..21ab71153e357ca625b963ff3d2f3fb8de73f513" +} +,{ + "testCaseDescription": "go-type-switch-statements-delete-replacement-test", + "expectedResult": { + "changes": { + "type-switch-statements.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'e' identifier in the 'e' switch statement of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-switch-statements.go" + ], + "patch": [ + "diff --git a/type-switch-statements.go b/type-switch-statements.go", + "index f5ef4d87..fd377c7a 100644", + "--- a/type-switch-statements.go", + "+++ b/type-switch-statements.go", + "@@ -1,7 +1,7 @@", + " package main", + " ", + " func main() {", + "-switch b.(type) {", + "+switch e.(type) {", + " case []Person:", + " a()", + " case *Dog:" + ], + "gitDir": "test/corpus/repos/go", + "shas": "21ab71153e357ca625b963ff3d2f3fb8de73f513..d3fac9bf77e05e48c5f25b81701c11fd2a518f21" +} +,{ + "testCaseDescription": "go-type-switch-statements-delete-insert-test", + "expectedResult": { + "changes": { + "type-switch-statements.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 9, + 2 + ] + } + }, + "summary": "Deleted the 'e' switch statement in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-switch-statements.go" + ], + "patch": [ + "diff --git a/type-switch-statements.go b/type-switch-statements.go", + "index fd377c7a..79058077 100644", + "--- a/type-switch-statements.go", + "+++ b/type-switch-statements.go", + "@@ -1,10 +1,5 @@", + " package main", + " ", + " func main() {", + "-switch e.(type) {", + "- case []Person:", + "- a()", + "- case *Dog:", + "- break", + "-}", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d3fac9bf77e05e48c5f25b81701c11fd2a518f21..9acb35bd5a1853e7f98df42edf337f532f725d0a" +} +,{ + "testCaseDescription": "go-type-switch-statements-teardown-test", + "expectedResult": { + "changes": { + "type-switch-statements.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-switch-statements.go" + ], + "patch": [ + "diff --git a/type-switch-statements.go b/type-switch-statements.go", + "index 79058077..e69de29b 100644", + "--- a/type-switch-statements.go", + "+++ b/type-switch-statements.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9acb35bd5a1853e7f98df42edf337f532f725d0a..4966b945ba5393d1f1e64efadf0af83c41425f11" +}] diff --git a/test/corpus/diff-summaries/go/unary-expressions.json b/test/corpus/diff-summaries/go/unary-expressions.json new file mode 100644 index 000000000..8a4540722 --- /dev/null +++ b/test/corpus/diff-summaries/go/unary-expressions.json @@ -0,0 +1,400 @@ +[{ + "testCaseDescription": "go-unary-expressions-setup-test", + "expectedResult": { + "changes": { + "unary-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unary-expressions.go" + ], + "patch": [ + "diff --git a/unary-expressions.go b/unary-expressions.go", + "index e69de29b..79058077 100644", + "--- a/unary-expressions.go", + "+++ b/unary-expressions.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ff70e778d77d3022b1405f9959a49805cd7ec6e8..075961eb8b5782aebb534b633d577b2a8a759bbd" +} +,{ + "testCaseDescription": "go-unary-expressions-insert-test", + "expectedResult": { + "changes": { + "unary-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added the '!<-a' operator in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Added the '*foo()' operator in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unary-expressions.go" + ], + "patch": [ + "diff --git a/unary-expressions.go b/unary-expressions.go", + "index 79058077..bdf9ccc5 100644", + "--- a/unary-expressions.go", + "+++ b/unary-expressions.go", + "@@ -1,5 +1,6 @@", + " package main", + " ", + " func main() {", + "-", + "+!<-a", + "+*foo()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "075961eb8b5782aebb534b633d577b2a8a759bbd..743a20943ad5a710f54b654221ebec640bcca7f4" +} +,{ + "testCaseDescription": "go-unary-expressions-replacement-test", + "expectedResult": { + "changes": { + "unary-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 5 + ] + }, + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 5 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in the bar() function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unary-expressions.go" + ], + "patch": [ + "diff --git a/unary-expressions.go b/unary-expressions.go", + "index bdf9ccc5..cf8ed882 100644", + "--- a/unary-expressions.go", + "+++ b/unary-expressions.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-!<-a", + "-*foo()", + "+!<-b", + "+*bar()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "743a20943ad5a710f54b654221ebec640bcca7f4..cd05588013b5cb28be9bb55ede4c09277037871a" +} +,{ + "testCaseDescription": "go-unary-expressions-delete-replacement-test", + "expectedResult": { + "changes": { + "unary-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + }, + { + "start": [ + 4, + 4 + ], + "end": [ + 4, + 5 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 5 + ] + }, + { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 5 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier in the foo() function call of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unary-expressions.go" + ], + "patch": [ + "diff --git a/unary-expressions.go b/unary-expressions.go", + "index cf8ed882..bdf9ccc5 100644", + "--- a/unary-expressions.go", + "+++ b/unary-expressions.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-!<-b", + "-*bar()", + "+!<-a", + "+*foo()", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "cd05588013b5cb28be9bb55ede4c09277037871a..897abf3b1a152e7d11a97c70a77c76ea5b46d9cf" +} +,{ + "testCaseDescription": "go-unary-expressions-delete-insert-test", + "expectedResult": { + "changes": { + "unary-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Deleted the '!<-a' operator in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Deleted the '*foo()' operator in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unary-expressions.go" + ], + "patch": [ + "diff --git a/unary-expressions.go b/unary-expressions.go", + "index bdf9ccc5..79058077 100644", + "--- a/unary-expressions.go", + "+++ b/unary-expressions.go", + "@@ -1,6 +1,5 @@", + " package main", + " ", + " func main() {", + "-!<-a", + "-*foo()", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "897abf3b1a152e7d11a97c70a77c76ea5b46d9cf..a06adc4309175efa72367ae99b3f0be96ac7bbb1" +} +,{ + "testCaseDescription": "go-unary-expressions-teardown-test", + "expectedResult": { + "changes": { + "unary-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unary-expressions.go" + ], + "patch": [ + "diff --git a/unary-expressions.go b/unary-expressions.go", + "index 79058077..e69de29b 100644", + "--- a/unary-expressions.go", + "+++ b/unary-expressions.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a06adc4309175efa72367ae99b3f0be96ac7bbb1..cb535d2811aca85ccc5af6391402ea86b6b7e441" +}] diff --git a/test/corpus/diff-summaries/go/var-declarations-with-no-expressions.json b/test/corpus/diff-summaries/go/var-declarations-with-no-expressions.json new file mode 100644 index 000000000..fa21fc2ad --- /dev/null +++ b/test/corpus/diff-summaries/go/var-declarations-with-no-expressions.json @@ -0,0 +1,454 @@ +[{ + "testCaseDescription": "go-var-declarations-with-no-expressions-setup-test", + "expectedResult": { + "changes": { + "var-declarations-with-no-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-no-expressions.go" + ], + "patch": [ + "diff --git a/var-declarations-with-no-expressions.go b/var-declarations-with-no-expressions.go", + "index e69de29b..79058077 100644", + "--- a/var-declarations-with-no-expressions.go", + "+++ b/var-declarations-with-no-expressions.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8afcad6b71675b14fc6f8cf8a6bdf31462499d18..d9aa6f47e2d54a07a7cd2d7742cf60c6195d2ea4" +} +,{ + "testCaseDescription": "go-var-declarations-with-no-expressions-insert-test", + "expectedResult": { + "changes": { + "var-declarations-with-no-expressions.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Added the 'zero' var assignment in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Added the 'one, two' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-no-expressions.go" + ], + "patch": [ + "diff --git a/var-declarations-with-no-expressions.go b/var-declarations-with-no-expressions.go", + "index 79058077..fcdc3127 100644", + "--- a/var-declarations-with-no-expressions.go", + "+++ b/var-declarations-with-no-expressions.go", + "@@ -1,5 +1,6 @@", + " package main", + " ", + " func main() {", + "-", + "+var zero int", + "+var one, two uint64", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d9aa6f47e2d54a07a7cd2d7742cf60c6195d2ea4..2b3f87acc87f9ea6e34dc3a65e022c5d98dfdd14" +} +,{ + "testCaseDescription": "go-var-declarations-with-no-expressions-replacement-test", + "expectedResult": { + "changes": { + "var-declarations-with-no-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the 'zero' identifier with the 'a' identifier in the a var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 6 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'b' identifier in the b, c var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 9 + ] + } + ] + }, + "summary": "Replaced the 'two' identifier with the 'c' identifier in the b, c var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-no-expressions.go" + ], + "patch": [ + "diff --git a/var-declarations-with-no-expressions.go b/var-declarations-with-no-expressions.go", + "index fcdc3127..8aab74f1 100644", + "--- a/var-declarations-with-no-expressions.go", + "+++ b/var-declarations-with-no-expressions.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-var zero int", + "-var one, two uint64", + "+var a int", + "+var b, c uint64", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "2b3f87acc87f9ea6e34dc3a65e022c5d98dfdd14..f03cb525fb9db922c45267821903120ce3c320e9" +} +,{ + "testCaseDescription": "go-var-declarations-with-no-expressions-delete-replacement-test", + "expectedResult": { + "changes": { + "var-declarations-with-no-expressions.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'zero' identifier in the zero var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 6 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'one' identifier in the one, two var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 8 + ], + "end": [ + 5, + 9 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'two' identifier in the one, two var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-no-expressions.go" + ], + "patch": [ + "diff --git a/var-declarations-with-no-expressions.go b/var-declarations-with-no-expressions.go", + "index 8aab74f1..fcdc3127 100644", + "--- a/var-declarations-with-no-expressions.go", + "+++ b/var-declarations-with-no-expressions.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-var a int", + "-var b, c uint64", + "+var zero int", + "+var one, two uint64", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "f03cb525fb9db922c45267821903120ce3c320e9..8ee55fbc49a9dd1ba0088d23eaa9a7fb90b9b06f" +} +,{ + "testCaseDescription": "go-var-declarations-with-no-expressions-delete-insert-test", + "expectedResult": { + "changes": { + "var-declarations-with-no-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Deleted the 'zero' var assignment in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Deleted the 'one, two' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-no-expressions.go" + ], + "patch": [ + "diff --git a/var-declarations-with-no-expressions.go b/var-declarations-with-no-expressions.go", + "index fcdc3127..79058077 100644", + "--- a/var-declarations-with-no-expressions.go", + "+++ b/var-declarations-with-no-expressions.go", + "@@ -1,6 +1,5 @@", + " package main", + " ", + " func main() {", + "-var zero int", + "-var one, two uint64", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "8ee55fbc49a9dd1ba0088d23eaa9a7fb90b9b06f..1a01ce143bdf8ac8f7dbaf51de294eef00d16be6" +} +,{ + "testCaseDescription": "go-var-declarations-with-no-expressions-teardown-test", + "expectedResult": { + "changes": { + "var-declarations-with-no-expressions.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-no-expressions.go" + ], + "patch": [ + "diff --git a/var-declarations-with-no-expressions.go b/var-declarations-with-no-expressions.go", + "index 79058077..e69de29b 100644", + "--- a/var-declarations-with-no-expressions.go", + "+++ b/var-declarations-with-no-expressions.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1a01ce143bdf8ac8f7dbaf51de294eef00d16be6..2962e40e4009fc06a09468b0ecd4187635094a76" +}] diff --git a/test/corpus/diff-summaries/go/var-declarations-with-types.json b/test/corpus/diff-summaries/go/var-declarations-with-types.json new file mode 100644 index 000000000..0871bd1bd --- /dev/null +++ b/test/corpus/diff-summaries/go/var-declarations-with-types.json @@ -0,0 +1,634 @@ +[{ + "testCaseDescription": "go-var-declarations-with-types-setup-test", + "expectedResult": { + "changes": { + "var-declarations-with-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-types.go" + ], + "patch": [ + "diff --git a/var-declarations-with-types.go b/var-declarations-with-types.go", + "index e69de29b..79058077 100644", + "--- a/var-declarations-with-types.go", + "+++ b/var-declarations-with-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "07ecfacbec3625fb823e60080e9d897469ceedda..d680807e6e95885022385b4e9e21c58c9eb6567e" +} +,{ + "testCaseDescription": "go-var-declarations-with-types-insert-test", + "expectedResult": { + "changes": { + "var-declarations-with-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Added the 'zero' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Added the 'int' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 16 + ], + "end": [ + 4, + 17 + ] + } + }, + "summary": "Added '0' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Added the 'one' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the 'two' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 14 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Added the 'uint64' identifier in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 23 + ], + "end": [ + 5, + 24 + ] + } + }, + "summary": "Added '1' in the main function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 26 + ], + "end": [ + 5, + 27 + ] + } + }, + "summary": "Added '2' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-types.go" + ], + "patch": [ + "diff --git a/var-declarations-with-types.go b/var-declarations-with-types.go", + "index 79058077..d946c807 100644", + "--- a/var-declarations-with-types.go", + "+++ b/var-declarations-with-types.go", + "@@ -1,5 +1,6 @@", + " package main", + " ", + " func main() {", + "-", + "+var zero int = 0", + "+var one, two uint64 = 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "d680807e6e95885022385b4e9e21c58c9eb6567e..5406d1d9df3bcc3e16c170cdda6393d31144681a" +} +,{ + "testCaseDescription": "go-var-declarations-with-types-replacement-test", + "expectedResult": { + "changes": { + "var-declarations-with-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the 'zero' identifier with the 'a' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + }, + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'b' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 13 + ] + }, + { + "start": [ + 5, + 9 + ], + "end": [ + 5, + 10 + ] + } + ] + }, + "summary": "Replaced the 'two' identifier with the 'c' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-types.go" + ], + "patch": [ + "diff --git a/var-declarations-with-types.go b/var-declarations-with-types.go", + "index d946c807..14683f6f 100644", + "--- a/var-declarations-with-types.go", + "+++ b/var-declarations-with-types.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-var zero int = 0", + "-var one, two uint64 = 1, 2", + "+var a int = 0", + "+ var b, c uint64 = 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "5406d1d9df3bcc3e16c170cdda6393d31144681a..92672e6e8edd736db349d8876ade029bc733939d" +} +,{ + "testCaseDescription": "go-var-declarations-with-types-delete-replacement-test", + "expectedResult": { + "changes": { + "var-declarations-with-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'zero' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 6 + ], + "end": [ + 5, + 7 + ] + }, + { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'one' identifier in the main function" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 9 + ], + "end": [ + 5, + 10 + ] + }, + { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 13 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'two' identifier in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-types.go" + ], + "patch": [ + "diff --git a/var-declarations-with-types.go b/var-declarations-with-types.go", + "index 14683f6f..d946c807 100644", + "--- a/var-declarations-with-types.go", + "+++ b/var-declarations-with-types.go", + "@@ -1,6 +1,6 @@", + " package main", + " ", + " func main() {", + "-var a int = 0", + "- var b, c uint64 = 1, 2", + "+var zero int = 0", + "+var one, two uint64 = 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "92672e6e8edd736db349d8876ade029bc733939d..a300af98dca020d02ce00752e6f797287707bb1f" +} +,{ + "testCaseDescription": "go-var-declarations-with-types-delete-insert-test", + "expectedResult": { + "changes": { + "var-declarations-with-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + } + }, + "summary": "Deleted the 'zero' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Deleted the 'int' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 16 + ], + "end": [ + 4, + 17 + ] + } + }, + "summary": "Deleted '0' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 5 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Deleted the 'one' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 10 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Deleted the 'two' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 14 + ], + "end": [ + 5, + 20 + ] + } + }, + "summary": "Deleted the 'uint64' identifier in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 23 + ], + "end": [ + 5, + 24 + ] + } + }, + "summary": "Deleted '1' in the main function" + }, + { + "span": { + "delete": { + "start": [ + 5, + 26 + ], + "end": [ + 5, + 27 + ] + } + }, + "summary": "Deleted '2' in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-types.go" + ], + "patch": [ + "diff --git a/var-declarations-with-types.go b/var-declarations-with-types.go", + "index d946c807..79058077 100644", + "--- a/var-declarations-with-types.go", + "+++ b/var-declarations-with-types.go", + "@@ -1,6 +1,5 @@", + " package main", + " ", + " func main() {", + "-var zero int = 0", + "-var one, two uint64 = 1, 2", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a300af98dca020d02ce00752e6f797287707bb1f..46dd7bbf534938760c3e54a2117cafadba67ecf0" +} +,{ + "testCaseDescription": "go-var-declarations-with-types-teardown-test", + "expectedResult": { + "changes": { + "var-declarations-with-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-with-types.go" + ], + "patch": [ + "diff --git a/var-declarations-with-types.go b/var-declarations-with-types.go", + "index 79058077..e69de29b 100644", + "--- a/var-declarations-with-types.go", + "+++ b/var-declarations-with-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "46dd7bbf534938760c3e54a2117cafadba67ecf0..8afcad6b71675b14fc6f8cf8a6bdf31462499d18" +}] diff --git a/test/corpus/diff-summaries/go/var-declarations-without-types.json b/test/corpus/diff-summaries/go/var-declarations-without-types.json new file mode 100644 index 000000000..3ec7ce35d --- /dev/null +++ b/test/corpus/diff-summaries/go/var-declarations-without-types.json @@ -0,0 +1,424 @@ +[{ + "testCaseDescription": "go-var-declarations-without-types-setup-test", + "expectedResult": { + "changes": { + "var-declarations-without-types.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-without-types.go" + ], + "patch": [ + "diff --git a/var-declarations-without-types.go b/var-declarations-without-types.go", + "index e69de29b..79058077 100644", + "--- a/var-declarations-without-types.go", + "+++ b/var-declarations-without-types.go", + "@@ -0,0 +1,5 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "acb9e5e1c505bf2f3ccd977641fe0084ff8d7d58..9a1e79dd9b214136aa317b6cbae92f8b641f144e" +} +,{ + "testCaseDescription": "go-var-declarations-without-types-insert-test", + "expectedResult": { + "changes": { + "var-declarations-without-types.go": [ + { + "span": { + "insert": { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Added the 'zero' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-without-types.go" + ], + "patch": [ + "diff --git a/var-declarations-without-types.go b/var-declarations-without-types.go", + "index 79058077..64f60746 100644", + "--- a/var-declarations-without-types.go", + "+++ b/var-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-", + "+var zero = 0", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "9a1e79dd9b214136aa317b6cbae92f8b641f144e..e75333a458a729cc64fe4dd51ee2fae406ae4cef" +} +,{ + "testCaseDescription": "go-var-declarations-without-types-replacement-test", + "expectedResult": { + "changes": { + "var-declarations-without-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced the 'zero' identifier with the 'one' identifier in the one, two var assignment of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Added the 'two' identifier in the one, two var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + }, + { + "start": [ + 4, + 16 + ], + "end": [ + 4, + 17 + ] + } + ] + }, + "summary": "Replaced '0' with '1' in the one, two var assignment of the 'main' function" + }, + { + "span": { + "insert": { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 20 + ] + } + }, + "summary": "Added '2' in the one, two var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-without-types.go" + ], + "patch": [ + "diff --git a/var-declarations-without-types.go b/var-declarations-without-types.go", + "index 64f60746..88a72ee0 100644", + "--- a/var-declarations-without-types.go", + "+++ b/var-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-var zero = 0", + "+var one, two = 1, 2", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "e75333a458a729cc64fe4dd51ee2fae406ae4cef..fb0205ba2c2b8fe7be4d2d91b2045958f64033c3" +} +,{ + "testCaseDescription": "go-var-declarations-without-types-delete-replacement-test", + "expectedResult": { + "changes": { + "var-declarations-without-types.go": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 9 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'zero' identifier in the zero var assignment of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 10 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Deleted the 'two' identifier in the zero var assignment of the 'main' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 4, + 16 + ], + "end": [ + 4, + 17 + ] + }, + { + "start": [ + 4, + 12 + ], + "end": [ + 4, + 13 + ] + } + ] + }, + "summary": "Replaced '1' with '0' in the zero var assignment of the 'main' function" + }, + { + "span": { + "delete": { + "start": [ + 4, + 19 + ], + "end": [ + 4, + 20 + ] + } + }, + "summary": "Deleted '2' in the zero var assignment of the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-without-types.go" + ], + "patch": [ + "diff --git a/var-declarations-without-types.go b/var-declarations-without-types.go", + "index 88a72ee0..64f60746 100644", + "--- a/var-declarations-without-types.go", + "+++ b/var-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-var one, two = 1, 2", + "+var zero = 0", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "fb0205ba2c2b8fe7be4d2d91b2045958f64033c3..a4533b5d1eace74663277f159670e8bab76b59a9" +} +,{ + "testCaseDescription": "go-var-declarations-without-types-delete-insert-test", + "expectedResult": { + "changes": { + "var-declarations-without-types.go": [ + { + "span": { + "delete": { + "start": [ + 4, + 5 + ], + "end": [ + 4, + 13 + ] + } + }, + "summary": "Deleted the 'zero' var assignment in the main function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-without-types.go" + ], + "patch": [ + "diff --git a/var-declarations-without-types.go b/var-declarations-without-types.go", + "index 64f60746..79058077 100644", + "--- a/var-declarations-without-types.go", + "+++ b/var-declarations-without-types.go", + "@@ -1,5 +1,5 @@", + " package main", + " ", + " func main() {", + "-var zero = 0", + "+", + " }" + ], + "gitDir": "test/corpus/repos/go", + "shas": "a4533b5d1eace74663277f159670e8bab76b59a9..1cc3de5e23a2d48bc22d5877c0ca13ceb6f77da3" +} +,{ + "testCaseDescription": "go-var-declarations-without-types-teardown-test", + "expectedResult": { + "changes": { + "var-declarations-without-types.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declarations-without-types.go" + ], + "patch": [ + "diff --git a/var-declarations-without-types.go b/var-declarations-without-types.go", + "index 79058077..e69de29b 100644", + "--- a/var-declarations-without-types.go", + "+++ b/var-declarations-without-types.go", + "@@ -1,5 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "1cc3de5e23a2d48bc22d5877c0ca13ceb6f77da3..07ecfacbec3625fb823e60080e9d897469ceedda" +}] diff --git a/test/corpus/diff-summaries/go/variadic-function-declarations.json b/test/corpus/diff-summaries/go/variadic-function-declarations.json new file mode 100644 index 000000000..48e78f7d9 --- /dev/null +++ b/test/corpus/diff-summaries/go/variadic-function-declarations.json @@ -0,0 +1,488 @@ +[{ + "testCaseDescription": "go-variadic-function-declarations-setup-test", + "expectedResult": { + "changes": { + "variadic-function-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'main' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variadic-function-declarations.go" + ], + "patch": [ + "diff --git a/variadic-function-declarations.go b/variadic-function-declarations.go", + "index e69de29b..b97dec38 100644", + "--- a/variadic-function-declarations.go", + "+++ b/variadic-function-declarations.go", + "@@ -0,0 +1,6 @@", + "+package main", + "+", + "+func main() {", + "+", + "+}", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ba5ad24cc5920db43a2b1942f11e4737fe450953..15a77f6125a6c4dab3cb92fdca8bd43ffb7a095c" +} +,{ + "testCaseDescription": "go-variadic-function-declarations-insert-test", + "expectedResult": { + "changes": { + "variadic-function-declarations.go": [ + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 22 + ] + } + }, + "summary": "Added the 'f1' function" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 19 + ] + } + }, + "summary": "Added the 'f2' function" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 23 + ] + } + }, + "summary": "Added the 'f3' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variadic-function-declarations.go" + ], + "patch": [ + "diff --git a/variadic-function-declarations.go b/variadic-function-declarations.go", + "index b97dec38..6bdb4e0a 100644", + "--- a/variadic-function-declarations.go", + "+++ b/variadic-function-declarations.go", + "@@ -3,4 +3,6 @@ package main", + " func main() {", + " ", + " }", + "-", + "+func f1(a ...*int) {}", + "+func f2(...int) {}", + "+func f3(a, ...bool) {}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "15a77f6125a6c4dab3cb92fdca8bd43ffb7a095c..2795525acc11b3b4d3bb239efb44e4dbeeb3eb80" +} +,{ + "testCaseDescription": "go-variadic-function-declarations-replacement-test", + "expectedResult": { + "changes": { + "variadic-function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f1' identifier with the 'g1' identifier in the g1 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f2' identifier with the 'g2' identifier in the g2 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + }, + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + } + ] + }, + "summary": "Replaced the 'f3' identifier with the 'g3' identifier in the g3 function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variadic-function-declarations.go" + ], + "patch": [ + "diff --git a/variadic-function-declarations.go b/variadic-function-declarations.go", + "index 6bdb4e0a..ecc181af 100644", + "--- a/variadic-function-declarations.go", + "+++ b/variadic-function-declarations.go", + "@@ -3,6 +3,6 @@ package main", + " func main() {", + " ", + " }", + "-func f1(a ...*int) {}", + "-func f2(...int) {}", + "-func f3(a, ...bool) {}", + "+func g1(a ...*int) {}", + "+func g2(...int) {}", + "+func g3(a, ...bool) {}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "2795525acc11b3b4d3bb239efb44e4dbeeb3eb80..12f649346665ffb181bde064b58e5ac1d9d97860" +} +,{ + "testCaseDescription": "go-variadic-function-declarations-delete-replacement-test", + "expectedResult": { + "changes": { + "variadic-function-declarations.go": [ + { + "span": { + "replace": [ + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + }, + { + "start": [ + 6, + 6 + ], + "end": [ + 6, + 8 + ] + } + ] + }, + "summary": "Replaced the 'g1' identifier with the 'f1' identifier in the f1 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + }, + { + "start": [ + 7, + 6 + ], + "end": [ + 7, + 8 + ] + } + ] + }, + "summary": "Replaced the 'g2' identifier with the 'f2' identifier in the f2 function" + }, + { + "span": { + "replace": [ + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + }, + { + "start": [ + 8, + 6 + ], + "end": [ + 8, + 8 + ] + } + ] + }, + "summary": "Replaced the 'g3' identifier with the 'f3' identifier in the f3 function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variadic-function-declarations.go" + ], + "patch": [ + "diff --git a/variadic-function-declarations.go b/variadic-function-declarations.go", + "index ecc181af..6bdb4e0a 100644", + "--- a/variadic-function-declarations.go", + "+++ b/variadic-function-declarations.go", + "@@ -3,6 +3,6 @@ package main", + " func main() {", + " ", + " }", + "-func g1(a ...*int) {}", + "-func g2(...int) {}", + "-func g3(a, ...bool) {}", + "+func f1(a ...*int) {}", + "+func f2(...int) {}", + "+func f3(a, ...bool) {}" + ], + "gitDir": "test/corpus/repos/go", + "shas": "12f649346665ffb181bde064b58e5ac1d9d97860..ef93bbef3117c5583f11f22bd06558ddfad0784b" +} +,{ + "testCaseDescription": "go-variadic-function-declarations-delete-insert-test", + "expectedResult": { + "changes": { + "variadic-function-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 22 + ] + } + }, + "summary": "Deleted the 'f1' function" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 19 + ] + } + }, + "summary": "Deleted the 'f2' function" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 23 + ] + } + }, + "summary": "Deleted the 'f3' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variadic-function-declarations.go" + ], + "patch": [ + "diff --git a/variadic-function-declarations.go b/variadic-function-declarations.go", + "index 6bdb4e0a..b97dec38 100644", + "--- a/variadic-function-declarations.go", + "+++ b/variadic-function-declarations.go", + "@@ -3,6 +3,4 @@ package main", + " func main() {", + " ", + " }", + "-func f1(a ...*int) {}", + "-func f2(...int) {}", + "-func f3(a, ...bool) {}", + "+" + ], + "gitDir": "test/corpus/repos/go", + "shas": "ef93bbef3117c5583f11f22bd06558ddfad0784b..2f16adfed9c6ae862992be30903bb8e0e3f1e344" +} +,{ + "testCaseDescription": "go-variadic-function-declarations-teardown-test", + "expectedResult": { + "changes": { + "variadic-function-declarations.go": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'main' module" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted the 'main' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variadic-function-declarations.go" + ], + "patch": [ + "diff --git a/variadic-function-declarations.go b/variadic-function-declarations.go", + "index b97dec38..e69de29b 100644", + "--- a/variadic-function-declarations.go", + "+++ b/variadic-function-declarations.go", + "@@ -1,6 +0,0 @@", + "-package main", + "-", + "-func main() {", + "-", + "-}", + "-" + ], + "gitDir": "test/corpus/repos/go", + "shas": "2f16adfed9c6ae862992be30903bb8e0e3f1e344..d6222a7346773adfd0929112bedb22129a3519ea" +}] diff --git a/test/corpus/diff-summaries/javascript/anonymous-function.json b/test/corpus/diff-summaries/javascript/anonymous-function.json new file mode 100644 index 000000000..1e7bd14a2 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/anonymous-function.json @@ -0,0 +1,455 @@ +[{ + "testCaseDescription": "javascript-anonymous-function-insert-test", + "expectedResult": { + "changes": { + "anonymous-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Added an anonymous(a, b) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index e69de29b..b5928681 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -0,0 +1 @@", + "+function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "784daea9abe5781b5fb045bca826f00e058b0b62..79dfd6679e3715440ef3b7fe5659c2e95b464e0a" +} +,{ + "testCaseDescription": "javascript-anonymous-function-replacement-insert-test", + "expectedResult": { + "changes": { + "anonymous-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Added an anonymous(b, c) function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Added an anonymous(a, b) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index b5928681..e1de356c 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1 +1,3 @@", + "+function(b,c) { return b * c; }", + "+function(a,b) { return a + b; }", + " function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "79dfd6679e3715440ef3b7fe5659c2e95b464e0a..ad67bdb5c28dfa7bffb3b351b18bf4063fde4368" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-insert-test", + "expectedResult": { + "changes": { + "anonymous-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'b' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + }, + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + } + ] + }, + "summary": "Replaced the 'b * c' math operator with the 'a + b' math operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index e1de356c..4ca0d4c7 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,3 +1,3 @@", + "-function(b,c) { return b * c; }", + "+function(a,b) { return a + b; }", + " function(a,b) { return a + b; }", + " function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ad67bdb5c28dfa7bffb3b351b18bf4063fde4368..0311df3923d36634ac774ecd6c6c075095da4caa" +} +,{ + "testCaseDescription": "javascript-anonymous-function-replacement-test", + "expectedResult": { + "changes": { + "anonymous-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'c' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + }, + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + } + ] + }, + "summary": "Replaced the 'a + b' math operator with the 'b * c' math operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index 4ca0d4c7..e1de356c 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,3 +1,3 @@", + "-function(a,b) { return a + b; }", + "+function(b,c) { return b * c; }", + " function(a,b) { return a + b; }", + " function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0311df3923d36634ac774ecd6c6c075095da4caa..cfbe9b7d7304d2d7e48008f6dcfc45b46f220ae8" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-replacement-test", + "expectedResult": { + "changes": { + "anonymous-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted an anonymous(b, c) function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Deleted an anonymous(a, b) function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Added an anonymous(b, c) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index e1de356c..afdaccf7 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,3 +1,2 @@", + "-function(b,c) { return b * c; }", + "-function(a,b) { return a + b; }", + " function(a,b) { return a + b; }", + "+function(b,c) { return b * c; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cfbe9b7d7304d2d7e48008f6dcfc45b46f220ae8..3adabffe21f16f14d22321a15cdc94375a4bc8d4" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-test", + "expectedResult": { + "changes": { + "anonymous-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted an anonymous(a, b) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index afdaccf7..9f1856f5 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,2 +1 @@", + "-function(a,b) { return a + b; }", + " function(b,c) { return b * c; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3adabffe21f16f14d22321a15cdc94375a4bc8d4..c12493823be244170a3cbcfee3a58d73bbd3792e" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-rest-test", + "expectedResult": { + "changes": { + "anonymous-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted an anonymous(b, c) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index 9f1856f5..e69de29b 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1 +0,0 @@", + "-function(b,c) { return b * c; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c12493823be244170a3cbcfee3a58d73bbd3792e..971e80e1ed44f9f8b2609def8c1084ff18aae4d8" +}] diff --git a/test/corpus/diff-summaries/javascript/anonymous-parameterless-function.json b/test/corpus/diff-summaries/javascript/anonymous-parameterless-function.json new file mode 100644 index 000000000..6f932bdda --- /dev/null +++ b/test/corpus/diff-summaries/javascript/anonymous-parameterless-function.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-anonymous-parameterless-function-insert-test", + "expectedResult": { + "changes": { + "anonymous-parameterless-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 28 + ] + } + }, + "summary": "Added an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index e69de29b..4a26ae86 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -0,0 +1 @@", + "+function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "971e80e1ed44f9f8b2609def8c1084ff18aae4d8..0ecac91d871ce1710e1e882cdafae6b8144d1093" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-replacement-insert-test", + "expectedResult": { + "changes": { + "anonymous-parameterless-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Added an anonymous() function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 28 + ] + } + }, + "summary": "Added an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index 4a26ae86..c31dd4b7 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1 +1,3 @@", + "+function() { return 'hello'; }", + "+function() { return 'hi'; }", + " function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0ecac91d871ce1710e1e882cdafae6b8144d1093..aabf2599d13baffc37c37aeae922e9e0cab9321e" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-insert-test", + "expectedResult": { + "changes": { + "anonymous-parameterless-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 28 + ] + }, + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 25 + ] + } + ] + }, + "summary": "Replaced the 'hello' string with the 'hi' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index c31dd4b7..6b1efa42 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,3 +1,3 @@", + "-function() { return 'hello'; }", + "+function() { return 'hi'; }", + " function() { return 'hi'; }", + " function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "aabf2599d13baffc37c37aeae922e9e0cab9321e..e35377e1ae05ef1ef6b199f0b8cdf397ffc35728" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-replacement-test", + "expectedResult": { + "changes": { + "anonymous-parameterless-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 25 + ] + }, + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 28 + ] + } + ] + }, + "summary": "Replaced the 'hi' string with the 'hello' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index 6b1efa42..c31dd4b7 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,3 +1,3 @@", + "-function() { return 'hi'; }", + "+function() { return 'hello'; }", + " function() { return 'hi'; }", + " function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e35377e1ae05ef1ef6b199f0b8cdf397ffc35728..7c0deab8c4fb4b24af8ab03441af40715f70e777" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-replacement-test", + "expectedResult": { + "changes": { + "anonymous-parameterless-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Deleted an anonymous() function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 28 + ] + } + }, + "summary": "Deleted an anonymous() function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 31 + ] + } + }, + "summary": "Added an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index c31dd4b7..b8e05c0e 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,3 +1,2 @@", + "-function() { return 'hello'; }", + "-function() { return 'hi'; }", + " function() { return 'hi'; }", + "+function() { return 'hello'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7c0deab8c4fb4b24af8ab03441af40715f70e777..32102fd7e3e055358fa5f861e83107b9bf48d242" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-test", + "expectedResult": { + "changes": { + "anonymous-parameterless-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 28 + ] + } + }, + "summary": "Deleted an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index b8e05c0e..ce1ef833 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,2 +1 @@", + "-function() { return 'hi'; }", + " function() { return 'hello'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "32102fd7e3e055358fa5f861e83107b9bf48d242..35cdc685b60c7e9cd845b37a4511f72ecf607a11" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-rest-test", + "expectedResult": { + "changes": { + "anonymous-parameterless-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Deleted an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index ce1ef833..e69de29b 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1 +0,0 @@", + "-function() { return 'hello'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "35cdc685b60c7e9cd845b37a4511f72ecf607a11..4dbddbfa6c4e016d944aa6ee8ef1acfb4be38af8" +}] diff --git a/test/corpus/diff-summaries/javascript/array.json b/test/corpus/diff-summaries/javascript/array.json new file mode 100644 index 000000000..c2823b47e --- /dev/null +++ b/test/corpus/diff-summaries/javascript/array.json @@ -0,0 +1,323 @@ +[{ + "testCaseDescription": "javascript-array-insert-test", + "expectedResult": { + "changes": { + "array.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Added the '[ \"item1\" ]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index e69de29b..33355825 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -0,0 +1 @@", + "+[ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2bd27e99860858d0a524b5a307b97f412b4cc0c8..c5f2cfdf12cc04125dd63da617842503c567c5fd" +} +,{ + "testCaseDescription": "javascript-array-replacement-insert-test", + "expectedResult": { + "changes": { + "array.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the '[ \"item1\", \"item2\" ]' array" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 12 + ] + } + }, + "summary": "Added the '[ \"item1\" ]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index 33355825..cf37d7c1 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1 +1,3 @@", + "+[ \"item1\", \"item2\" ];", + "+[ \"item1\" ];", + " [ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c5f2cfdf12cc04125dd63da617842503c567c5fd..f25bd893c412fed4c8ec5ff56c9e97336ebfa3e3" +} +,{ + "testCaseDescription": "javascript-array-delete-insert-test", + "expectedResult": { + "changes": { + "array.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the \"item2\" string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index cf37d7c1..c2cb17fa 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,3 +1,3 @@", + "-[ \"item1\", \"item2\" ];", + "+[ \"item1\" ];", + " [ \"item1\" ];", + " [ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f25bd893c412fed4c8ec5ff56c9e97336ebfa3e3..e90ef017de2604896fd5252cf50abfae42a2de65" +} +,{ + "testCaseDescription": "javascript-array-replacement-test", + "expectedResult": { + "changes": { + "array.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the \"item2\" string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index c2cb17fa..cf37d7c1 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,3 +1,3 @@", + "-[ \"item1\" ];", + "+[ \"item1\", \"item2\" ];", + " [ \"item1\" ];", + " [ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e90ef017de2604896fd5252cf50abfae42a2de65..12aafb64072ed2e4f9e5ed53596077e121dcb3f8" +} +,{ + "testCaseDescription": "javascript-array-delete-replacement-test", + "expectedResult": { + "changes": { + "array.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the '[ \"item1\", \"item2\" ]' array" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 12 + ] + } + }, + "summary": "Deleted the '[ \"item1\" ]' array" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Added the '[ \"item1\", \"item2\" ]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index cf37d7c1..a4d92b81 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,3 +1,2 @@", + "-[ \"item1\", \"item2\" ];", + "-[ \"item1\" ];", + " [ \"item1\" ];", + "+[ \"item1\", \"item2\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "12aafb64072ed2e4f9e5ed53596077e121dcb3f8..b2226b56fac04d4cc961dd282b818e008e742836" +} +,{ + "testCaseDescription": "javascript-array-delete-test", + "expectedResult": { + "changes": { + "array.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the '[ \"item1\" ]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index a4d92b81..7f2f50e6 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,2 +1 @@", + "-[ \"item1\" ];", + " [ \"item1\", \"item2\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b2226b56fac04d4cc961dd282b818e008e742836..0c0547039a1aea4a4501be30ff4f29a4d02a11c7" +} +,{ + "testCaseDescription": "javascript-array-delete-rest-test", + "expectedResult": { + "changes": { + "array.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the '[ \"item1\", \"item2\" ]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index 7f2f50e6..e69de29b 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1 +0,0 @@", + "-[ \"item1\", \"item2\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0c0547039a1aea4a4501be30ff4f29a4d02a11c7..790803fdb50f5b52531a5fd1dc0573fd2b036126" +}] diff --git a/test/corpus/diff-summaries/javascript/arrow-function.json b/test/corpus/diff-summaries/javascript/arrow-function.json new file mode 100644 index 000000000..a7e453013 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/arrow-function.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-arrow-function-insert-test", + "expectedResult": { + "changes": { + "arrow-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Added an anonymous(f, g) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index e69de29b..9ef167c0 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -0,0 +1 @@", + "+(f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "42d2564cba025ea67f19ffdd328b554aa2aede8b..8b26d17bccd77a6adc09be5f4f6925211d49f608" +} +,{ + "testCaseDescription": "javascript-arrow-function-replacement-insert-test", + "expectedResult": { + "changes": { + "arrow-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Added an anonymous(f, g) function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 24 + ] + } + }, + "summary": "Added an anonymous(f, g) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 9ef167c0..92dea6fa 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1 +1,3 @@", + "+(f, g) => { return g; };", + "+(f, g) => { return h; };", + " (f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8b26d17bccd77a6adc09be5f4f6925211d49f608..26b2bb5c170fa68dcde0a45330c61cf3b86aa481" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-insert-test", + "expectedResult": { + "changes": { + "arrow-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'g' identifier with the 'h' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 92dea6fa..8f5bb516 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,3 +1,3 @@", + "-(f, g) => { return g; };", + "+(f, g) => { return h; };", + " (f, g) => { return h; };", + " (f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "26b2bb5c170fa68dcde0a45330c61cf3b86aa481..88cf4316918c8cbf307d3f35021088ba4f00cb48" +} +,{ + "testCaseDescription": "javascript-arrow-function-replacement-test", + "expectedResult": { + "changes": { + "arrow-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'g' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 8f5bb516..92dea6fa 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,3 +1,3 @@", + "-(f, g) => { return h; };", + "+(f, g) => { return g; };", + " (f, g) => { return h; };", + " (f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "88cf4316918c8cbf307d3f35021088ba4f00cb48..d48fb117156de30732546f9bc5ad9cbd05504069" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-replacement-test", + "expectedResult": { + "changes": { + "arrow-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Deleted an anonymous(f, g) function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 24 + ] + } + }, + "summary": "Deleted an anonymous(f, g) function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 24 + ] + } + }, + "summary": "Added an anonymous(f, g) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 92dea6fa..acab9a9c 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,3 +1,2 @@", + "-(f, g) => { return g; };", + "-(f, g) => { return h; };", + " (f, g) => { return h; };", + "+(f, g) => { return g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d48fb117156de30732546f9bc5ad9cbd05504069..beb073e32c22aa0cba1502e259619ca5dbcc2484" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-test", + "expectedResult": { + "changes": { + "arrow-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Deleted an anonymous(f, g) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index acab9a9c..ef1be25b 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,2 +1 @@", + "-(f, g) => { return h; };", + " (f, g) => { return g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "beb073e32c22aa0cba1502e259619ca5dbcc2484..8dd01eee1e30aeb73b7ef44206565ecb24b71dde" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-rest-test", + "expectedResult": { + "changes": { + "arrow-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Deleted an anonymous(f, g) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index ef1be25b..e69de29b 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1 +0,0 @@", + "-(f, g) => { return g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8dd01eee1e30aeb73b7ef44206565ecb24b71dde..39852cdd4b70a1926580629f96ee4221841afb76" +}] diff --git a/test/corpus/diff-summaries/javascript/assignment.json b/test/corpus/diff-summaries/javascript/assignment.json new file mode 100644 index 000000000..a48ad10e8 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/assignment.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-assignment-insert-test", + "expectedResult": { + "changes": { + "assignment.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index e69de29b..6882fe5e 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -0,0 +1 @@", + "+x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ae3598b402258260e941e7a876918f8037bf887d..fd7a7b20b42d08ee2f42c5ec5e913fd5fc4c73dc" +} +,{ + "testCaseDescription": "javascript-assignment-replacement-insert-test", + "expectedResult": { + "changes": { + "assignment.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 6882fe5e..fb4cba44 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1 +1,3 @@", + "+x = 1;", + "+x = 0;", + " x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fd7a7b20b42d08ee2f42c5ec5e913fd5fc4c73dc..8e6308ced68ef5b841fa40a6534e38dff1b2e5f9" +} +,{ + "testCaseDescription": "javascript-assignment-delete-insert-test", + "expectedResult": { + "changes": { + "assignment.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced '1' with '0' in an assignment to x" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index fb4cba44..42e16c61 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,3 +1,3 @@", + "-x = 1;", + "+x = 0;", + " x = 0;", + " x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8e6308ced68ef5b841fa40a6534e38dff1b2e5f9..2696ad06b794ac91951ad0db11a60a6d9f326b9c" +} +,{ + "testCaseDescription": "javascript-assignment-replacement-test", + "expectedResult": { + "changes": { + "assignment.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced '0' with '1' in an assignment to x" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 42e16c61..fb4cba44 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,3 +1,3 @@", + "-x = 0;", + "+x = 1;", + " x = 0;", + " x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2696ad06b794ac91951ad0db11a60a6d9f326b9c..0aac1d89f0577d4e374e02b91c8daf4e3a8cb1e6" +} +,{ + "testCaseDescription": "javascript-assignment-delete-replacement-test", + "expectedResult": { + "changes": { + "assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index fb4cba44..11fe15d7 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,3 +1,2 @@", + "-x = 1;", + "-x = 0;", + " x = 0;", + "+x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0aac1d89f0577d4e374e02b91c8daf4e3a8cb1e6..84f1974640b46de51ce2424ef0a34a5aed26a83e" +} +,{ + "testCaseDescription": "javascript-assignment-delete-test", + "expectedResult": { + "changes": { + "assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 11fe15d7..198b8f89 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,2 +1 @@", + "-x = 0;", + " x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "84f1974640b46de51ce2424ef0a34a5aed26a83e..79dde8d0f8db201fd8c3507b2d66f862d34a8ad5" +} +,{ + "testCaseDescription": "javascript-assignment-delete-rest-test", + "expectedResult": { + "changes": { + "assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 198b8f89..e69de29b 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1 +0,0 @@", + "-x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "79dde8d0f8db201fd8c3507b2d66f862d34a8ad5..02c7c57f6900a26076acb665ba4fc51a55fc79db" +}] diff --git a/test/corpus/diff-summaries/javascript/bitwise-operator.json b/test/corpus/diff-summaries/javascript/bitwise-operator.json new file mode 100644 index 000000000..44f277806 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/bitwise-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-bitwise-operator-insert-test", + "expectedResult": { + "changes": { + "bitwise-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'i >> j' bitwise operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index e69de29b..021cf6ad 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -0,0 +1 @@", + "+i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8eb05a7fac3721888570615043a58da2a28e278e..e14d15bff391dc532b49157ab968f48fc0086b54" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "bitwise-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'i >> k' bitwise operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'i >> j' bitwise operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 021cf6ad..3e0b6c17 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1 +1,3 @@", + "+i >> k;", + "+i >> j;", + " i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e14d15bff391dc532b49157ab968f48fc0086b54..34fdb106b5c1bb73196a1ee8ecd1c817825cb2f8" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-insert-test", + "expectedResult": { + "changes": { + "bitwise-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'k' identifier with the 'j' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 3e0b6c17..18853d16 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,3 +1,3 @@", + "-i >> k;", + "+i >> j;", + " i >> j;", + " i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "34fdb106b5c1bb73196a1ee8ecd1c817825cb2f8..eea256d8297ce7d2bdf17205c8f929819c7c56ec" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-replacement-test", + "expectedResult": { + "changes": { + "bitwise-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'j' identifier with the 'k' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 18853d16..3e0b6c17 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,3 +1,3 @@", + "-i >> j;", + "+i >> k;", + " i >> j;", + " i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "eea256d8297ce7d2bdf17205c8f929819c7c56ec..722c71a678e72e79281ce2c0847a09b4a9e5b52c" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "bitwise-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'i >> k' bitwise operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'i >> j' bitwise operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'i >> k' bitwise operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 3e0b6c17..ee7d8dec 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,3 +1,2 @@", + "-i >> k;", + "-i >> j;", + " i >> j;", + "+i >> k;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "722c71a678e72e79281ce2c0847a09b4a9e5b52c..2dbfa9bdf49e3112341bad6e9fbb2845a70d5a6d" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-test", + "expectedResult": { + "changes": { + "bitwise-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'i >> j' bitwise operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index ee7d8dec..2800c8c8 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,2 +1 @@", + "-i >> j;", + " i >> k;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2dbfa9bdf49e3112341bad6e9fbb2845a70d5a6d..5246a10f3ea2f174a908f8976aaf13cb6a454dc0" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-rest-test", + "expectedResult": { + "changes": { + "bitwise-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'i >> k' bitwise operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 2800c8c8..e69de29b 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1 +0,0 @@", + "-i >> k;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5246a10f3ea2f174a908f8976aaf13cb6a454dc0..ef8d4296ee2dfe27245e4697b092bcf81f14acce" +}] diff --git a/test/corpus/diff-summaries/javascript/boolean-operator.json b/test/corpus/diff-summaries/javascript/boolean-operator.json new file mode 100644 index 000000000..7778c9332 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/boolean-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-boolean-operator-insert-test", + "expectedResult": { + "changes": { + "boolean-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'i || j' boolean operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index e69de29b..7280a98c 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -0,0 +1 @@", + "+i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "60e56ee717443319fd06b7b25a02393835ad25e4..0fd3f94bbca77a5e4a4dea4ae5ecc4a7b2a7cf6f" +} +,{ + "testCaseDescription": "javascript-boolean-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "boolean-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'i && j' boolean operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'i || j' boolean operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index 7280a98c..fe3f3064 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1 +1,3 @@", + "+i && j;", + "+i || j;", + " i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0fd3f94bbca77a5e4a4dea4ae5ecc4a7b2a7cf6f..17f325d11dfa050a157ccf5679cbe1ed270d713e" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-insert-test", + "expectedResult": { + "changes": { + "boolean-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'i && j' boolean operator with the 'i || j' boolean operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index fe3f3064..273c0ee8 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,3 +1,3 @@", + "-i && j;", + "+i || j;", + " i || j;", + " i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "17f325d11dfa050a157ccf5679cbe1ed270d713e..fde9a571269f580178b33b191abe2ad403e3be54" +} +,{ + "testCaseDescription": "javascript-boolean-operator-replacement-test", + "expectedResult": { + "changes": { + "boolean-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'i || j' boolean operator with the 'i && j' boolean operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index 273c0ee8..fe3f3064 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,3 +1,3 @@", + "-i || j;", + "+i && j;", + " i || j;", + " i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fde9a571269f580178b33b191abe2ad403e3be54..e6ad1de0a4a9e55334402ff2aff8ececff181c12" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "boolean-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'i && j' boolean operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'i || j' boolean operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'i && j' boolean operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index fe3f3064..7f4873c1 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,3 +1,2 @@", + "-i && j;", + "-i || j;", + " i || j;", + "+i && j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e6ad1de0a4a9e55334402ff2aff8ececff181c12..5418dc49e7d40c66acafad0ae967c5c9360b8868" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-test", + "expectedResult": { + "changes": { + "boolean-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'i || j' boolean operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index 7f4873c1..c6921d12 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,2 +1 @@", + "-i || j;", + " i && j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5418dc49e7d40c66acafad0ae967c5c9360b8868..cd66c224553926eca0160ddbed77db465273bec9" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-rest-test", + "expectedResult": { + "changes": { + "boolean-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'i && j' boolean operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index c6921d12..e69de29b 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1 +0,0 @@", + "-i && j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cd66c224553926eca0160ddbed77db465273bec9..8eb05a7fac3721888570615043a58da2a28e278e" +}] diff --git a/test/corpus/diff-summaries/javascript/break.json b/test/corpus/diff-summaries/javascript/break.json new file mode 100644 index 000000000..7cc825454 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/break.json @@ -0,0 +1,292 @@ +[{ + "testCaseDescription": "javascript-break-setup-test", + "expectedResult": { + "changes": { + "break.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 50 + ] + } + }, + "summary": "Added the 'i = 0; i < 10; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "break.js" + ], + "patch": [ + "diff --git a/break.js b/break.js", + "index e69de29b..3f583e3d 100644", + "--- a/break.js", + "+++ b/break.js", + "@@ -0,0 +1 @@", + "+for (i = 0; i < 10; i++) { if (i === 4) { }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "689c75b2c901c257422d3759b780fc15b9819a0d..5eb3b30f1a301d6f29f72a5918e0e67dc0bd4e6e" +} +,{ + "testCaseDescription": "javascript-break-insert-test", + "expectedResult": { + "changes": { + "break.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 49 + ] + } + }, + "summary": "Added a break statement in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Deleted the '{ }' object in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "break.js" + ], + "patch": [ + "diff --git a/break.js b/break.js", + "index 3f583e3d..629dfa91 100644", + "--- a/break.js", + "+++ b/break.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5eb3b30f1a301d6f29f72a5918e0e67dc0bd4e6e..eb63e35e2ba221a54f60193d95864c6019cb3f85" +} +,{ + "testCaseDescription": "javascript-break-replacement-test", + "expectedResult": { + "changes": { + "break.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Added a continue statement in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 49 + ] + } + }, + "summary": "Deleted a break statement in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "break.js" + ], + "patch": [ + "diff --git a/break.js b/break.js", + "index 629dfa91..16ebcc57 100644", + "--- a/break.js", + "+++ b/break.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "eb63e35e2ba221a54f60193d95864c6019cb3f85..ac199cd2633184c5938b67c680406fc9ef4dbae0" +} +,{ + "testCaseDescription": "javascript-break-delete-replacement-test", + "expectedResult": { + "changes": { + "break.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 49 + ] + } + }, + "summary": "Added a break statement in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Deleted a continue statement in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "break.js" + ], + "patch": [ + "diff --git a/break.js b/break.js", + "index 16ebcc57..629dfa91 100644", + "--- a/break.js", + "+++ b/break.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ac199cd2633184c5938b67c680406fc9ef4dbae0..046f6130859081f355b85af2a949770a034c2001" +} +,{ + "testCaseDescription": "javascript-break-delete-insert-test", + "expectedResult": { + "changes": { + "break.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Added the '{ }' object in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 49 + ] + } + }, + "summary": "Deleted a break statement in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "break.js" + ], + "patch": [ + "diff --git a/break.js b/break.js", + "index 629dfa91..3f583e3d 100644", + "--- a/break.js", + "+++ b/break.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "046f6130859081f355b85af2a949770a034c2001..1e56e3767e24a60a8d9516ddf57a4a8d5b291989" +} +,{ + "testCaseDescription": "javascript-break-teardown-test", + "expectedResult": { + "changes": { + "break.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 50 + ] + } + }, + "summary": "Deleted the 'i = 0; i < 10; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "break.js" + ], + "patch": [ + "diff --git a/break.js b/break.js", + "index 3f583e3d..e69de29b 100644", + "--- a/break.js", + "+++ b/break.js", + "@@ -1 +0,0 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1e56e3767e24a60a8d9516ddf57a4a8d5b291989..a6c03f4fe5985c8424ed595bd7d50ecc6098dc8a" +}] diff --git a/test/corpus/diff-summaries/javascript/chained-callbacks.json b/test/corpus/diff-summaries/javascript/chained-callbacks.json new file mode 100644 index 000000000..1f07283e2 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/chained-callbacks.json @@ -0,0 +1,455 @@ +[{ + "testCaseDescription": "javascript-chained-callbacks-insert-test", + "expectedResult": { + "changes": { + "chained-callbacks.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Added the 'this.map(…)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index e69de29b..ce9ee1ed 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -0,0 +1 @@", + "+this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9d8e6a9365dd210f6592bfbb25de8eb159ea7499..1ac143c91e550a2392ac6cb4724efe0f6c31477b" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-replacement-insert-test", + "expectedResult": { + "changes": { + "chained-callbacks.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Added the 'this.reduce(…)' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 39 + ] + } + }, + "summary": "Added the 'this.map(…)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index ce9ee1ed..acba744a 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1 +1,3 @@", + "+this.reduce(function (a) { return b.a; })", + "+this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1ac143c91e550a2392ac6cb4724efe0f6c31477b..f7ab59d2024e14a5260519faa0012ae957547395" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-insert-test", + "expectedResult": { + "changes": { + "chained-callbacks.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 12 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'reduce' identifier with the 'map' identifier in the this.map(…) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + }, + { + "start": [ + 1, + 32 + ], + "end": [ + 1, + 33 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier in the this.map(…) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 37 + ], + "end": [ + 1, + 38 + ] + }, + { + "start": [ + 1, + 34 + ], + "end": [ + 1, + 35 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier in the this.map(…) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index acba744a..73905343 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,3 +1,3 @@", + "-this.reduce(function (a) { return b.a; })", + "+this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f7ab59d2024e14a5260519faa0012ae957547395..49320cf924ffd18ed8c5dcda326cbf6526f49030" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-replacement-test", + "expectedResult": { + "changes": { + "chained-callbacks.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 12 + ] + } + ] + }, + "summary": "Replaced the 'map' identifier with the 'reduce' identifier in the this.reduce(…) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 32 + ], + "end": [ + 1, + 33 + ] + }, + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier in the this.reduce(…) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 34 + ], + "end": [ + 1, + 35 + ] + }, + { + "start": [ + 1, + 37 + ], + "end": [ + 1, + 38 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier in the this.reduce(…) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index 73905343..acba744a 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,3 +1,3 @@", + "-this.map(function (a) { return a.b; })", + "+this.reduce(function (a) { return b.a; })", + " this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "49320cf924ffd18ed8c5dcda326cbf6526f49030..325ca9645fc4edf757aa30d91a58bd348a5bb43c" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-replacement-test", + "expectedResult": { + "changes": { + "chained-callbacks.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Deleted the 'this.reduce(…)' function call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 39 + ] + } + }, + "summary": "Deleted the 'this.map(…)' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 42 + ] + } + }, + "summary": "Added the 'this.reduce(…)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index acba744a..c4db4326 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,3 +1,2 @@", + "-this.reduce(function (a) { return b.a; })", + "-this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })", + "+this.reduce(function (a) { return b.a; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "325ca9645fc4edf757aa30d91a58bd348a5bb43c..191853942041b4c49b5888ccb5fb138c2fcce147" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-test", + "expectedResult": { + "changes": { + "chained-callbacks.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the 'this.map(…)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index c4db4326..e5934198 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,2 +1 @@", + "-this.map(function (a) { return a.b; })", + " this.reduce(function (a) { return b.a; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "191853942041b4c49b5888ccb5fb138c2fcce147..4d93f0d28d7c311ebe367c1846ece4937efa0f80" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-rest-test", + "expectedResult": { + "changes": { + "chained-callbacks.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Deleted the 'this.reduce(…)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index e5934198..e69de29b 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1 +0,0 @@", + "-this.reduce(function (a) { return b.a; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4d93f0d28d7c311ebe367c1846ece4937efa0f80..c95bd0e01ff1d7d686262b782db20ad959d3676f" +}] diff --git a/test/corpus/diff-summaries/javascript/chained-property-access.json b/test/corpus/diff-summaries/javascript/chained-property-access.json new file mode 100644 index 000000000..0fdc98d6f --- /dev/null +++ b/test/corpus/diff-summaries/javascript/chained-property-access.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-chained-property-access-insert-test", + "expectedResult": { + "changes": { + "chained-property-access.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Added the 'returned.promise().done( newDefer.resolve ).fail( newDefer.reject )' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index e69de29b..5914a55c 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -0,0 +1 @@", + "+return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2ceb4d28a0554634451ed82eacdbb44d64ce6d54..04d4c1c2fc7bdc609a5e62f5392deeb2b8c9ab9a" +} +,{ + "testCaseDescription": "javascript-chained-property-access-replacement-insert-test", + "expectedResult": { + "changes": { + "chained-property-access.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Added the 'returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Added the 'returned.promise().done( newDefer.resolve ).fail( newDefer.reject )' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 5914a55c..70959766 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1 +1,3 @@", + "+return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + "+return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "04d4c1c2fc7bdc609a5e62f5392deeb2b8c9ab9a..6a9f25a73a687fa568e6d8c0729891567ce577d9" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-insert-test", + "expectedResult": { + "changes": { + "chained-property-access.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 43 + ] + }, + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 41 + ] + } + ] + }, + "summary": "Replaced the 'otherDefer' identifier with the 'newDefer' identifier in the returned.promise().done(…) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 60 + ], + "end": [ + 1, + 70 + ] + }, + { + "start": [ + 1, + 58 + ], + "end": [ + 1, + 66 + ] + } + ] + }, + "summary": "Replaced the 'otherDefer' identifier with the 'newDefer' identifier in the returned.promise().done(…).fail(…) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 70959766..98df938b 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,3 +1,3 @@", + "-return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + "+return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6a9f25a73a687fa568e6d8c0729891567ce577d9..f28a31996062be9efdb0201fdb9c31713fb1863c" +} +,{ + "testCaseDescription": "javascript-chained-property-access-replacement-test", + "expectedResult": { + "changes": { + "chained-property-access.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 41 + ] + }, + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 43 + ] + } + ] + }, + "summary": "Replaced the 'newDefer' identifier with the 'otherDefer' identifier in the returned.promise().done(…) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 58 + ], + "end": [ + 1, + 66 + ] + }, + { + "start": [ + 1, + 60 + ], + "end": [ + 1, + 70 + ] + } + ] + }, + "summary": "Replaced the 'newDefer' identifier with the 'otherDefer' identifier in the returned.promise().done(…).fail(…) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 98df938b..70959766 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,3 +1,3 @@", + "-return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + "+return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f28a31996062be9efdb0201fdb9c31713fb1863c..46c033b24c360e511ef758b6b789094a7fdf0a71" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-replacement-test", + "expectedResult": { + "changes": { + "chained-property-access.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Deleted the 'returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )' return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Deleted the 'returned.promise().done( newDefer.resolve ).fail( newDefer.reject )' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Added the 'returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 70959766..7b764ca9 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,3 +1,2 @@", + "-return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + "-return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + "+return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "46c033b24c360e511ef758b6b789094a7fdf0a71..68a9119e612fa94131420134a900676aa832b51c" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-test", + "expectedResult": { + "changes": { + "chained-property-access.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Deleted the 'returned.promise().done( newDefer.resolve ).fail( newDefer.reject )' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 7b764ca9..5d6d3a02 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,2 +1 @@", + "-return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "68a9119e612fa94131420134a900676aa832b51c..4df47be97cc54a916abb21134f5d8b761e34752a" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-rest-test", + "expectedResult": { + "changes": { + "chained-property-access.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Deleted the 'returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 5d6d3a02..e69de29b 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1 +0,0 @@", + "-return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4df47be97cc54a916abb21134f5d8b761e34752a..9d8e6a9365dd210f6592bfbb25de8eb159ea7499" +}] diff --git a/test/corpus/diff-summaries/javascript/class.json b/test/corpus/diff-summaries/javascript/class.json new file mode 100644 index 000000000..072fdc81f --- /dev/null +++ b/test/corpus/diff-summaries/javascript/class.json @@ -0,0 +1,455 @@ +[{ + "testCaseDescription": "javascript-class-insert-test", + "expectedResult": { + "changes": { + "class.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 87 + ] + } + }, + "summary": "Added the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index e69de29b..8f6ae64d 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -0,0 +1 @@", + "+class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5d563ac383acc3c789fbd552c697d625c0f424fc..f27889edbbb5640de4565ccc6d3dda2c6ca4ff7b" +} +,{ + "testCaseDescription": "javascript-class-replacement-insert-test", + "expectedResult": { + "changes": { + "class.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 85 + ] + } + }, + "summary": "Added the 'Foo' class" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 87 + ] + } + }, + "summary": "Added the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index 8f6ae64d..b509437f 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1 +1,3 @@", + "+class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + "+class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f27889edbbb5640de4565ccc6d3dda2c6ca4ff7b..6363c59704fdb865549eb385ba38810a1c53f5f9" +} +,{ + "testCaseDescription": "javascript-class-delete-insert-test", + "expectedResult": { + "changes": { + "class.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 23 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 23 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'one' identifier in the 'one(a)' method of the 'Foo' class" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 42 + ], + "end": [ + 1, + 45 + ] + }, + { + "start": [ + 1, + 42 + ], + "end": [ + 1, + 45 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'two' identifier in the 'two(b)' method of the 'Foo' class" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 63 + ], + "end": [ + 1, + 66 + ] + }, + { + "start": [ + 1, + 63 + ], + "end": [ + 1, + 68 + ] + } + ] + }, + "summary": "Replaced the 'baz' identifier with the 'three' identifier in the 'three(c)' method of the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index b509437f..c4f5c91c 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,3 +1,3 @@", + "-class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + "+class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6363c59704fdb865549eb385ba38810a1c53f5f9..0193a7dc4d1a24b5344dd31b252d5624bc36e843" +} +,{ + "testCaseDescription": "javascript-class-replacement-test", + "expectedResult": { + "changes": { + "class.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 23 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 23 + ] + } + ] + }, + "summary": "Replaced the 'one' identifier with the 'foo' identifier in the 'foo(a)' method of the 'Foo' class" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 42 + ], + "end": [ + 1, + 45 + ] + }, + { + "start": [ + 1, + 42 + ], + "end": [ + 1, + 45 + ] + } + ] + }, + "summary": "Replaced the 'two' identifier with the 'bar' identifier in the 'bar(b)' method of the 'Foo' class" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 63 + ], + "end": [ + 1, + 68 + ] + }, + { + "start": [ + 1, + 63 + ], + "end": [ + 1, + 66 + ] + } + ] + }, + "summary": "Replaced the 'three' identifier with the 'baz' identifier in the 'baz(c)' method of the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index c4f5c91c..b509437f 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,3 +1,3 @@", + "-class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + "+class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0193a7dc4d1a24b5344dd31b252d5624bc36e843..da671e1fcebbc3420fa30b56cb64b32ce271a004" +} +,{ + "testCaseDescription": "javascript-class-delete-replacement-test", + "expectedResult": { + "changes": { + "class.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 85 + ] + } + }, + "summary": "Deleted the 'Foo' class" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 87 + ] + } + }, + "summary": "Deleted the 'Foo' class" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 85 + ] + } + }, + "summary": "Added the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index b509437f..b1ef404f 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,3 +1,2 @@", + "-class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + "-class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + "+class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "da671e1fcebbc3420fa30b56cb64b32ce271a004..08d69ec53c3b1ea4afe6ffab3084d626bf375015" +} +,{ + "testCaseDescription": "javascript-class-delete-test", + "expectedResult": { + "changes": { + "class.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 87 + ] + } + }, + "summary": "Deleted the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index b1ef404f..2c17f72f 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,2 +1 @@", + "-class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "08d69ec53c3b1ea4afe6ffab3084d626bf375015..b5988452546dcdfce01968a70b4fc10fa86804a9" +} +,{ + "testCaseDescription": "javascript-class-delete-rest-test", + "expectedResult": { + "changes": { + "class.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 85 + ] + } + }, + "summary": "Deleted the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index 2c17f72f..e69de29b 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1 +0,0 @@", + "-class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b5988452546dcdfce01968a70b4fc10fa86804a9..2bd27e99860858d0a524b5a307b97f412b4cc0c8" +}] diff --git a/test/corpus/diff-summaries/javascript/comma-operator.json b/test/corpus/diff-summaries/javascript/comma-operator.json new file mode 100644 index 000000000..503b4fc8b --- /dev/null +++ b/test/corpus/diff-summaries/javascript/comma-operator.json @@ -0,0 +1,443 @@ +[{ + "testCaseDescription": "javascript-comma-operator-insert-test", + "expectedResult": { + "changes": { + "comma-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'a' assignment" + }, + { + "span": { + "insert": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'b' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index e69de29b..cff019f3 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -0,0 +1 @@", + "+a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e49b80d7752e9f991ddcb2ff2a8c5f714d9bafa3..14a76b842f749ae817b858b9261f74556d312f2a" +} +,{ + "testCaseDescription": "javascript-comma-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "comma-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Added the 'c' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'a' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the 'b' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index cff019f3..93ece10f 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1 +1,3 @@", + "+c = {d: (3, 4 + 5, 6)};", + "+a = 1, b = 2;", + " a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "14a76b842f749ae817b858b9261f74556d312f2a..faf4dcc0d18c6e0183bd5b18ef394ea11149e88a" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-insert-test", + "expectedResult": { + "changes": { + "comma-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'a' assignment" + }, + { + "span": { + "insert": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'b' assignment" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'c' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 93ece10f..f738c2db 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,3 +1,3 @@", + "-c = {d: (3, 4 + 5, 6)};", + "+a = 1, b = 2;", + " a = 1, b = 2;", + " a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "faf4dcc0d18c6e0183bd5b18ef394ea11149e88a..10dc61819ea841e72a63c8eb5b90fbc5deb87cd7" +} +,{ + "testCaseDescription": "javascript-comma-operator-replacement-test", + "expectedResult": { + "changes": { + "comma-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Added the 'c' assignment" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'a' assignment" + }, + { + "span": { + "delete": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'b' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index f738c2db..93ece10f 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,3 +1,3 @@", + "-a = 1, b = 2;", + "+c = {d: (3, 4 + 5, 6)};", + " a = 1, b = 2;", + " a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "10dc61819ea841e72a63c8eb5b90fbc5deb87cd7..abb50392e9b4195a408d8d4a8518009dd057a483" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "comma-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'c' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'a' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Deleted the 'b' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 23 + ] + } + }, + "summary": "Added the 'c' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 93ece10f..297e28dd 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,3 +1,2 @@", + "-c = {d: (3, 4 + 5, 6)};", + "-a = 1, b = 2;", + " a = 1, b = 2;", + "+c = {d: (3, 4 + 5, 6)};" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "abb50392e9b4195a408d8d4a8518009dd057a483..878315053fc181a6a17a51d3a39f25b5bbcbfd27" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-test", + "expectedResult": { + "changes": { + "comma-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'a' assignment" + }, + { + "span": { + "delete": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'b' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 297e28dd..421bc7fe 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,2 +1 @@", + "-a = 1, b = 2;", + " c = {d: (3, 4 + 5, 6)};" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "878315053fc181a6a17a51d3a39f25b5bbcbfd27..2abca864526a4b0babc92f4b962b97fd0fa369c3" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-rest-test", + "expectedResult": { + "changes": { + "comma-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'c' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 421bc7fe..e69de29b 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1 +0,0 @@", + "-c = {d: (3, 4 + 5, 6)};" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2abca864526a4b0babc92f4b962b97fd0fa369c3..1a9d89c148259dce0124722fcfdce38260c2f1b3" +}] diff --git a/test/corpus/diff-summaries/javascript/comment.json b/test/corpus/diff-summaries/javascript/comment.json new file mode 100644 index 000000000..8ceb0b5ab --- /dev/null +++ b/test/corpus/diff-summaries/javascript/comment.json @@ -0,0 +1,164 @@ +[{ + "testCaseDescription": "javascript-comment-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index e69de29b..a5821d24 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -0,0 +1 @@", + "+// This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b2dce4d2365759cf652927b76a86ca88c71cb3ad..db207c620623dc7eb9b820031a15b5aca30b26db" +} +,{ + "testCaseDescription": "javascript-comment-replacement-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index a5821d24..761aa7a3 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1 +1,5 @@", + "+/*", + "+ * This is a method", + "+*/", + "+// This is a property", + " // This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "db207c620623dc7eb9b820031a15b5aca30b26db..6e90b1a14ba52fdf6a15f7b1556594131a573822" +} +,{ + "testCaseDescription": "javascript-comment-delete-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 761aa7a3..3b33406a 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,5 +1,3 @@", + "-/*", + "- * This is a method", + "-*/", + "+// This is a property", + " // This is a property", + " // This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6e90b1a14ba52fdf6a15f7b1556594131a573822..87cf91ddfbb489cc26f9c1a15b99490a5a6dd565" +} +,{ + "testCaseDescription": "javascript-comment-replacement-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 3b33406a..761aa7a3 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,3 +1,5 @@", + "-// This is a property", + "+/*", + "+ * This is a method", + "+*/", + " // This is a property", + " // This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "87cf91ddfbb489cc26f9c1a15b99490a5a6dd565..7906057920b1f71cf60e233b751b2e7232f8bdec" +} +,{ + "testCaseDescription": "javascript-comment-delete-replacement-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 761aa7a3..c2a8148a 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,5 +1,4 @@", + "+// This is a property", + " /*", + " * This is a method", + " */", + "-// This is a property", + "-// This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7906057920b1f71cf60e233b751b2e7232f8bdec..1a7c0420f710a5888df797396c0b7202c854dcef" +} +,{ + "testCaseDescription": "javascript-comment-delete-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index c2a8148a..7c74dcdf 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,4 +1,3 @@", + "-// This is a property", + " /*", + " * This is a method", + " */" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1a7c0420f710a5888df797396c0b7202c854dcef..b82c4beb2b850e567c2e653a9d367a4cb2770d50" +} +,{ + "testCaseDescription": "javascript-comment-delete-rest-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 7c74dcdf..e69de29b 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,3 +0,0 @@", + "-/*", + "- * This is a method", + "-*/" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b82c4beb2b850e567c2e653a9d367a4cb2770d50..98e620d7e739bab2841281450b4d879405585f38" +}] diff --git a/test/corpus/diff-summaries/javascript/constructor-call.json b/test/corpus/diff-summaries/javascript/constructor-call.json new file mode 100644 index 000000000..6fc09c53d --- /dev/null +++ b/test/corpus/diff-summaries/javascript/constructor-call.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-constructor-call-insert-test", + "expectedResult": { + "changes": { + "constructor-call.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 27 + ] + } + }, + "summary": "Added the 'module.Klass(1, \"two\")' constructor" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index e69de29b..9d723b91 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -0,0 +1 @@", + "+new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "347b15603c28f7232a36d6d312d1c335a4dd39db..f591b107b5e12a6dff7705301800f6f1cf5370dc" +} +,{ + "testCaseDescription": "javascript-constructor-call-replacement-insert-test", + "expectedResult": { + "changes": { + "constructor-call.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Added the 'module.Klass(1, \"three\")' constructor" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 27 + ] + } + }, + "summary": "Added the 'module.Klass(1, \"two\")' constructor" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 9d723b91..2c91b115 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1 +1,3 @@", + "+new module.Klass(1, \"three\");", + "+new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f591b107b5e12a6dff7705301800f6f1cf5370dc..dde57ec95cd201fe36288d8f48c50dc36679d1ec" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-insert-test", + "expectedResult": { + "changes": { + "constructor-call.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 28 + ] + }, + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 26 + ] + } + ] + }, + "summary": "Replaced the \"three\" string with the \"two\" string in the module.Klass(1, \"two\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 2c91b115..892f5425 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,3 +1,3 @@", + "-new module.Klass(1, \"three\");", + "+new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dde57ec95cd201fe36288d8f48c50dc36679d1ec..6174629e516abf02b6f7180ff3a0f46ad37e4a44" +} +,{ + "testCaseDescription": "javascript-constructor-call-replacement-test", + "expectedResult": { + "changes": { + "constructor-call.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 26 + ] + }, + { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 28 + ] + } + ] + }, + "summary": "Replaced the \"two\" string with the \"three\" string in the module.Klass(1, \"three\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 892f5425..2c91b115 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,3 +1,3 @@", + "-new module.Klass(1, \"two\");", + "+new module.Klass(1, \"three\");", + " new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6174629e516abf02b6f7180ff3a0f46ad37e4a44..65827ded87dfff62bf2f54cd3d1b6b9adde23ac9" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-replacement-test", + "expectedResult": { + "changes": { + "constructor-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Deleted the 'module.Klass(1, \"three\")' constructor" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 27 + ] + } + }, + "summary": "Deleted the 'module.Klass(1, \"two\")' constructor" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 29 + ] + } + }, + "summary": "Added the 'module.Klass(1, \"three\")' constructor" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 2c91b115..cd77b985 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,3 +1,2 @@", + "-new module.Klass(1, \"three\");", + "-new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");", + "+new module.Klass(1, \"three\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "65827ded87dfff62bf2f54cd3d1b6b9adde23ac9..0d0df9150e59fa45b52ab52b60217b60f708273e" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-test", + "expectedResult": { + "changes": { + "constructor-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 27 + ] + } + }, + "summary": "Deleted the 'module.Klass(1, \"two\")' constructor" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index cd77b985..75f6a29e 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,2 +1 @@", + "-new module.Klass(1, \"two\");", + " new module.Klass(1, \"three\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0d0df9150e59fa45b52ab52b60217b60f708273e..6432a11e84757a4ad67f5b6f2901f11c44fc3f54" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-rest-test", + "expectedResult": { + "changes": { + "constructor-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Deleted the 'module.Klass(1, \"three\")' constructor" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 75f6a29e..e69de29b 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1 +0,0 @@", + "-new module.Klass(1, \"three\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6432a11e84757a4ad67f5b6f2901f11c44fc3f54..0418e8cf18ec4ace51cecc0070ed205313e92ac2" +}] diff --git a/test/corpus/diff-summaries/javascript/continue.json b/test/corpus/diff-summaries/javascript/continue.json new file mode 100644 index 000000000..190ec0084 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/continue.json @@ -0,0 +1,292 @@ +[{ + "testCaseDescription": "javascript-continue-setup-test", + "expectedResult": { + "changes": { + "continue.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 50 + ] + } + }, + "summary": "Added the 'i = 0; i < 10; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "continue.js" + ], + "patch": [ + "diff --git a/continue.js b/continue.js", + "index e69de29b..3f583e3d 100644", + "--- a/continue.js", + "+++ b/continue.js", + "@@ -0,0 +1 @@", + "+for (i = 0; i < 10; i++) { if (i === 4) { }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a6c03f4fe5985c8424ed595bd7d50ecc6098dc8a..11c2248a6d114e5db88e13af8def8eaa09a09d45" +} +,{ + "testCaseDescription": "javascript-continue-insert-test", + "expectedResult": { + "changes": { + "continue.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Added a continue statement in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Deleted the '{ }' object in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "continue.js" + ], + "patch": [ + "diff --git a/continue.js b/continue.js", + "index 3f583e3d..16ebcc57 100644", + "--- a/continue.js", + "+++ b/continue.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "11c2248a6d114e5db88e13af8def8eaa09a09d45..7ed1007a324c95df70eefc8431845e8b8d52fc8a" +} +,{ + "testCaseDescription": "javascript-continue-replacement-test", + "expectedResult": { + "changes": { + "continue.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 49 + ] + } + }, + "summary": "Added a break statement in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Deleted a continue statement in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "continue.js" + ], + "patch": [ + "diff --git a/continue.js b/continue.js", + "index 16ebcc57..629dfa91 100644", + "--- a/continue.js", + "+++ b/continue.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7ed1007a324c95df70eefc8431845e8b8d52fc8a..1e73b9b08c68b5f920a4c7e0e7afe2a12241ad63" +} +,{ + "testCaseDescription": "javascript-continue-delete-replacement-test", + "expectedResult": { + "changes": { + "continue.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Added a continue statement in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 49 + ] + } + }, + "summary": "Deleted a break statement in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "continue.js" + ], + "patch": [ + "diff --git a/continue.js b/continue.js", + "index 629dfa91..16ebcc57 100644", + "--- a/continue.js", + "+++ b/continue.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1e73b9b08c68b5f920a4c7e0e7afe2a12241ad63..ff56824c50998e8ccac9e604cd564e4384b817bc" +} +,{ + "testCaseDescription": "javascript-continue-delete-insert-test", + "expectedResult": { + "changes": { + "continue.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Added the '{ }' object in the 'i === 4' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Deleted a continue statement in the 'i === 4' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "continue.js" + ], + "patch": [ + "diff --git a/continue.js b/continue.js", + "index 16ebcc57..3f583e3d 100644", + "--- a/continue.js", + "+++ b/continue.js", + "@@ -1 +1 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }", + "+for (i = 0; i < 10; i++) { if (i === 4) { }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ff56824c50998e8ccac9e604cd564e4384b817bc..5935d4c1093d472de0d76b9430758ae222d7f39f" +} +,{ + "testCaseDescription": "javascript-continue-teardown-test", + "expectedResult": { + "changes": { + "continue.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 50 + ] + } + }, + "summary": "Deleted the 'i = 0; i < 10; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "continue.js" + ], + "patch": [ + "diff --git a/continue.js b/continue.js", + "index 3f583e3d..e69de29b 100644", + "--- a/continue.js", + "+++ b/continue.js", + "@@ -1 +0,0 @@", + "-for (i = 0; i < 10; i++) { if (i === 4) { }; i }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5935d4c1093d472de0d76b9430758ae222d7f39f..f270d7e7af308e5cacc3d7334905fd5f2308dc19" +}] diff --git a/test/corpus/diff-summaries/javascript/delete-operator.json b/test/corpus/diff-summaries/javascript/delete-operator.json new file mode 100644 index 000000000..e1561779f --- /dev/null +++ b/test/corpus/diff-summaries/javascript/delete-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-delete-operator-insert-test", + "expectedResult": { + "changes": { + "delete-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the 'delete thing['prop']' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index e69de29b..c83346db 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -0,0 +1 @@", + "+delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b3e70bdf3077d7e2f3dee952ec37081e57641fbf..3ac61d3244121c909b60b90f70722dc6e44ed140" +} +,{ + "testCaseDescription": "javascript-delete-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "delete-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'delete thing.prop' operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Added the 'delete thing['prop']' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index c83346db..7c8b9908 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1 +1,3 @@", + "+delete thing.prop", + "+delete thing['prop'];", + " delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3ac61d3244121c909b60b90f70722dc6e44ed140..42fbb679ec755bf5bd07495de1e9138e01d8f767" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-insert-test", + "expectedResult": { + "changes": { + "delete-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'delete thing.prop' operator with the 'delete thing['prop']' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 7c8b9908..f506e360 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,3 +1,3 @@", + "-delete thing.prop", + "+delete thing['prop'];", + " delete thing['prop'];", + " delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "42fbb679ec755bf5bd07495de1e9138e01d8f767..2a9fed1fcaf42fc6fbc8e41621263d780fa28415" +} +,{ + "testCaseDescription": "javascript-delete-operator-replacement-test", + "expectedResult": { + "changes": { + "delete-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + ] + }, + "summary": "Replaced the 'delete thing['prop']' operator with the 'delete thing.prop' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index f506e360..7c8b9908 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,3 +1,3 @@", + "-delete thing['prop'];", + "+delete thing.prop", + " delete thing['prop'];", + " delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2a9fed1fcaf42fc6fbc8e41621263d780fa28415..5ae979fee6cf8bb9f63ffaf750398f67d9db2b2c" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "delete-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'delete thing.prop' operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Deleted the 'delete thing['prop']' operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 18 + ] + } + }, + "summary": "Added the 'delete thing.prop' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 7c8b9908..2dfe0799 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,3 +1,2 @@", + "-delete thing.prop", + "-delete thing['prop'];", + " delete thing['prop'];", + "+delete thing.prop" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5ae979fee6cf8bb9f63ffaf750398f67d9db2b2c..b563e9bd5c771bd02bd66d3db152e29883767d9c" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-test", + "expectedResult": { + "changes": { + "delete-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'delete thing['prop']' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 2dfe0799..9d68dfb8 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,2 +1 @@", + "-delete thing['prop'];", + " delete thing.prop" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b563e9bd5c771bd02bd66d3db152e29883767d9c..ea2c8ed9e6afaa82f892e6f33652e8bcaf55bf5d" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-rest-test", + "expectedResult": { + "changes": { + "delete-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'delete thing.prop' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 9d68dfb8..e69de29b 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1 +0,0 @@", + "-delete thing.prop" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ea2c8ed9e6afaa82f892e6f33652e8bcaf55bf5d..788020560a8fdb300dff202c696815f281416456" +}] diff --git a/test/corpus/diff-summaries/javascript/do-while-statement.json b/test/corpus/diff-summaries/javascript/do-while-statement.json new file mode 100644 index 000000000..6ab7049f6 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/do-while-statement.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-do-while-statement-insert-test", + "expectedResult": { + "changes": { + "do-while-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Added the 'true' do/while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index e69de29b..d1ec804b 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -0,0 +1 @@", + "+do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "48d3ef87f99a7129141975782e612cef84f46829..47fdb7dae90deae8f5a1ddaade3a4da8aed3bddb" +} +,{ + "testCaseDescription": "javascript-do-while-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "do-while-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Added the 'false' do/while statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 42 + ] + } + }, + "summary": "Added the 'true' do/while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index d1ec804b..d9a410d6 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1 +1,3 @@", + "+do { console.log(replacement); } while (false);", + "+do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "47fdb7dae90deae8f5a1ddaade3a4da8aed3bddb..8dfe4bfffb91e763a57bb7437a643317f95005cc" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-insert-test", + "expectedResult": { + "changes": { + "do-while-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 18 + ], + "end": [ + 1, + 29 + ] + }, + { + "start": [ + 1, + 18 + ], + "end": [ + 1, + 24 + ] + } + ] + }, + "summary": "Replaced the 'replacement' identifier with the 'insert' identifier in the console.log(insert) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 46 + ] + }, + { + "start": [ + 1, + 36 + ], + "end": [ + 1, + 40 + ] + } + ] + }, + "summary": "Replaced 'false' with 'true' in the true do/while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index d9a410d6..41978359 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,3 +1,3 @@", + "-do { console.log(replacement); } while (false);", + "+do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8dfe4bfffb91e763a57bb7437a643317f95005cc..f74da794cf0726b10bba95453d13d695c8a3c790" +} +,{ + "testCaseDescription": "javascript-do-while-statement-replacement-test", + "expectedResult": { + "changes": { + "do-while-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 18 + ], + "end": [ + 1, + 24 + ] + }, + { + "start": [ + 1, + 18 + ], + "end": [ + 1, + 29 + ] + } + ] + }, + "summary": "Replaced the 'insert' identifier with the 'replacement' identifier in the console.log(replacement) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 36 + ], + "end": [ + 1, + 40 + ] + }, + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 46 + ] + } + ] + }, + "summary": "Replaced 'true' with 'false' in the false do/while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index 41978359..d9a410d6 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,3 +1,3 @@", + "-do { console.log(insert); } while (true);", + "+do { console.log(replacement); } while (false);", + " do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f74da794cf0726b10bba95453d13d695c8a3c790..61870a9079d930bcda72b7244ce914736f439ce5" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "do-while-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Deleted the 'false' do/while statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 42 + ] + } + }, + "summary": "Deleted the 'true' do/while statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 48 + ] + } + }, + "summary": "Added the 'false' do/while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index d9a410d6..c5291b47 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,3 +1,2 @@", + "-do { console.log(replacement); } while (false);", + "-do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);", + "+do { console.log(replacement); } while (false);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "61870a9079d930bcda72b7244ce914736f439ce5..d9996cc8fc0b486253a2f78ceb1b772fd716e850" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-test", + "expectedResult": { + "changes": { + "do-while-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Deleted the 'true' do/while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index c5291b47..6085cb11 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,2 +1 @@", + "-do { console.log(insert); } while (true);", + " do { console.log(replacement); } while (false);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d9996cc8fc0b486253a2f78ceb1b772fd716e850..3f3112ede154d004a4fef1e6b2d710503dade46a" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-rest-test", + "expectedResult": { + "changes": { + "do-while-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Deleted the 'false' do/while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index 6085cb11..e69de29b 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1 +0,0 @@", + "-do { console.log(replacement); } while (false);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3f3112ede154d004a4fef1e6b2d710503dade46a..ee66417eb88b151832b600af9c2b381b2e52880e" +}] diff --git a/test/corpus/diff-summaries/javascript/export.json b/test/corpus/diff-summaries/javascript/export.json new file mode 100644 index 000000000..3db499ba2 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/export.json @@ -0,0 +1,2633 @@ +[{ + "testCaseDescription": "javascript-export-insert-test", + "expectedResult": { + "changes": { + "export.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Added the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 58 + ] + } + }, + "summary": "Added the { variable1 as name1, variable2 as name2, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Added the { name1, name2, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Added the { name1 = value1, name2 = value2, name3, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 30 + ] + } + }, + "summary": "Added the { namedFunction } export statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 32 + ] + } + }, + "summary": "Added the { anonymous() } export statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 37 + ] + } + }, + "summary": "Added the { name1 } export statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 29 + ] + } + }, + "summary": "Added the { name1 as default } export statement" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Added the { 'foo' } export statement" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 43 + ] + } + }, + "summary": "Added the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 65 + ] + } + }, + "summary": "Added the { import1 as name1, import2 as name2, nameN } from 'bar' export statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index e69de29b..dcd9320b 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -0,0 +1,11 @@", + "+export { name1, name2, name3, nameN };", + "+export { variable1 as name1, variable2 as name2, nameN };", + "+export let name1, name2, nameN;", + "+export let name1 = value1, name2 = value2, name3, nameN;", + "+export default namedFunction;", + "+export default function () { };", + "+export default function name1() { };", + "+export { name1 as default };", + "+export * from 'foo';", + "+export { name1, name2, nameN } from 'foo';", + "+export { import1 as name1, import2 as name2, nameN } from 'bar';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "be1bd2dff0107fc60e25707f2c27edec41f646ff..94fbe62beb0b9d5bd87916b16626ade5757be77c" +} +,{ + "testCaseDescription": "javascript-export-replacement-insert-test", + "expectedResult": { + "changes": { + "export.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Added the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 58 + ] + } + }, + "summary": "Added the { variable2 as name2, variable3 as name3, nameY } export statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Added the { name3, name4, nameT } export statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Added the { name2 = value2, name3 = value3, name4, nameO } export statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 35 + ] + } + }, + "summary": "Added the { otherNamedFunction } export statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 39 + ] + } + }, + "summary": "Added the { newName1 } export statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 31 + ] + } + }, + "summary": "Added the { anonymous() } export statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 31 + ] + } + }, + "summary": "Added the { name2 as statement } export statement" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Added the { 'baz' } export statement" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 44 + ] + } + }, + "summary": "Added the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 66 + ] + } + }, + "summary": "Added the { import6 as name6, import7 as name7, nameB } from 'fizz' export statement" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 39 + ] + } + }, + "summary": "Added the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 58 + ] + } + }, + "summary": "Added the { variable1 as name1, variable2 as name2, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 32 + ] + } + }, + "summary": "Added the { name1, name2, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 57 + ] + } + }, + "summary": "Added the { name1 = value1, name2 = value2, name3, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 16, + 1 + ], + "end": [ + 16, + 30 + ] + } + }, + "summary": "Added the { namedFunction } export statement" + }, + { + "span": { + "insert": { + "start": [ + 17, + 1 + ], + "end": [ + 17, + 32 + ] + } + }, + "summary": "Added the { anonymous() } export statement" + }, + { + "span": { + "insert": { + "start": [ + 18, + 1 + ], + "end": [ + 18, + 37 + ] + } + }, + "summary": "Added the { name1 } export statement" + }, + { + "span": { + "insert": { + "start": [ + 19, + 1 + ], + "end": [ + 19, + 29 + ] + } + }, + "summary": "Added the { name1 as default } export statement" + }, + { + "span": { + "insert": { + "start": [ + 20, + 1 + ], + "end": [ + 20, + 21 + ] + } + }, + "summary": "Added the { 'foo' } export statement" + }, + { + "span": { + "insert": { + "start": [ + 21, + 1 + ], + "end": [ + 21, + 43 + ] + } + }, + "summary": "Added the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "insert": { + "start": [ + 22, + 1 + ], + "end": [ + 22, + 65 + ] + } + }, + "summary": "Added the { import1 as name1, import2 as name2, nameN } from 'bar' export statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index dcd9320b..c8b53ff3 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,3 +1,25 @@", + "+export { name4, name5, name6, nameZ };", + "+export { variable2 as name2, variable3 as name3, nameY };", + "+export let name3, name4, nameT;", + "+export let name2 = value2, name3 = value3, name4, nameO;", + "+export default otherNamedFunction;", + "+export default function newName1() {};", + "+export default function () {};", + "+export { name2 as statement };", + "+export * from 'baz';", + "+export { name7, name8, nameP } from 'buzz';", + "+export { import6 as name6, import7 as name7, nameB } from 'fizz';", + "+export { name1, name2, name3, nameN };", + "+export { variable1 as name1, variable2 as name2, nameN };", + "+export let name1, name2, nameN;", + "+export let name1 = value1, name2 = value2, name3, nameN;", + "+export default namedFunction;", + "+export default function () { };", + "+export default function name1() { };", + "+export { name1 as default };", + "+export * from 'foo';", + "+export { name1, name2, nameN } from 'foo';", + "+export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "94fbe62beb0b9d5bd87916b16626ade5757be77c..33315fb792d3dd55c8dad8aec745f479637b74d8" +} +,{ + "testCaseDescription": "javascript-export-delete-insert-test", + "expectedResult": { + "changes": { + "export.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced the 'name4' identifier with the 'name1' identifier in the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 22 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 22 + ] + } + ] + }, + "summary": "Replaced the 'name5' identifier with the 'name2' identifier in the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + }, + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + } + ] + }, + "summary": "Replaced the 'name6' identifier with the 'name3' identifier in the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 31 + ], + "end": [ + 1, + 36 + ] + }, + { + "start": [ + 1, + 31 + ], + "end": [ + 1, + 36 + ] + } + ] + }, + "summary": "Replaced the 'nameZ' identifier with the 'nameN' identifier in the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 58 + ] + } + }, + "summary": "Added the { variable1 as name1, variable2 as name2, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Added the { name1, name2, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Added the { name1 = value1, name2 = value2, name3, nameN } export statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 30 + ] + } + }, + "summary": "Added the { namedFunction } export statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 32 + ] + } + }, + "summary": "Added the { anonymous() } export statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 37 + ] + } + }, + "summary": "Added the { name1 } export statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 29 + ] + } + }, + "summary": "Added the { name1 as default } export statement" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Added the { 'foo' } export statement" + }, + { + "span": { + "insert": { + "start": [ + 10, + 37 + ], + "end": [ + 10, + 42 + ] + } + }, + "summary": "Added the 'foo' string in the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 10 + ], + "end": [ + 2, + 19 + ] + }, + { + "start": [ + 10, + 10 + ], + "end": [ + 10, + 15 + ] + } + ] + }, + "summary": "Replaced the 'variable2' identifier with the 'name1' identifier in the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 23 + ], + "end": [ + 2, + 28 + ] + } + }, + "summary": "Deleted the 'name2' identifier in the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 30 + ], + "end": [ + 2, + 39 + ] + }, + { + "start": [ + 10, + 17 + ], + "end": [ + 10, + 22 + ] + } + ] + }, + "summary": "Replaced the 'variable3' identifier with the 'name2' identifier in the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 43 + ], + "end": [ + 2, + 48 + ] + } + }, + "summary": "Deleted the 'name3' identifier in the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 50 + ], + "end": [ + 2, + 55 + ] + }, + { + "start": [ + 10, + 24 + ], + "end": [ + 10, + 29 + ] + } + ] + }, + "summary": "Replaced the 'nameY' identifier with the 'nameN' identifier in the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 65 + ] + } + }, + "summary": "Added the { import1 as name1, import2 as name2, nameN } from 'bar' export statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Deleted the { name3, name4, nameT } export statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Deleted the { name2 = value2, name3 = value3, name4, nameO } export statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 35 + ] + } + }, + "summary": "Deleted the { otherNamedFunction } export statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 39 + ] + } + }, + "summary": "Deleted the { newName1 } export statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 31 + ] + } + }, + "summary": "Deleted the { anonymous() } export statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 31 + ] + } + }, + "summary": "Deleted the { name2 as statement } export statement" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Deleted the { 'baz' } export statement" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 44 + ] + } + }, + "summary": "Deleted the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 66 + ] + } + }, + "summary": "Deleted the { import6 as name6, import7 as name7, nameB } from 'fizz' export statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index c8b53ff3..ad3f21a7 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,14 +1,14 @@", + "-export { name4, name5, name6, nameZ };", + "-export { variable2 as name2, variable3 as name3, nameY };", + "-export let name3, name4, nameT;", + "-export let name2 = value2, name3 = value3, name4, nameO;", + "-export default otherNamedFunction;", + "-export default function newName1() {};", + "-export default function () {};", + "-export { name2 as statement };", + "-export * from 'baz';", + "-export { name7, name8, nameP } from 'buzz';", + "-export { import6 as name6, import7 as name7, nameB } from 'fizz';", + "+export { name1, name2, name3, nameN };", + "+export { variable1 as name1, variable2 as name2, nameN };", + "+export let name1, name2, nameN;", + "+export let name1 = value1, name2 = value2, name3, nameN;", + "+export default namedFunction;", + "+export default function () { };", + "+export default function name1() { };", + "+export { name1 as default };", + "+export * from 'foo';", + "+export { name1, name2, nameN } from 'foo';", + "+export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "33315fb792d3dd55c8dad8aec745f479637b74d8..bcd26f8508f792d9e92d3e85da588b043958be7f" +} +,{ + "testCaseDescription": "javascript-export-replacement-test", + "expectedResult": { + "changes": { + "export.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced the 'name1' identifier with the 'name4' identifier in the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 22 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 22 + ] + } + ] + }, + "summary": "Replaced the 'name2' identifier with the 'name5' identifier in the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + }, + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 29 + ] + } + ] + }, + "summary": "Replaced the 'name3' identifier with the 'name6' identifier in the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 31 + ], + "end": [ + 1, + 36 + ] + }, + { + "start": [ + 1, + 31 + ], + "end": [ + 1, + 36 + ] + } + ] + }, + "summary": "Replaced the 'nameN' identifier with the 'nameZ' identifier in the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 58 + ] + } + }, + "summary": "Added the { variable2 as name2, variable3 as name3, nameY } export statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Added the { name3, name4, nameT } export statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Added the { name2 = value2, name3 = value3, name4, nameO } export statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 35 + ] + } + }, + "summary": "Added the { otherNamedFunction } export statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 39 + ] + } + }, + "summary": "Added the { newName1 } export statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 31 + ] + } + }, + "summary": "Added the { anonymous() } export statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 31 + ] + } + }, + "summary": "Added the { name2 as statement } export statement" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Added the { 'baz' } export statement" + }, + { + "span": { + "insert": { + "start": [ + 10, + 37 + ], + "end": [ + 10, + 43 + ] + } + }, + "summary": "Added the 'buzz' string in the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 10 + ], + "end": [ + 2, + 19 + ] + }, + { + "start": [ + 10, + 10 + ], + "end": [ + 10, + 15 + ] + } + ] + }, + "summary": "Replaced the 'variable1' identifier with the 'name7' identifier in the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 23 + ], + "end": [ + 2, + 28 + ] + } + }, + "summary": "Deleted the 'name1' identifier in the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 30 + ], + "end": [ + 2, + 39 + ] + }, + { + "start": [ + 10, + 17 + ], + "end": [ + 10, + 22 + ] + } + ] + }, + "summary": "Replaced the 'variable2' identifier with the 'name8' identifier in the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 43 + ], + "end": [ + 2, + 48 + ] + } + }, + "summary": "Deleted the 'name2' identifier in the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 50 + ], + "end": [ + 2, + 55 + ] + }, + { + "start": [ + 10, + 24 + ], + "end": [ + 10, + 29 + ] + } + ] + }, + "summary": "Replaced the 'nameN' identifier with the 'nameP' identifier in the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 66 + ] + } + }, + "summary": "Added the { import6 as name6, import7 as name7, nameB } from 'fizz' export statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Deleted the { name1, name2, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Deleted the { name1 = value1, name2 = value2, name3, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 30 + ] + } + }, + "summary": "Deleted the { namedFunction } export statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 32 + ] + } + }, + "summary": "Deleted the { anonymous() } export statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 37 + ] + } + }, + "summary": "Deleted the { name1 } export statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 29 + ] + } + }, + "summary": "Deleted the { name1 as default } export statement" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Deleted the { 'foo' } export statement" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 43 + ] + } + }, + "summary": "Deleted the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 65 + ] + } + }, + "summary": "Deleted the { import1 as name1, import2 as name2, nameN } from 'bar' export statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index ad3f21a7..c8b53ff3 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,14 +1,14 @@", + "-export { name1, name2, name3, nameN };", + "-export { variable1 as name1, variable2 as name2, nameN };", + "-export let name1, name2, nameN;", + "-export let name1 = value1, name2 = value2, name3, nameN;", + "-export default namedFunction;", + "-export default function () { };", + "-export default function name1() { };", + "-export { name1 as default };", + "-export * from 'foo';", + "-export { name1, name2, nameN } from 'foo';", + "-export { import1 as name1, import2 as name2, nameN } from 'bar';", + "+export { name4, name5, name6, nameZ };", + "+export { variable2 as name2, variable3 as name3, nameY };", + "+export let name3, name4, nameT;", + "+export let name2 = value2, name3 = value3, name4, nameO;", + "+export default otherNamedFunction;", + "+export default function newName1() {};", + "+export default function () {};", + "+export { name2 as statement };", + "+export * from 'baz';", + "+export { name7, name8, nameP } from 'buzz';", + "+export { import6 as name6, import7 as name7, nameB } from 'fizz';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "bcd26f8508f792d9e92d3e85da588b043958be7f..2b9bf50a05887a7a162d095a2abfeca055308bc8" +} +,{ + "testCaseDescription": "javascript-export-delete-replacement-test", + "expectedResult": { + "changes": { + "export.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 58 + ] + } + }, + "summary": "Deleted the { variable2 as name2, variable3 as name3, nameY } export statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Deleted the { name3, name4, nameT } export statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Deleted the { name2 = value2, name3 = value3, name4, nameO } export statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 35 + ] + } + }, + "summary": "Deleted the { otherNamedFunction } export statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 39 + ] + } + }, + "summary": "Deleted the { newName1 } export statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 31 + ] + } + }, + "summary": "Deleted the { anonymous() } export statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 31 + ] + } + }, + "summary": "Deleted the { name2 as statement } export statement" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Deleted the { 'baz' } export statement" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 44 + ] + } + }, + "summary": "Deleted the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 66 + ] + } + }, + "summary": "Deleted the { import6 as name6, import7 as name7, nameB } from 'fizz' export statement" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 39 + ] + } + }, + "summary": "Deleted the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 58 + ] + } + }, + "summary": "Deleted the { variable1 as name1, variable2 as name2, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 32 + ] + } + }, + "summary": "Deleted the { name1, name2, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 57 + ] + } + }, + "summary": "Deleted the { name1 = value1, name2 = value2, name3, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 16, + 1 + ], + "end": [ + 16, + 30 + ] + } + }, + "summary": "Deleted the { namedFunction } export statement" + }, + { + "span": { + "delete": { + "start": [ + 17, + 1 + ], + "end": [ + 17, + 32 + ] + } + }, + "summary": "Deleted the { anonymous() } export statement" + }, + { + "span": { + "delete": { + "start": [ + 18, + 1 + ], + "end": [ + 18, + 37 + ] + } + }, + "summary": "Deleted the { name1 } export statement" + }, + { + "span": { + "delete": { + "start": [ + 19, + 1 + ], + "end": [ + 19, + 29 + ] + } + }, + "summary": "Deleted the { name1 as default } export statement" + }, + { + "span": { + "delete": { + "start": [ + 20, + 1 + ], + "end": [ + 20, + 21 + ] + } + }, + "summary": "Deleted the { 'foo' } export statement" + }, + { + "span": { + "delete": { + "start": [ + 21, + 1 + ], + "end": [ + 21, + 43 + ] + } + }, + "summary": "Deleted the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "delete": { + "start": [ + 22, + 1 + ], + "end": [ + 22, + 65 + ] + } + }, + "summary": "Deleted the { import1 as name1, import2 as name2, nameN } from 'bar' export statement" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 39 + ] + } + }, + "summary": "Added the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "insert": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 58 + ] + } + }, + "summary": "Added the { variable2 as name2, variable3 as name3, nameY } export statement" + }, + { + "span": { + "insert": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 32 + ] + } + }, + "summary": "Added the { name3, name4, nameT } export statement" + }, + { + "span": { + "insert": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 57 + ] + } + }, + "summary": "Added the { name2 = value2, name3 = value3, name4, nameO } export statement" + }, + { + "span": { + "insert": { + "start": [ + 16, + 1 + ], + "end": [ + 16, + 35 + ] + } + }, + "summary": "Added the { otherNamedFunction } export statement" + }, + { + "span": { + "insert": { + "start": [ + 17, + 1 + ], + "end": [ + 17, + 39 + ] + } + }, + "summary": "Added the { newName1 } export statement" + }, + { + "span": { + "insert": { + "start": [ + 18, + 1 + ], + "end": [ + 18, + 31 + ] + } + }, + "summary": "Added the { anonymous() } export statement" + }, + { + "span": { + "insert": { + "start": [ + 19, + 1 + ], + "end": [ + 19, + 31 + ] + } + }, + "summary": "Added the { name2 as statement } export statement" + }, + { + "span": { + "insert": { + "start": [ + 20, + 1 + ], + "end": [ + 20, + 21 + ] + } + }, + "summary": "Added the { 'baz' } export statement" + }, + { + "span": { + "insert": { + "start": [ + 21, + 1 + ], + "end": [ + 21, + 44 + ] + } + }, + "summary": "Added the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "insert": { + "start": [ + 22, + 1 + ], + "end": [ + 22, + 66 + ] + } + }, + "summary": "Added the { import6 as name6, import7 as name7, nameB } from 'fizz' export statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index c8b53ff3..281c6726 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,25 +1,3 @@", + "-export { name4, name5, name6, nameZ };", + "-export { variable2 as name2, variable3 as name3, nameY };", + "-export let name3, name4, nameT;", + "-export let name2 = value2, name3 = value3, name4, nameO;", + "-export default otherNamedFunction;", + "-export default function newName1() {};", + "-export default function () {};", + "-export { name2 as statement };", + "-export * from 'baz';", + "-export { name7, name8, nameP } from 'buzz';", + "-export { import6 as name6, import7 as name7, nameB } from 'fizz';", + "-export { name1, name2, name3, nameN };", + "-export { variable1 as name1, variable2 as name2, nameN };", + "-export let name1, name2, nameN;", + "-export let name1 = value1, name2 = value2, name3, nameN;", + "-export default namedFunction;", + "-export default function () { };", + "-export default function name1() { };", + "-export { name1 as default };", + "-export * from 'foo';", + "-export { name1, name2, nameN } from 'foo';", + "-export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;", + "@@ -31,3 +9,14 @@ export { name1 as default };", + " export * from 'foo';", + " export { name1, name2, nameN } from 'foo';", + " export { import1 as name1, import2 as name2, nameN } from 'bar';", + "+export { name4, name5, name6, nameZ };", + "+export { variable2 as name2, variable3 as name3, nameY };", + "+export let name3, name4, nameT;", + "+export let name2 = value2, name3 = value3, name4, nameO;", + "+export default otherNamedFunction;", + "+export default function newName1() {};", + "+export default function () {};", + "+export { name2 as statement };", + "+export * from 'baz';", + "+export { name7, name8, nameP } from 'buzz';", + "+export { import6 as name6, import7 as name7, nameB } from 'fizz';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2b9bf50a05887a7a162d095a2abfeca055308bc8..34e4cddde5d1b60cd8f711bb1c58b9ee16d36001" +} +,{ + "testCaseDescription": "javascript-export-delete-test", + "expectedResult": { + "changes": { + "export.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the { name1, name2, name3, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 58 + ] + } + }, + "summary": "Deleted the { variable1 as name1, variable2 as name2, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Deleted the { name1, name2, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Deleted the { name1 = value1, name2 = value2, name3, nameN } export statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 30 + ] + } + }, + "summary": "Deleted the { namedFunction } export statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 32 + ] + } + }, + "summary": "Deleted the { anonymous() } export statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 37 + ] + } + }, + "summary": "Deleted the { name1 } export statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 29 + ] + } + }, + "summary": "Deleted the { name1 as default } export statement" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Deleted the { 'foo' } export statement" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 43 + ] + } + }, + "summary": "Deleted the { name1, name2, nameN } from 'foo' export statement" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 65 + ] + } + }, + "summary": "Deleted the { import1 as name1, import2 as name2, nameN } from 'bar' export statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index 281c6726..e105ba78 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,14 +1,3 @@", + "-export { name1, name2, name3, nameN };", + "-export { variable1 as name1, variable2 as name2, nameN };", + "-export let name1, name2, nameN;", + "-export let name1 = value1, name2 = value2, name3, nameN;", + "-export default namedFunction;", + "-export default function () { };", + "-export default function name1() { };", + "-export { name1 as default };", + "-export * from 'foo';", + "-export { name1, name2, nameN } from 'foo';", + "-export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name4, name5, name6, nameZ };", + " export { variable2 as name2, variable3 as name3, nameY };", + " export let name3, name4, nameT;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "34e4cddde5d1b60cd8f711bb1c58b9ee16d36001..4a053ca50921f795644922f2ed23f98974d7d5bc" +} +,{ + "testCaseDescription": "javascript-export-delete-rest-test", + "expectedResult": { + "changes": { + "export.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the { name4, name5, name6, nameZ } export statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 58 + ] + } + }, + "summary": "Deleted the { variable2 as name2, variable3 as name3, nameY } export statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 32 + ] + } + }, + "summary": "Deleted the { name3, name4, nameT } export statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 57 + ] + } + }, + "summary": "Deleted the { name2 = value2, name3 = value3, name4, nameO } export statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 35 + ] + } + }, + "summary": "Deleted the { otherNamedFunction } export statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 39 + ] + } + }, + "summary": "Deleted the { newName1 } export statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 31 + ] + } + }, + "summary": "Deleted the { anonymous() } export statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 31 + ] + } + }, + "summary": "Deleted the { name2 as statement } export statement" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 21 + ] + } + }, + "summary": "Deleted the { 'baz' } export statement" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 44 + ] + } + }, + "summary": "Deleted the { name7, name8, nameP } from 'buzz' export statement" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 66 + ] + } + }, + "summary": "Deleted the { import6 as name6, import7 as name7, nameB } from 'fizz' export statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index e105ba78..e69de29b 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,11 +0,0 @@", + "-export { name4, name5, name6, nameZ };", + "-export { variable2 as name2, variable3 as name3, nameY };", + "-export let name3, name4, nameT;", + "-export let name2 = value2, name3 = value3, name4, nameO;", + "-export default otherNamedFunction;", + "-export default function newName1() {};", + "-export default function () {};", + "-export { name2 as statement };", + "-export * from 'baz';", + "-export { name7, name8, nameP } from 'buzz';", + "-export { import6 as name6, import7 as name7, nameB } from 'fizz';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4a053ca50921f795644922f2ed23f98974d7d5bc..689c75b2c901c257422d3759b780fc15b9819a0d" +}] diff --git a/test/corpus/diff-summaries/javascript/false.json b/test/corpus/diff-summaries/javascript/false.json new file mode 100644 index 000000000..f2c504d5b --- /dev/null +++ b/test/corpus/diff-summaries/javascript/false.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "javascript-false-insert-test", + "expectedResult": { + "changes": { + "false.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added 'false'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index e69de29b..8a639462 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -0,0 +1 @@", + "+false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3404e2f9981f841657789983a30885db1872d717..e32d226417893d90b90c717bc9b4739ef2731415" +} +,{ + "testCaseDescription": "javascript-false-replacement-insert-test", + "expectedResult": { + "changes": { + "false.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Added the 'false' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added 'false'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 8a639462..86574b16 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1 +1,3 @@", + "+return false;", + "+false;", + " false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e32d226417893d90b90c717bc9b4739ef2731415..a44e2cc71169f20db65adf8d366682a6fe00e290" +} +,{ + "testCaseDescription": "javascript-false-delete-insert-test", + "expectedResult": { + "changes": { + "false.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added 'false'" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Deleted the 'false' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 86574b16..7bae7c53 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,3 +1,3 @@", + "-return false;", + "+false;", + " false;", + " false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a44e2cc71169f20db65adf8d366682a6fe00e290..2a86beea0ad48757fb4535a6b4e01f2a8d1eb126" +} +,{ + "testCaseDescription": "javascript-false-replacement-test", + "expectedResult": { + "changes": { + "false.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Added the 'false' return statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted 'false'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 7bae7c53..86574b16 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,3 +1,3 @@", + "-false;", + "+return false;", + " false;", + " false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2a86beea0ad48757fb4535a6b4e01f2a8d1eb126..d17653b6c7ba93cfb9d0ff774a68e29b1aee2d9b" +} +,{ + "testCaseDescription": "javascript-false-delete-replacement-test", + "expectedResult": { + "changes": { + "false.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Deleted the 'false' return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted 'false'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 14 + ] + } + }, + "summary": "Added the 'false' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 86574b16..85b5be91 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,3 +1,2 @@", + "-return false;", + "-false;", + " false;", + "+return false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d17653b6c7ba93cfb9d0ff774a68e29b1aee2d9b..fa9113a78c78561620fd5ad48a5a4d3b22056832" +} +,{ + "testCaseDescription": "javascript-false-delete-test", + "expectedResult": { + "changes": { + "false.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted 'false'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 85b5be91..1f328b3b 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,2 +1 @@", + "-false;", + " return false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fa9113a78c78561620fd5ad48a5a4d3b22056832..0cb01c5633b7b5a84ed2d5f6c50fff5c609755c5" +} +,{ + "testCaseDescription": "javascript-false-delete-rest-test", + "expectedResult": { + "changes": { + "false.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Deleted the 'false' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 1f328b3b..e69de29b 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1 +0,0 @@", + "-return false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0cb01c5633b7b5a84ed2d5f6c50fff5c609755c5..5d563ac383acc3c789fbd552c697d625c0f424fc" +}] diff --git a/test/corpus/diff-summaries/javascript/for-in-statement.json b/test/corpus/diff-summaries/javascript/for-in-statement.json new file mode 100644 index 000000000..e46d2b952 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/for-in-statement.json @@ -0,0 +1,455 @@ +[{ + "testCaseDescription": "javascript-for-in-statement-insert-test", + "expectedResult": { + "changes": { + "for-in-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 35 + ] + } + }, + "summary": "Added the 'thing in things' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index e69de29b..f9282876 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -0,0 +1 @@", + "+for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "58aa7b1cb85df06bb4b647466c43f5c4862c695f..6a3e5d7ab858bcd204986ac6ddf41be3c15b3b3d" +} +,{ + "testCaseDescription": "javascript-for-in-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "for-in-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Added the 'item in items' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 35 + ] + } + }, + "summary": "Added the 'thing in things' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index f9282876..4a482e9e 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1 +1,3 @@", + "+for (item in items) { item(); }", + "+for (thing in things) { thing(); }", + " for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6a3e5d7ab858bcd204986ac6ddf41be3c15b3b3d..d6ad795d65a034c3533bba704a5d815200fc52aa" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-insert-test", + "expectedResult": { + "changes": { + "for-in-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 10 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced the 'item' identifier with the 'thing' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 14 + ], + "end": [ + 1, + 19 + ] + }, + { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'items' identifier with the 'things' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 23 + ], + "end": [ + 1, + 27 + ] + }, + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 30 + ] + } + ] + }, + "summary": "Replaced the 'item' identifier with the 'thing' identifier in the thing() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index 4a482e9e..e949bafb 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (item in items) { item(); }", + "+for (thing in things) { thing(); }", + " for (thing in things) { thing(); }", + " for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d6ad795d65a034c3533bba704a5d815200fc52aa..dff97b983476385bb15314a17278b6108c4e5bfa" +} +,{ + "testCaseDescription": "javascript-for-in-statement-replacement-test", + "expectedResult": { + "changes": { + "for-in-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 10 + ] + } + ] + }, + "summary": "Replaced the 'thing' identifier with the 'item' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 14 + ], + "end": [ + 1, + 19 + ] + } + ] + }, + "summary": "Replaced the 'things' identifier with the 'items' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 30 + ] + }, + { + "start": [ + 1, + 23 + ], + "end": [ + 1, + 27 + ] + } + ] + }, + "summary": "Replaced the 'thing' identifier with the 'item' identifier in the item() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index e949bafb..4a482e9e 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (thing in things) { thing(); }", + "+for (item in items) { item(); }", + " for (thing in things) { thing(); }", + " for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dff97b983476385bb15314a17278b6108c4e5bfa..c6a910a31691c82532e8413dbda5e29bbae68b32" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "for-in-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted the 'item in items' for statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 35 + ] + } + }, + "summary": "Deleted the 'thing in things' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Added the 'item in items' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index 4a482e9e..6b5f12ae 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,3 +1,2 @@", + "-for (item in items) { item(); }", + "-for (thing in things) { thing(); }", + " for (thing in things) { thing(); }", + "+for (item in items) { item(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c6a910a31691c82532e8413dbda5e29bbae68b32..1ec1a3068de40b2767847a640a8b0139f271dfae" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-test", + "expectedResult": { + "changes": { + "for-in-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 35 + ] + } + }, + "summary": "Deleted the 'thing in things' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index 6b5f12ae..a3d8882d 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,2 +1 @@", + "-for (thing in things) { thing(); }", + " for (item in items) { item(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1ec1a3068de40b2767847a640a8b0139f271dfae..59da009b44fc653570e96a3dfb3211b31872bca3" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-rest-test", + "expectedResult": { + "changes": { + "for-in-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted the 'item in items' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index a3d8882d..e69de29b 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1 +0,0 @@", + "-for (item in items) { item(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "59da009b44fc653570e96a3dfb3211b31872bca3..d03236f8517c53c78b398fe3778c8170b54e36ea" +}] diff --git a/test/corpus/diff-summaries/javascript/for-loop-with-in-statement.json b/test/corpus/diff-summaries/javascript/for-loop-with-in-statement.json new file mode 100644 index 000000000..050a23405 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/for-loop-with-in-statement.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-for-loop-with-in-statement-insert-test", + "expectedResult": { + "changes": { + "for-loop-with-in-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 63 + ] + } + }, + "summary": "Added the 'key in something && i = 0; i < n; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index e69de29b..c467478a 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -0,0 +1 @@", + "+for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f2eb239be06cc6a99d83ff77dc9852645f8a006b..e7fa29416487b01b878efdd2c73d11914804b9be" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "for-loop-with-in-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 73 + ] + } + }, + "summary": "Added the 'otherKey in something && i = 0; i < n; i++' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 63 + ] + } + }, + "summary": "Added the 'key in something && i = 0; i < n; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index c467478a..0147d318 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1 +1,3 @@", + "+for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + "+for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e7fa29416487b01b878efdd2c73d11914804b9be..aa573efa719e1be8687189599e8294b233afbd2b" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-insert-test", + "expectedResult": { + "changes": { + "for-loop-with-in-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 14 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'otherKey' identifier with the 'key' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 52 + ], + "end": [ + 1, + 68 + ] + }, + { + "start": [ + 1, + 47 + ], + "end": [ + 1, + 58 + ] + } + ] + }, + "summary": "Replaced the 'doOtherSomething' identifier with the 'doSomething' identifier in the doSomething() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index 0147d318..306fa88a 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + "+for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "aa573efa719e1be8687189599e8294b233afbd2b..766cce0f123eddc34a16787fbeb019fb2a1ecd12" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-replacement-test", + "expectedResult": { + "changes": { + "for-loop-with-in-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 14 + ] + } + ] + }, + "summary": "Replaced the 'key' identifier with the 'otherKey' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 47 + ], + "end": [ + 1, + 58 + ] + }, + { + "start": [ + 1, + 52 + ], + "end": [ + 1, + 68 + ] + } + ] + }, + "summary": "Replaced the 'doSomething' identifier with the 'doOtherSomething' identifier in the doOtherSomething() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index 306fa88a..0147d318 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (key in something && i = 0; i < n; i++) { doSomething(); }", + "+for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "766cce0f123eddc34a16787fbeb019fb2a1ecd12..3c743b7d417934597326114cf7a45ae0136d44dc" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "for-loop-with-in-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 73 + ] + } + }, + "summary": "Deleted the 'otherKey in something && i = 0; i < n; i++' for statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 63 + ] + } + }, + "summary": "Deleted the 'key in something && i = 0; i < n; i++' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 73 + ] + } + }, + "summary": "Added the 'otherKey in something && i = 0; i < n; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index 0147d318..f23fa316 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,3 +1,2 @@", + "-for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + "-for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }", + "+for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3c743b7d417934597326114cf7a45ae0136d44dc..16e9e853bb10e1be74c7f39361af4bc8858ef8e0" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-test", + "expectedResult": { + "changes": { + "for-loop-with-in-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 63 + ] + } + }, + "summary": "Deleted the 'key in something && i = 0; i < n; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index f23fa316..e9681607 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,2 +1 @@", + "-for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "16e9e853bb10e1be74c7f39361af4bc8858ef8e0..beb03500501b1e8607dad975a7f423f8baf33d94" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-rest-test", + "expectedResult": { + "changes": { + "for-loop-with-in-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 73 + ] + } + }, + "summary": "Deleted the 'otherKey in something && i = 0; i < n; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index e9681607..e69de29b 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1 +0,0 @@", + "-for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "beb03500501b1e8607dad975a7f423f8baf33d94..e9db20e9b701c8a70a82df7f42dc862632f34005" +}] diff --git a/test/corpus/diff-summaries/javascript/for-of-statement.json b/test/corpus/diff-summaries/javascript/for-of-statement.json new file mode 100644 index 000000000..5d7d4ae27 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/for-of-statement.json @@ -0,0 +1,455 @@ +[{ + "testCaseDescription": "javascript-for-of-statement-insert-test", + "expectedResult": { + "changes": { + "for-of-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 43 + ] + } + }, + "summary": "Added the 'item of items' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index e69de29b..1ed27542 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -0,0 +1 @@", + "+for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e9db20e9b701c8a70a82df7f42dc862632f34005..e6d287ef4ceedccefb165e24cc0fd2fd186d5a45" +} +,{ + "testCaseDescription": "javascript-for-of-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "for-of-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 46 + ] + } + }, + "summary": "Added the 'thing of things' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 43 + ] + } + }, + "summary": "Added the 'item of items' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 1ed27542..ab20ded2 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1 +1,3 @@", + "+for (let thing of things) { process(thing); };", + "+for (let item of items) { process(item); };", + " for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e6d287ef4ceedccefb165e24cc0fd2fd186d5a45..0f41c6e8f4378275d415c4f89d1ae0edd5861240" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-insert-test", + "expectedResult": { + "changes": { + "for-of-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 14 + ] + } + ] + }, + "summary": "Replaced the 'thing' identifier with the 'item' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 19 + ], + "end": [ + 1, + 25 + ] + }, + { + "start": [ + 1, + 18 + ], + "end": [ + 1, + 23 + ] + } + ] + }, + "summary": "Replaced the 'things' identifier with the 'items' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 37 + ], + "end": [ + 1, + 42 + ] + }, + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 39 + ] + } + ] + }, + "summary": "Replaced the 'thing' identifier with the 'item' identifier in the process(item) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index ab20ded2..19561a3e 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,3 +1,3 @@", + "-for (let thing of things) { process(thing); };", + "+for (let item of items) { process(item); };", + " for (let item of items) { process(item); };", + " for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0f41c6e8f4378275d415c4f89d1ae0edd5861240..a6b618329e1c061028f5ae9fba2116fd281b6f44" +} +,{ + "testCaseDescription": "javascript-for-of-statement-replacement-test", + "expectedResult": { + "changes": { + "for-of-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 14 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced the 'item' identifier with the 'thing' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 18 + ], + "end": [ + 1, + 23 + ] + }, + { + "start": [ + 1, + 19 + ], + "end": [ + 1, + 25 + ] + } + ] + }, + "summary": "Replaced the 'items' identifier with the 'things' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 39 + ] + }, + { + "start": [ + 1, + 37 + ], + "end": [ + 1, + 42 + ] + } + ] + }, + "summary": "Replaced the 'item' identifier with the 'thing' identifier in the process(thing) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 19561a3e..ab20ded2 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,3 +1,3 @@", + "-for (let item of items) { process(item); };", + "+for (let thing of things) { process(thing); };", + " for (let item of items) { process(item); };", + " for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a6b618329e1c061028f5ae9fba2116fd281b6f44..a2b19ddc74c11b06577cc04ee17fb5014c509809" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "for-of-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 46 + ] + } + }, + "summary": "Deleted the 'thing of things' for statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 43 + ] + } + }, + "summary": "Deleted the 'item of items' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 46 + ] + } + }, + "summary": "Added the 'thing of things' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index ab20ded2..62db34f8 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,3 +1,2 @@", + "-for (let thing of things) { process(thing); };", + "-for (let item of items) { process(item); };", + " for (let item of items) { process(item); };", + "+for (let thing of things) { process(thing); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a2b19ddc74c11b06577cc04ee17fb5014c509809..716471c15df7e4f9d467c16b72773575ab0daf20" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-test", + "expectedResult": { + "changes": { + "for-of-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 43 + ] + } + }, + "summary": "Deleted the 'item of items' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 62db34f8..5170ce4b 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,2 +1 @@", + "-for (let item of items) { process(item); };", + " for (let thing of things) { process(thing); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "716471c15df7e4f9d467c16b72773575ab0daf20..742d48d2166f7f4e5e0d6d0ebd86afa36266f86a" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-rest-test", + "expectedResult": { + "changes": { + "for-of-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 46 + ] + } + }, + "summary": "Deleted the 'thing of things' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 5170ce4b..e69de29b 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1 +0,0 @@", + "-for (let thing of things) { process(thing); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "742d48d2166f7f4e5e0d6d0ebd86afa36266f86a..a43b37a27c89c6d1f96f5a83f5498c56b9e45338" +}] diff --git a/test/corpus/diff-summaries/javascript/for-statement.json b/test/corpus/diff-summaries/javascript/for-statement.json new file mode 100644 index 000000000..da07b404c --- /dev/null +++ b/test/corpus/diff-summaries/javascript/for-statement.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-for-statement-insert-test", + "expectedResult": { + "changes": { + "for-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Added the 'i = 0, init(); i < 10; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index e69de29b..2f51258e 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -0,0 +1 @@", + "+for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c320f90e127c691529e4c298d3ff3969a0483c8e..119df29f1b8c4152c752d221354c7143086f0ba9" +} +,{ + "testCaseDescription": "javascript-for-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "for-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 46 + ] + } + }, + "summary": "Added the 'i = 0, init(); i < 100; i++' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 45 + ] + } + }, + "summary": "Added the 'i = 0, init(); i < 10; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 2f51258e..095241f1 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1 +1,3 @@", + "+for (i = 0, init(); i < 100; i++) { log(i); }", + "+for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "119df29f1b8c4152c752d221354c7143086f0ba9..d125a35865450614b4947f6e64be6d447f3d00b9" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-insert-test", + "expectedResult": { + "changes": { + "for-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 28 + ] + }, + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 27 + ] + } + ] + }, + "summary": "Replaced '100' with '10'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 095241f1..9b0e26d4 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,3 +1,3 @@", + "-for (i = 0, init(); i < 100; i++) { log(i); }", + "+for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d125a35865450614b4947f6e64be6d447f3d00b9..d6241bcabe282470e4224aad942ff060ca01eecf" +} +,{ + "testCaseDescription": "javascript-for-statement-replacement-test", + "expectedResult": { + "changes": { + "for-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 27 + ] + }, + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 28 + ] + } + ] + }, + "summary": "Replaced '10' with '100'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 9b0e26d4..095241f1 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,3 +1,3 @@", + "-for (i = 0, init(); i < 10; i++) { log(i); }", + "+for (i = 0, init(); i < 100; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d6241bcabe282470e4224aad942ff060ca01eecf..a42953f4ddb4d9c4db7e33c68117f329ac6e08b9" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "for-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 46 + ] + } + }, + "summary": "Deleted the 'i = 0, init(); i < 100; i++' for statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 45 + ] + } + }, + "summary": "Deleted the 'i = 0, init(); i < 10; i++' for statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 46 + ] + } + }, + "summary": "Added the 'i = 0, init(); i < 100; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 095241f1..39af699a 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,3 +1,2 @@", + "-for (i = 0, init(); i < 100; i++) { log(i); }", + "-for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }", + "+for (i = 0, init(); i < 100; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a42953f4ddb4d9c4db7e33c68117f329ac6e08b9..054aae5c741bcc075e61263fab2004c700f4f681" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-test", + "expectedResult": { + "changes": { + "for-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Deleted the 'i = 0, init(); i < 10; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 39af699a..de8ae87b 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,2 +1 @@", + "-for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 100; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "054aae5c741bcc075e61263fab2004c700f4f681..168c29c5108a6a63f29746df65a3886bb8489f94" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-rest-test", + "expectedResult": { + "changes": { + "for-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 46 + ] + } + }, + "summary": "Deleted the 'i = 0, init(); i < 100; i++' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index de8ae87b..e69de29b 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1 +0,0 @@", + "-for (i = 0, init(); i < 100; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "168c29c5108a6a63f29746df65a3886bb8489f94..ae3598b402258260e941e7a876918f8037bf887d" +}] diff --git a/test/corpus/diff-summaries/javascript/function-call-args.json b/test/corpus/diff-summaries/javascript/function-call-args.json new file mode 100644 index 000000000..d24c67560 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/function-call-args.json @@ -0,0 +1,617 @@ +[{ + "testCaseDescription": "javascript-function-call-args-insert-test", + "expectedResult": { + "changes": { + "function-call-args.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 77 + ] + } + }, + "summary": "Added the 'someFunction(1, \"string\", …, true)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index e69de29b..699333de 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -0,0 +1 @@", + "+someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a1cfaadb31d0f0d28d7449d160ba2ed06ec9c6af..f765da24248e68bf31db9272cd07fd27732ce9da" +} +,{ + "testCaseDescription": "javascript-function-call-args-replacement-insert-test", + "expectedResult": { + "changes": { + "function-call-args.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 83 + ] + } + }, + "summary": "Added the 'someFunction(1, \"otherString\", …, false)' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 77 + ] + } + }, + "summary": "Added the 'someFunction(1, \"string\", …, true)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 699333de..3f4ee6ef 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1 +1,3 @@", + "+someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + "+someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f765da24248e68bf31db9272cd07fd27732ce9da..5caf097567f54bba021b07365b69f238385b23d6" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-insert-test", + "expectedResult": { + "changes": { + "function-call-args.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 30 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 25 + ] + } + ] + }, + "summary": "Replaced the \"otherString\" string with the \"string\" string in the someFunction(1, \"string\", …, true) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 42 + ] + }, + { + "start": [ + 1, + 36 + ], + "end": [ + 1, + 37 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier in the someFunction(1, \"string\", …, true) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 44 + ] + }, + { + "start": [ + 1, + 38 + ], + "end": [ + 1, + 39 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'b' identifier in the someFunction(1, \"string\", …, true) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 60 + ], + "end": [ + 1, + 61 + ] + }, + { + "start": [ + 1, + 55 + ], + "end": [ + 1, + 56 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier in the console.log(a) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 71 + ], + "end": [ + 1, + 72 + ] + }, + { + "start": [ + 1, + 66 + ], + "end": [ + 1, + 67 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'b' identifier in the someFunction(1, \"string\", …, true) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 77 + ], + "end": [ + 1, + 82 + ] + }, + { + "start": [ + 1, + 72 + ], + "end": [ + 1, + 76 + ] + } + ] + }, + "summary": "Replaced 'false' with 'true' in the someFunction(1, \"string\", …, true) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 3f4ee6ef..dc419cba 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,3 +1,3 @@", + "-someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + "+someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5caf097567f54bba021b07365b69f238385b23d6..a418e2295aafa9eedc993771ad325a32d94e3cb6" +} +,{ + "testCaseDescription": "javascript-function-call-args-replacement-test", + "expectedResult": { + "changes": { + "function-call-args.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 25 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 30 + ] + } + ] + }, + "summary": "Replaced the \"string\" string with the \"otherString\" string in the someFunction(1, \"otherString\", …, false) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 36 + ], + "end": [ + 1, + 37 + ] + }, + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 42 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier in the someFunction(1, \"otherString\", …, false) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 38 + ], + "end": [ + 1, + 39 + ] + }, + { + "start": [ + 1, + 43 + ], + "end": [ + 1, + 44 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'c' identifier in the someFunction(1, \"otherString\", …, false) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 55 + ], + "end": [ + 1, + 56 + ] + }, + { + "start": [ + 1, + 60 + ], + "end": [ + 1, + 61 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier in the console.log(b) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 66 + ], + "end": [ + 1, + 67 + ] + }, + { + "start": [ + 1, + 71 + ], + "end": [ + 1, + 72 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'c' identifier in the someFunction(1, \"otherString\", …, false) function call" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 72 + ], + "end": [ + 1, + 76 + ] + }, + { + "start": [ + 1, + 77 + ], + "end": [ + 1, + 82 + ] + } + ] + }, + "summary": "Replaced 'true' with 'false' in the someFunction(1, \"otherString\", …, false) function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index dc419cba..3f4ee6ef 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,3 +1,3 @@", + "-someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + "+someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a418e2295aafa9eedc993771ad325a32d94e3cb6..f0f325f6ce0df4ba500ebb3845ad93dc904ba24b" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-replacement-test", + "expectedResult": { + "changes": { + "function-call-args.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 83 + ] + } + }, + "summary": "Deleted the 'someFunction(1, \"otherString\", …, false)' function call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 77 + ] + } + }, + "summary": "Deleted the 'someFunction(1, \"string\", …, true)' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 83 + ] + } + }, + "summary": "Added the 'someFunction(1, \"otherString\", …, false)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 3f4ee6ef..cae967b6 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,3 +1,2 @@", + "-someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + "-someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + "+someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f0f325f6ce0df4ba500ebb3845ad93dc904ba24b..b77a2a6a266180d3d20a483bb63291ead5827012" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-test", + "expectedResult": { + "changes": { + "function-call-args.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 77 + ] + } + }, + "summary": "Deleted the 'someFunction(1, \"string\", …, true)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index cae967b6..0d19573d 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,2 +1 @@", + "-someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b77a2a6a266180d3d20a483bb63291ead5827012..b879b321d2517cc0edaeeb2bbf71f455415bd3a4" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-rest-test", + "expectedResult": { + "changes": { + "function-call-args.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 83 + ] + } + }, + "summary": "Deleted the 'someFunction(1, \"otherString\", …, false)' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 0d19573d..e69de29b 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1 +0,0 @@", + "-someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b879b321d2517cc0edaeeb2bbf71f455415bd3a4..347b15603c28f7232a36d6d312d1c335a4dd39db" +}] diff --git a/test/corpus/diff-summaries/javascript/function-call.json b/test/corpus/diff-summaries/javascript/function-call.json new file mode 100644 index 000000000..def363d7e --- /dev/null +++ b/test/corpus/diff-summaries/javascript/function-call.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-function-call-insert-test", + "expectedResult": { + "changes": { + "function-call.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 27 + ] + } + }, + "summary": "Added the 'someFunction(arg1, \"arg2\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index e69de29b..8bd95e09 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -0,0 +1 @@", + "+someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c95bd0e01ff1d7d686262b782db20ad959d3676f..8d35c071d83baf7595dd69c6e63000d814343485" +} +,{ + "testCaseDescription": "javascript-function-call-replacement-insert-test", + "expectedResult": { + "changes": { + "function-call.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 27 + ] + } + }, + "summary": "Added the 'someFunction(arg1, \"arg3\")' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 27 + ] + } + }, + "summary": "Added the 'someFunction(arg1, \"arg2\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 8bd95e09..6bb4cf3f 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1 +1,3 @@", + "+someFunction(arg1, \"arg3\");", + "+someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8d35c071d83baf7595dd69c6e63000d814343485..ced1926b498dacd2bb8365d9c9f7c07f75229170" +} +,{ + "testCaseDescription": "javascript-function-call-delete-insert-test", + "expectedResult": { + "changes": { + "function-call.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 26 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 26 + ] + } + ] + }, + "summary": "Replaced the \"arg3\" string with the \"arg2\" string in the someFunction(arg1, \"arg2\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 6bb4cf3f..b38c232b 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,3 +1,3 @@", + "-someFunction(arg1, \"arg3\");", + "+someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ced1926b498dacd2bb8365d9c9f7c07f75229170..1c76636d16ecfbdf2c061cbee3c6e9c8ead03189" +} +,{ + "testCaseDescription": "javascript-function-call-replacement-test", + "expectedResult": { + "changes": { + "function-call.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 26 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 26 + ] + } + ] + }, + "summary": "Replaced the \"arg2\" string with the \"arg3\" string in the someFunction(arg1, \"arg3\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index b38c232b..6bb4cf3f 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,3 +1,3 @@", + "-someFunction(arg1, \"arg2\");", + "+someFunction(arg1, \"arg3\");", + " someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1c76636d16ecfbdf2c061cbee3c6e9c8ead03189..d988eca7c678f25f5400db278a7092b4af201c36" +} +,{ + "testCaseDescription": "javascript-function-call-delete-replacement-test", + "expectedResult": { + "changes": { + "function-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 27 + ] + } + }, + "summary": "Deleted the 'someFunction(arg1, \"arg3\")' function call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 27 + ] + } + }, + "summary": "Deleted the 'someFunction(arg1, \"arg2\")' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 27 + ] + } + }, + "summary": "Added the 'someFunction(arg1, \"arg3\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 6bb4cf3f..3e15c6ac 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,3 +1,2 @@", + "-someFunction(arg1, \"arg3\");", + "-someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");", + "+someFunction(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d988eca7c678f25f5400db278a7092b4af201c36..46e628cebf19ab82cf52a1c276553dd4deb19448" +} +,{ + "testCaseDescription": "javascript-function-call-delete-test", + "expectedResult": { + "changes": { + "function-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 27 + ] + } + }, + "summary": "Deleted the 'someFunction(arg1, \"arg2\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 3e15c6ac..1add64b5 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,2 +1 @@", + "-someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "46e628cebf19ab82cf52a1c276553dd4deb19448..38cde3809ada68234c67c79128fa24657a566d83" +} +,{ + "testCaseDescription": "javascript-function-call-delete-rest-test", + "expectedResult": { + "changes": { + "function-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 27 + ] + } + }, + "summary": "Deleted the 'someFunction(arg1, \"arg3\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 1add64b5..e69de29b 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1 +0,0 @@", + "-someFunction(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "38cde3809ada68234c67c79128fa24657a566d83..2d43584fc8ddc7ca7298a1e0e0a9be013b19f0be" +}] diff --git a/test/corpus/diff-summaries/javascript/function.json b/test/corpus/diff-summaries/javascript/function.json new file mode 100644 index 000000000..908158e37 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/function.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-function-insert-test", + "expectedResult": { + "changes": { + "function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Added an anonymous(arg1, arg2) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index e69de29b..2d8d739d 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -0,0 +1 @@", + "+function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "790803fdb50f5b52531a5fd1dc0573fd2b036126..7922b25d0276bdf1431e206d3709b1fbf28c9133" +} +,{ + "testCaseDescription": "javascript-function-replacement-insert-test", + "expectedResult": { + "changes": { + "function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Added an anonymous(arg1, arg2) function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 31 + ] + } + }, + "summary": "Added an anonymous(arg1, arg2) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 2d8d739d..43894067 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1 +1,3 @@", + "+function(arg1, arg2) { arg1; };", + "+function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7922b25d0276bdf1431e206d3709b1fbf28c9133..0078e81905fd24f5b8331a8afdb513e1cef9d37b" +} +,{ + "testCaseDescription": "javascript-function-delete-insert-test", + "expectedResult": { + "changes": { + "function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 28 + ] + }, + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 28 + ] + } + ] + }, + "summary": "Replaced the 'arg1' identifier with the 'arg2' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 43894067..924c99e8 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,3 +1,3 @@", + "-function(arg1, arg2) { arg1; };", + "+function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0078e81905fd24f5b8331a8afdb513e1cef9d37b..46927e5733291be730cf9c3c08ba0310d5741b1a" +} +,{ + "testCaseDescription": "javascript-function-replacement-test", + "expectedResult": { + "changes": { + "function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 28 + ] + }, + { + "start": [ + 1, + 24 + ], + "end": [ + 1, + 28 + ] + } + ] + }, + "summary": "Replaced the 'arg2' identifier with the 'arg1' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 924c99e8..43894067 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,3 +1,3 @@", + "-function(arg1, arg2) { arg2; };", + "+function(arg1, arg2) { arg1; };", + " function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "46927e5733291be730cf9c3c08ba0310d5741b1a..20a5479f9e8a063124d86ae85541ce7fdc62beef" +} +,{ + "testCaseDescription": "javascript-function-delete-replacement-test", + "expectedResult": { + "changes": { + "function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Deleted an anonymous(arg1, arg2) function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 31 + ] + } + }, + "summary": "Deleted an anonymous(arg1, arg2) function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 31 + ] + } + }, + "summary": "Added an anonymous(arg1, arg2) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 43894067..254dbcf8 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,3 +1,2 @@", + "-function(arg1, arg2) { arg1; };", + "-function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };", + "+function(arg1, arg2) { arg1; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "20a5479f9e8a063124d86ae85541ce7fdc62beef..2834c6bfa834cd256af7b261c00c9ea9f4c89b29" +} +,{ + "testCaseDescription": "javascript-function-delete-test", + "expectedResult": { + "changes": { + "function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Deleted an anonymous(arg1, arg2) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 254dbcf8..b37e8671 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,2 +1 @@", + "-function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg1; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2834c6bfa834cd256af7b261c00c9ea9f4c89b29..c2fbf6621ebe94f439fc6c087171487345109a21" +} +,{ + "testCaseDescription": "javascript-function-delete-rest-test", + "expectedResult": { + "changes": { + "function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Deleted an anonymous(arg1, arg2) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index b37e8671..e69de29b 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1 +0,0 @@", + "-function(arg1, arg2) { arg1; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c2fbf6621ebe94f439fc6c087171487345109a21..42d2564cba025ea67f19ffdd328b554aa2aede8b" +}] diff --git a/test/corpus/diff-summaries/javascript/generator-function.json b/test/corpus/diff-summaries/javascript/generator-function.json new file mode 100644 index 000000000..fa9e97d7f --- /dev/null +++ b/test/corpus/diff-summaries/javascript/generator-function.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-generator-function-insert-test", + "expectedResult": { + "changes": { + "generator-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 59 + ] + } + }, + "summary": "Added the 'generateStuff' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index e69de29b..04e8a59b 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -0,0 +1 @@", + "+function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "39852cdd4b70a1926580629f96ee4221841afb76..f14e45177bf87d972dd094d434afebf6ab7bd2e7" +} +,{ + "testCaseDescription": "javascript-generator-function-replacement-insert-test", + "expectedResult": { + "changes": { + "generator-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 62 + ] + } + }, + "summary": "Added the 'generateNewStuff' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 59 + ] + } + }, + "summary": "Added the 'generateStuff' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 04e8a59b..ed5c0370 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1 +1,3 @@", + "+function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f14e45177bf87d972dd094d434afebf6ab7bd2e7..f7e60bdec026c0669a9c5740f86204b27f7351f8" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-insert-test", + "expectedResult": { + "changes": { + "generator-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 11 + ], + "end": [ + 1, + 27 + ] + }, + { + "start": [ + 1, + 11 + ], + "end": [ + 1, + 24 + ] + } + ] + }, + "summary": "Replaced the 'generateNewStuff' identifier with the 'generateStuff' identifier in the generateStuff function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index ed5c0370..0895c3fd 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,3 +1,3 @@", + "-function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f7e60bdec026c0669a9c5740f86204b27f7351f8..0d59204851c1defc1f7b39faa5dfa1ce3cf8e77d" +} +,{ + "testCaseDescription": "javascript-generator-function-replacement-test", + "expectedResult": { + "changes": { + "generator-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 11 + ], + "end": [ + 1, + 24 + ] + }, + { + "start": [ + 1, + 11 + ], + "end": [ + 1, + 27 + ] + } + ] + }, + "summary": "Replaced the 'generateStuff' identifier with the 'generateNewStuff' identifier in the generateNewStuff function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 0895c3fd..ed5c0370 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,3 +1,3 @@", + "-function *generateStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0d59204851c1defc1f7b39faa5dfa1ce3cf8e77d..4f673ed556db59aa5ff08ce0b91eb810dfa92480" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-replacement-test", + "expectedResult": { + "changes": { + "generator-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 62 + ] + } + }, + "summary": "Deleted the 'generateNewStuff' function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 59 + ] + } + }, + "summary": "Deleted the 'generateStuff' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 62 + ] + } + }, + "summary": "Added the 'generateNewStuff' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index ed5c0370..1dae1059 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,3 +1,2 @@", + "-function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + "-function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateNewStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4f673ed556db59aa5ff08ce0b91eb810dfa92480..f125f53e66438da88bf2ec0c852bc06209d09ab2" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-test", + "expectedResult": { + "changes": { + "generator-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 59 + ] + } + }, + "summary": "Deleted the 'generateStuff' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 1dae1059..5846d1c0 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,2 +1 @@", + "-function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateNewStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f125f53e66438da88bf2ec0c852bc06209d09ab2..463b6c8615c519be4614c47e4b212f7b8ee83c74" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-rest-test", + "expectedResult": { + "changes": { + "generator-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 62 + ] + } + }, + "summary": "Deleted the 'generateNewStuff' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 5846d1c0..e69de29b 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1 +0,0 @@", + "-function *generateNewStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "463b6c8615c519be4614c47e4b212f7b8ee83c74..15e84394f61437f6604f6255ce0c5d818ac3115f" +}] diff --git a/test/corpus/diff-summaries/javascript/identifier.json b/test/corpus/diff-summaries/javascript/identifier.json new file mode 100644 index 000000000..20bd57f97 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/identifier.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-identifier-insert-test", + "expectedResult": { + "changes": { + "identifier.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index e69de29b..1cf4ad05 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -0,0 +1 @@", + "+theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2e3b3e74fb24767ec84840379177e8834c44714f..c58ea49c1e9377ca12829fe3f5a136f01b7e2ad3" +} +,{ + "testCaseDescription": "javascript-identifier-replacement-insert-test", + "expectedResult": { + "changes": { + "identifier.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'theVar2' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 1cf4ad05..888855ad 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1 +1,3 @@", + "+theVar2", + "+theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c58ea49c1e9377ca12829fe3f5a136f01b7e2ad3..3efd488399a1b5c0e052e63c3d12a7740060b68e" +} +,{ + "testCaseDescription": "javascript-identifier-delete-insert-test", + "expectedResult": { + "changes": { + "identifier.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'theVar2' identifier with the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 888855ad..60e041c1 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,3 +1,3 @@", + "-theVar2", + "+theVar;", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3efd488399a1b5c0e052e63c3d12a7740060b68e..aadcf4a2b401f08a859d46b6e0ac3c703050abf3" +} +,{ + "testCaseDescription": "javascript-identifier-replacement-test", + "expectedResult": { + "changes": { + "identifier.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced the 'theVar' identifier with the 'theVar2' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 60e041c1..888855ad 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,3 +1,3 @@", + "-theVar;", + "+theVar2", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "aadcf4a2b401f08a859d46b6e0ac3c703050abf3..1243dcd655eca55e1324bee33916146634b33ef4" +} +,{ + "testCaseDescription": "javascript-identifier-delete-replacement-test", + "expectedResult": { + "changes": { + "identifier.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'theVar2' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'theVar' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'theVar2' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 888855ad..fbc7b28e 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,3 +1,2 @@", + "-theVar2", + "-theVar;", + " theVar;", + "+theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1243dcd655eca55e1324bee33916146634b33ef4..010e826215ed50b559303d07617dfab6834d32fa" +} +,{ + "testCaseDescription": "javascript-identifier-delete-test", + "expectedResult": { + "changes": { + "identifier.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index fbc7b28e..7276d95d 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,2 +1 @@", + "-theVar;", + " theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "010e826215ed50b559303d07617dfab6834d32fa..1925d455a32628bf996383fd9af1680b7cb7be68" +} +,{ + "testCaseDescription": "javascript-identifier-delete-rest-test", + "expectedResult": { + "changes": { + "identifier.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'theVar2' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 7276d95d..e69de29b 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1 +0,0 @@", + "-theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1925d455a32628bf996383fd9af1680b7cb7be68..11c817d08ac0cb3edac35eedef4ad8f04b290d77" +}] diff --git a/test/corpus/diff-summaries/javascript/if-else.json b/test/corpus/diff-summaries/javascript/if-else.json new file mode 100644 index 000000000..9f9f00396 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/if-else.json @@ -0,0 +1,791 @@ +[{ + "testCaseDescription": "javascript-if-else-insert-test", + "expectedResult": { + "changes": { + "if-else.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Added the 'x' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index e69de29b..d81ebadd 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -0,0 +1 @@", + "+if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0aabb2672ac5aa2ce7fbeb1cad74c6c09e985a74..251f01e7d8112d3409bd0bacb65529073c9f7ad2" +} +,{ + "testCaseDescription": "javascript-if-else-replacement-insert-test", + "expectedResult": { + "changes": { + "if-else.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Added the 'g' if statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Added the 'x' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index d81ebadd..6bb0eaa7 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1 +1,3 @@", + "+if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + "+if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "251f01e7d8112d3409bd0bacb65529073c9f7ad2..f765fb5d1508d05122c61b191abc2ee22972cf41" +} +,{ + "testCaseDescription": "javascript-if-else-delete-insert-test", + "expectedResult": { + "changes": { + "if-else.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'g' identifier with the 'x' identifier in the 'x' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'y' identifier in the 'x' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'i' identifier with the 'a' identifier in the 'a' if statement" + }, + { + "span": { + "insert": { + "start": [ + 1, + 23 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Added the 'b' identifier in the 'a' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Deleted the 'j' identifier in the 'a' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 39 + ], + "end": [ + 1, + 40 + ] + }, + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + } + ] + }, + "summary": "Replaced the 'k' identifier with the 'c' identifier in the 'c' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 42 + ], + "end": [ + 1, + 43 + ] + }, + { + "start": [ + 1, + 38 + ], + "end": [ + 1, + 39 + ] + } + ] + }, + "summary": "Replaced the 'l' identifier with the 'd' identifier in the 'c' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 54 + ], + "end": [ + 1, + 55 + ] + }, + { + "start": [ + 1, + 50 + ], + "end": [ + 1, + 51 + ] + } + ] + }, + "summary": "Replaced the 'm' identifier with the 'e' identifier in the 'e' if statement" + }, + { + "span": { + "insert": { + "start": [ + 1, + 53 + ], + "end": [ + 1, + 54 + ] + } + }, + "summary": "Added the 'f' identifier in the 'e' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 59 + ], + "end": [ + 1, + 60 + ] + } + }, + "summary": "Deleted the 'n' identifier in the 'e' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 69 + ], + "end": [ + 1, + 70 + ] + }, + { + "start": [ + 1, + 61 + ], + "end": [ + 1, + 62 + ] + } + ] + }, + "summary": "Replaced the 'o' identifier with the 'g' identifier in the 'e' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 6bb0eaa7..2034be1b 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,3 +1,3 @@", + "-if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + "+if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f765fb5d1508d05122c61b191abc2ee22972cf41..cf304bbed29534ab382b4e4f567f00a0a26753c0" +} +,{ + "testCaseDescription": "javascript-if-else-replacement-test", + "expectedResult": { + "changes": { + "if-else.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'g' identifier in the 'g' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'y' identifier with the 'h' identifier in the 'g' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'i' identifier in the 'i' if statement" + }, + { + "span": { + "insert": { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Added the 'j' identifier in the 'i' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 23 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Deleted the 'b' identifier in the 'i' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + }, + { + "start": [ + 1, + 39 + ], + "end": [ + 1, + 40 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'k' identifier in the 'k' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 38 + ], + "end": [ + 1, + 39 + ] + }, + { + "start": [ + 1, + 42 + ], + "end": [ + 1, + 43 + ] + } + ] + }, + "summary": "Replaced the 'd' identifier with the 'l' identifier in the 'k' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 50 + ], + "end": [ + 1, + 51 + ] + }, + { + "start": [ + 1, + 54 + ], + "end": [ + 1, + 55 + ] + } + ] + }, + "summary": "Replaced the 'e' identifier with the 'm' identifier in the 'm' if statement" + }, + { + "span": { + "insert": { + "start": [ + 1, + 59 + ], + "end": [ + 1, + 60 + ] + } + }, + "summary": "Added the 'n' identifier in the 'm' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 53 + ], + "end": [ + 1, + 54 + ] + } + }, + "summary": "Deleted the 'f' identifier in the 'm' if statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 61 + ], + "end": [ + 1, + 62 + ] + }, + { + "start": [ + 1, + 69 + ], + "end": [ + 1, + 70 + ] + } + ] + }, + "summary": "Replaced the 'g' identifier with the 'o' identifier in the 'm' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 2034be1b..6bb0eaa7 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,3 +1,3 @@", + "-if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + "+if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cf304bbed29534ab382b4e4f567f00a0a26753c0..a477577ebcbc6152cb95204dbe944a8eeef763ee" +} +,{ + "testCaseDescription": "javascript-if-else-delete-replacement-test", + "expectedResult": { + "changes": { + "if-else.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Deleted the 'g' if statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Deleted the 'x' if statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Added the 'g' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 6bb0eaa7..e26d6c43 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,3 +1,2 @@", + "-if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + "-if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + "+if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a477577ebcbc6152cb95204dbe944a8eeef763ee..5c5a9a2d4958d2216e875c57809d92ead3492f43" +} +,{ + "testCaseDescription": "javascript-if-else-delete-test", + "expectedResult": { + "changes": { + "if-else.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Deleted the 'x' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index e26d6c43..1a55d0bd 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,2 +1 @@", + "-if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5c5a9a2d4958d2216e875c57809d92ead3492f43..d9c9db24696581dd80a3c57675bae8d1f8d1093c" +} +,{ + "testCaseDescription": "javascript-if-else-delete-rest-test", + "expectedResult": { + "changes": { + "if-else.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 1 + ] + } + }, + "summary": "Deleted the 'g' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 1a55d0bd..e69de29b 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1 +0,0 @@", + "-if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d9c9db24696581dd80a3c57675bae8d1f8d1093c..64dfefbc50b4a2c3c30e706f470afe7dac6fd8b2" +}] diff --git a/test/corpus/diff-summaries/javascript/if.json b/test/corpus/diff-summaries/javascript/if.json new file mode 100644 index 000000000..1fdfdd07c --- /dev/null +++ b/test/corpus/diff-summaries/javascript/if.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-if-insert-test", + "expectedResult": { + "changes": { + "if.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the 'x' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index e69de29b..52d4b4f0 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -0,0 +1 @@", + "+if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "218c2bd7314aff78af0e6556d8eed307360c25c2..2732186abc154de41d49f73d26938a15461ba18c" +} +,{ + "testCaseDescription": "javascript-if-replacement-insert-test", + "expectedResult": { + "changes": { + "if.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Added the 'a.b' if statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 19 + ] + } + }, + "summary": "Added the 'x' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index 52d4b4f0..ae4ee328 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1 +1,3 @@", + "+if (a.b) { log(c); d; }", + "+if (x) { log(y); }", + " if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2732186abc154de41d49f73d26938a15461ba18c..db64fdcb79dcb75922256363dae1d935e3139186" +} +,{ + "testCaseDescription": "javascript-if-delete-insert-test", + "expectedResult": { + "changes": { + "if.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + ] + }, + "summary": "Replaced the 'a.b' if statement with the 'x' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index ae4ee328..df55832d 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,3 +1,3 @@", + "-if (a.b) { log(c); d; }", + "+if (x) { log(y); }", + " if (x) { log(y); }", + " if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "db64fdcb79dcb75922256363dae1d935e3139186..cee0dee6c39e9b55025445cb0f23a7d854231563" +} +,{ + "testCaseDescription": "javascript-if-replacement-test", + "expectedResult": { + "changes": { + "if.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + ] + }, + "summary": "Replaced the 'x' if statement with the 'a.b' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index df55832d..ae4ee328 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,3 +1,3 @@", + "-if (x) { log(y); }", + "+if (a.b) { log(c); d; }", + " if (x) { log(y); }", + " if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cee0dee6c39e9b55025445cb0f23a7d854231563..30ed770f25208836cfdc58511cb3aa3e59051523" +} +,{ + "testCaseDescription": "javascript-if-delete-replacement-test", + "expectedResult": { + "changes": { + "if.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Deleted the 'a.b' if statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 19 + ] + } + }, + "summary": "Deleted the 'x' if statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 24 + ] + } + }, + "summary": "Added the 'a.b' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index ae4ee328..38b83efe 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,3 +1,2 @@", + "-if (a.b) { log(c); d; }", + "-if (x) { log(y); }", + " if (x) { log(y); }", + "+if (a.b) { log(c); d; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "30ed770f25208836cfdc58511cb3aa3e59051523..7f23c6e8dd0d922b8e833635d9770c459ecc2a29" +} +,{ + "testCaseDescription": "javascript-if-delete-test", + "expectedResult": { + "changes": { + "if.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the 'x' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index 38b83efe..f67163bb 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,2 +1 @@", + "-if (x) { log(y); }", + " if (a.b) { log(c); d; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7f23c6e8dd0d922b8e833635d9770c459ecc2a29..f441c886a7a8caf13eb03bf657cb2e5978d5f5fb" +} +,{ + "testCaseDescription": "javascript-if-delete-rest-test", + "expectedResult": { + "changes": { + "if.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 24 + ] + } + }, + "summary": "Deleted the 'a.b' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index f67163bb..e69de29b 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1 +0,0 @@", + "-if (a.b) { log(c); d; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f441c886a7a8caf13eb03bf657cb2e5978d5f5fb..0aabb2672ac5aa2ce7fbeb1cad74c6c09e985a74" +}] diff --git a/test/corpus/diff-summaries/javascript/import.json b/test/corpus/diff-summaries/javascript/import.json new file mode 100644 index 000000000..035a21706 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/import.json @@ -0,0 +1,1745 @@ +[{ + "testCaseDescription": "javascript-import-insert-test", + "expectedResult": { + "changes": { + "import.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 33 + ] + } + }, + "summary": "Added the defaultMember from \"foo\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 34 + ] + } + }, + "summary": "Added the * as name from \"aardvark\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 30 + ] + } + }, + "summary": "Added the { member } from \"ant\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 46 + ] + } + }, + "summary": "Added the { member1 , member2 } from \"antelope\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 57 + ] + } + }, + "summary": "Added the { member1 , member2 as alias2 } from \"ant-eater\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 70 + ] + } + }, + "summary": "Added the defaultMember, { member1, member2 as alias2 } from \"anaconda\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + }, + "summary": "Added the defaultMember, * as name from \"alligator\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 22 + ] + } + }, + "summary": "Added the \"arctic-tern\" import statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index e69de29b..491cb15d 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -0,0 +1,8 @@", + "+import defaultMember from \"foo\";", + "+import * as name from \"aardvark\";", + "+import { member } from \"ant\";", + "+import { member1 , member2 } from \"antelope\";", + "+import { member1 , member2 as alias2 } from \"ant-eater\";", + "+import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "+import defaultMember, * as name from \"alligator\";", + "+import \"arctic-tern\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0c5669ab3e40b0ec94a4b0b5eb1047853c0d51b0..c353ee5864b49a77a5d1952aa1539056122a5b77" +} +,{ + "testCaseDescription": "javascript-import-replacement-insert-test", + "expectedResult": { + "changes": { + "import.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 38 + ] + } + }, + "summary": "Added the defaultMember from \"babirusa\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 37 + ] + } + }, + "summary": "Added the * as otherName from \"baboon\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 34 + ] + } + }, + "summary": "Added the { element } from \"badger\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 50 + ] + } + }, + "summary": "Added the { element1 , element2 } from \"bald-eagle\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 66 + ] + } + }, + "summary": "Added the { element1 , element2 as elementAlias2 } from \"bandicoot\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 78 + ] + } + }, + "summary": "Added the defaultMember, { element1, element2 as elementAlias2 } from \"banteng\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + }, + "summary": "Added the defaultMember, * as element from \"barbet\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 19 + ] + } + }, + "summary": "Added the \"basilisk\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 33 + ] + } + }, + "summary": "Added the defaultMember from \"foo\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 34 + ] + } + }, + "summary": "Added the * as name from \"aardvark\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 30 + ] + } + }, + "summary": "Added the { member } from \"ant\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 46 + ] + } + }, + "summary": "Added the { member1 , member2 } from \"antelope\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 57 + ] + } + }, + "summary": "Added the { member1 , member2 as alias2 } from \"ant-eater\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 70 + ] + } + }, + "summary": "Added the defaultMember, { member1, member2 as alias2 } from \"anaconda\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 50 + ] + } + }, + "summary": "Added the defaultMember, * as name from \"alligator\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 16, + 1 + ], + "end": [ + 16, + 22 + ] + } + }, + "summary": "Added the \"arctic-tern\" import statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 491cb15d..045c536e 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,3 +1,19 @@", + "+import defaultMember from \"babirusa\";", + "+import * as otherName from \"baboon\";", + "+import { element } from \"badger\";", + "+import { element1 , element2 } from \"bald-eagle\";", + "+import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "+import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "+import defaultMember, * as element from \"barbet\";", + "+import \"basilisk\";", + "+import defaultMember from \"foo\";", + "+import * as name from \"aardvark\";", + "+import { member } from \"ant\";", + "+import { member1 , member2 } from \"antelope\";", + "+import { member1 , member2 as alias2 } from \"ant-eater\";", + "+import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "+import defaultMember, * as name from \"alligator\";", + "+import \"arctic-tern\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c353ee5864b49a77a5d1952aa1539056122a5b77..b76f818a0f17ba7cd7e18dacb818766c2f964c21" +} +,{ + "testCaseDescription": "javascript-import-delete-insert-test", + "expectedResult": { + "changes": { + "import.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 37 + ] + }, + { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 32 + ] + } + ] + }, + "summary": "Replaced the \"babirusa\" string with the \"foo\" string in the defaultMember from \"foo\" import statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 28 + ], + "end": [ + 2, + 36 + ] + }, + { + "start": [ + 2, + 23 + ], + "end": [ + 2, + 33 + ] + } + ] + }, + "summary": "Replaced the \"baboon\" string with the \"aardvark\" string in the * as name from \"aardvark\" import statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 13 + ], + "end": [ + 2, + 22 + ] + }, + { + "start": [ + 2, + 13 + ], + "end": [ + 2, + 17 + ] + } + ] + }, + "summary": "Replaced the 'otherName' identifier with the 'name' identifier in the * as name from \"aardvark\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 30 + ] + } + }, + "summary": "Added the { member } from \"ant\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 46 + ] + } + }, + "summary": "Added the { member1 , member2 } from \"antelope\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 57 + ] + } + }, + "summary": "Added the { member1 , member2 as alias2 } from \"ant-eater\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 70 + ] + } + }, + "summary": "Added the defaultMember, { member1, member2 as alias2 } from \"anaconda\" import statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 34 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + ] + }, + "summary": "Replaced the { element } from \"badger\" import statement with the defaultMember, * as name from \"alligator\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 22 + ] + } + }, + "summary": "Added the \"arctic-tern\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 50 + ] + } + }, + "summary": "Deleted the { element1 , element2 } from \"bald-eagle\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 66 + ] + } + }, + "summary": "Deleted the { element1 , element2 as elementAlias2 } from \"bandicoot\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 78 + ] + } + }, + "summary": "Deleted the defaultMember, { element1, element2 as elementAlias2 } from \"banteng\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + }, + "summary": "Deleted the defaultMember, * as element from \"barbet\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 19 + ] + } + }, + "summary": "Deleted the \"basilisk\" import statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 045c536e..cbad5a42 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,11 +1,11 @@", + "-import defaultMember from \"babirusa\";", + "-import * as otherName from \"baboon\";", + "-import { element } from \"badger\";", + "-import { element1 , element2 } from \"bald-eagle\";", + "-import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "-import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "-import defaultMember, * as element from \"barbet\";", + "-import \"basilisk\";", + "+import defaultMember from \"foo\";", + "+import * as name from \"aardvark\";", + "+import { member } from \"ant\";", + "+import { member1 , member2 } from \"antelope\";", + "+import { member1 , member2 as alias2 } from \"ant-eater\";", + "+import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "+import defaultMember, * as name from \"alligator\";", + "+import \"arctic-tern\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b76f818a0f17ba7cd7e18dacb818766c2f964c21..104f40889acb3987c562129b366e4a966b210853" +} +,{ + "testCaseDescription": "javascript-import-replacement-test", + "expectedResult": { + "changes": { + "import.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 32 + ] + }, + { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 37 + ] + } + ] + }, + "summary": "Replaced the \"foo\" string with the \"babirusa\" string in the defaultMember from \"babirusa\" import statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 23 + ], + "end": [ + 2, + 33 + ] + }, + { + "start": [ + 2, + 28 + ], + "end": [ + 2, + 36 + ] + } + ] + }, + "summary": "Replaced the \"aardvark\" string with the \"baboon\" string in the * as otherName from \"baboon\" import statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 13 + ], + "end": [ + 2, + 17 + ] + }, + { + "start": [ + 2, + 13 + ], + "end": [ + 2, + 22 + ] + } + ] + }, + "summary": "Replaced the 'name' identifier with the 'otherName' identifier in the * as otherName from \"baboon\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 34 + ] + } + }, + "summary": "Added the { element } from \"badger\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 50 + ] + } + }, + "summary": "Added the { element1 , element2 } from \"bald-eagle\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 66 + ] + } + }, + "summary": "Added the { element1 , element2 as elementAlias2 } from \"bandicoot\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 78 + ] + } + }, + "summary": "Added the defaultMember, { element1, element2 as elementAlias2 } from \"banteng\" import statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 30 + ] + }, + { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + ] + }, + "summary": "Replaced the { member } from \"ant\" import statement with the defaultMember, * as element from \"barbet\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 19 + ] + } + }, + "summary": "Added the \"basilisk\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 46 + ] + } + }, + "summary": "Deleted the { member1 , member2 } from \"antelope\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 57 + ] + } + }, + "summary": "Deleted the { member1 , member2 as alias2 } from \"ant-eater\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 70 + ] + } + }, + "summary": "Deleted the defaultMember, { member1, member2 as alias2 } from \"anaconda\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + }, + "summary": "Deleted the defaultMember, * as name from \"alligator\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 22 + ] + } + }, + "summary": "Deleted the \"arctic-tern\" import statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index cbad5a42..045c536e 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,11 +1,11 @@", + "-import defaultMember from \"foo\";", + "-import * as name from \"aardvark\";", + "-import { member } from \"ant\";", + "-import { member1 , member2 } from \"antelope\";", + "-import { member1 , member2 as alias2 } from \"ant-eater\";", + "-import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "-import defaultMember, * as name from \"alligator\";", + "-import \"arctic-tern\";", + "+import defaultMember from \"babirusa\";", + "+import * as otherName from \"baboon\";", + "+import { element } from \"badger\";", + "+import { element1 , element2 } from \"bald-eagle\";", + "+import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "+import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "+import defaultMember, * as element from \"barbet\";", + "+import \"basilisk\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "104f40889acb3987c562129b366e4a966b210853..f93cac22cc89b74398857072a9a7fc8dfc14fba2" +} +,{ + "testCaseDescription": "javascript-import-delete-replacement-test", + "expectedResult": { + "changes": { + "import.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 38 + ] + } + }, + "summary": "Deleted the defaultMember from \"babirusa\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 37 + ] + } + }, + "summary": "Deleted the * as otherName from \"baboon\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 34 + ] + } + }, + "summary": "Deleted the { element } from \"badger\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 50 + ] + } + }, + "summary": "Deleted the { element1 , element2 } from \"bald-eagle\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 66 + ] + } + }, + "summary": "Deleted the { element1 , element2 as elementAlias2 } from \"bandicoot\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 78 + ] + } + }, + "summary": "Deleted the defaultMember, { element1, element2 as elementAlias2 } from \"banteng\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + }, + "summary": "Deleted the defaultMember, * as element from \"barbet\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 19 + ] + } + }, + "summary": "Deleted the \"basilisk\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 33 + ] + } + }, + "summary": "Deleted the defaultMember from \"foo\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 34 + ] + } + }, + "summary": "Deleted the * as name from \"aardvark\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 30 + ] + } + }, + "summary": "Deleted the { member } from \"ant\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 46 + ] + } + }, + "summary": "Deleted the { member1 , member2 } from \"antelope\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 57 + ] + } + }, + "summary": "Deleted the { member1 , member2 as alias2 } from \"ant-eater\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 70 + ] + } + }, + "summary": "Deleted the defaultMember, { member1, member2 as alias2 } from \"anaconda\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 50 + ] + } + }, + "summary": "Deleted the defaultMember, * as name from \"alligator\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 16, + 1 + ], + "end": [ + 16, + 22 + ] + } + }, + "summary": "Deleted the \"arctic-tern\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 38 + ] + } + }, + "summary": "Added the defaultMember from \"babirusa\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 37 + ] + } + }, + "summary": "Added the * as otherName from \"baboon\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 34 + ] + } + }, + "summary": "Added the { element } from \"badger\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 50 + ] + } + }, + "summary": "Added the { element1 , element2 } from \"bald-eagle\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 66 + ] + } + }, + "summary": "Added the { element1 , element2 as elementAlias2 } from \"bandicoot\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 78 + ] + } + }, + "summary": "Added the defaultMember, { element1, element2 as elementAlias2 } from \"banteng\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 50 + ] + } + }, + "summary": "Added the defaultMember, * as element from \"barbet\" import statement" + }, + { + "span": { + "insert": { + "start": [ + 16, + 1 + ], + "end": [ + 16, + 19 + ] + } + }, + "summary": "Added the \"basilisk\" import statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 045c536e..873ff752 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,19 +1,3 @@", + "-import defaultMember from \"babirusa\";", + "-import * as otherName from \"baboon\";", + "-import { element } from \"badger\";", + "-import { element1 , element2 } from \"bald-eagle\";", + "-import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "-import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "-import defaultMember, * as element from \"barbet\";", + "-import \"basilisk\";", + "-import defaultMember from \"foo\";", + "-import * as name from \"aardvark\";", + "-import { member } from \"ant\";", + "-import { member1 , member2 } from \"antelope\";", + "-import { member1 , member2 as alias2 } from \"ant-eater\";", + "-import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "-import defaultMember, * as name from \"alligator\";", + "-import \"arctic-tern\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";", + "@@ -22,3 +6,11 @@ import { member1 , member2 as alias2 } from \"ant-eater\";", + " import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + " import defaultMember, * as name from \"alligator\";", + " import \"arctic-tern\";", + "+import defaultMember from \"babirusa\";", + "+import * as otherName from \"baboon\";", + "+import { element } from \"badger\";", + "+import { element1 , element2 } from \"bald-eagle\";", + "+import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "+import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "+import defaultMember, * as element from \"barbet\";", + "+import \"basilisk\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f93cac22cc89b74398857072a9a7fc8dfc14fba2..51369eded60c5198cd53026e12b5228fd321f44f" +} +,{ + "testCaseDescription": "javascript-import-delete-test", + "expectedResult": { + "changes": { + "import.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 33 + ] + } + }, + "summary": "Deleted the defaultMember from \"foo\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 34 + ] + } + }, + "summary": "Deleted the * as name from \"aardvark\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 30 + ] + } + }, + "summary": "Deleted the { member } from \"ant\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 46 + ] + } + }, + "summary": "Deleted the { member1 , member2 } from \"antelope\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 57 + ] + } + }, + "summary": "Deleted the { member1 , member2 as alias2 } from \"ant-eater\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 70 + ] + } + }, + "summary": "Deleted the defaultMember, { member1, member2 as alias2 } from \"anaconda\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + }, + "summary": "Deleted the defaultMember, * as name from \"alligator\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 22 + ] + } + }, + "summary": "Deleted the \"arctic-tern\" import statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 873ff752..db723392 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,11 +1,3 @@", + "-import defaultMember from \"foo\";", + "-import * as name from \"aardvark\";", + "-import { member } from \"ant\";", + "-import { member1 , member2 } from \"antelope\";", + "-import { member1 , member2 as alias2 } from \"ant-eater\";", + "-import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "-import defaultMember, * as name from \"alligator\";", + "-import \"arctic-tern\";", + " import defaultMember from \"babirusa\";", + " import * as otherName from \"baboon\";", + " import { element } from \"badger\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "51369eded60c5198cd53026e12b5228fd321f44f..b63c105d0396476af4f92991effdd80b3bf9724b" +} +,{ + "testCaseDescription": "javascript-import-delete-rest-test", + "expectedResult": { + "changes": { + "import.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 38 + ] + } + }, + "summary": "Deleted the defaultMember from \"babirusa\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 37 + ] + } + }, + "summary": "Deleted the * as otherName from \"baboon\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 34 + ] + } + }, + "summary": "Deleted the { element } from \"badger\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 50 + ] + } + }, + "summary": "Deleted the { element1 , element2 } from \"bald-eagle\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 66 + ] + } + }, + "summary": "Deleted the { element1 , element2 as elementAlias2 } from \"bandicoot\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 78 + ] + } + }, + "summary": "Deleted the defaultMember, { element1, element2 as elementAlias2 } from \"banteng\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 50 + ] + } + }, + "summary": "Deleted the defaultMember, * as element from \"barbet\" import statement" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 19 + ] + } + }, + "summary": "Deleted the \"basilisk\" import statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index db723392..e69de29b 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,8 +0,0 @@", + "-import defaultMember from \"babirusa\";", + "-import * as otherName from \"baboon\";", + "-import { element } from \"badger\";", + "-import { element1 , element2 } from \"bald-eagle\";", + "-import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "-import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "-import defaultMember, * as element from \"barbet\";", + "-import \"basilisk\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b63c105d0396476af4f92991effdd80b3bf9724b..be1bd2dff0107fc60e25707f2c27edec41f646ff" +}] diff --git a/test/corpus/diff-summaries/javascript/math-assignment-operator.json b/test/corpus/diff-summaries/javascript/math-assignment-operator.json new file mode 100644 index 000000000..e17d1f408 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/math-assignment-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-math-assignment-operator-insert-test", + "expectedResult": { + "changes": { + "math-assignment-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'x' math assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index e69de29b..7150d6e7 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -0,0 +1 @@", + "+x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e063f0fd0c7f4b192b39469a0e1641349a596147..59d928b4843289616856e9e8bf8d9946cdad4c7f" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "math-assignment-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'x' math assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'x' math assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 7150d6e7..0bf97e75 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1 +1,3 @@", + "+x += 2;", + "+x += 1;", + " x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "59d928b4843289616856e9e8bf8d9946cdad4c7f..b721ff6fdd741eee50a4a16c42dd5b3bdde368fe" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-insert-test", + "expectedResult": { + "changes": { + "math-assignment-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced '2' with '1' in the x math assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 0bf97e75..ad04937a 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,3 +1,3 @@", + "-x += 2;", + "+x += 1;", + " x += 1;", + " x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b721ff6fdd741eee50a4a16c42dd5b3bdde368fe..e553ba9f63a48658ad19c2fe4cda15ed3ce0fcaa" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-replacement-test", + "expectedResult": { + "changes": { + "math-assignment-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced '1' with '2' in the x math assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index ad04937a..0bf97e75 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,3 +1,3 @@", + "-x += 1;", + "+x += 2;", + " x += 1;", + " x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e553ba9f63a48658ad19c2fe4cda15ed3ce0fcaa..acd95fd371df4275c2f26055683daed7b4673559" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "math-assignment-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x' math assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'x' math assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'x' math assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 0bf97e75..71275450 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,3 +1,2 @@", + "-x += 2;", + "-x += 1;", + " x += 1;", + "+x += 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "acd95fd371df4275c2f26055683daed7b4673559..7ebc730f67a3cf517e1dd456ee48c2d32a2f2174" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-test", + "expectedResult": { + "changes": { + "math-assignment-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x' math assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 71275450..94d14722 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,2 +1 @@", + "-x += 1;", + " x += 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7ebc730f67a3cf517e1dd456ee48c2d32a2f2174..cd61146f65a5144b9b5d176204cc8793757b1963" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-rest-test", + "expectedResult": { + "changes": { + "math-assignment-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x' math assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 94d14722..e69de29b 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1 +0,0 @@", + "-x += 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cd61146f65a5144b9b5d176204cc8793757b1963..f2eb239be06cc6a99d83ff77dc9852645f8a006b" +}] diff --git a/test/corpus/diff-summaries/javascript/math-operator.json b/test/corpus/diff-summaries/javascript/math-operator.json new file mode 100644 index 000000000..d352285d3 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/math-operator.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-math-operator-insert-test", + "expectedResult": { + "changes": { + "math-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'i + j * 3 - j % 5' math operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index e69de29b..03446677 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -0,0 +1 @@", + "+i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0418e8cf18ec4ace51cecc0070ed205313e92ac2..e931b75067441dea85e8d8cc511914b06963c019" +} +,{ + "testCaseDescription": "javascript-math-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "math-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'i + j * 2 - j % 4' math operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 18 + ] + } + }, + "summary": "Added the 'i + j * 3 - j % 5' math operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 03446677..79f5f20c 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1 +1,3 @@", + "+i + j * 2 - j % 4;", + "+i + j * 3 - j % 5;", + " i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e931b75067441dea85e8d8cc511914b06963c019..41aadd5ed24ead1d8cfed0f50c9b94bf53fd46d6" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-insert-test", + "expectedResult": { + "changes": { + "math-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + }, + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + ] + }, + "summary": "Replaced '2' with '3'" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 18 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 18 + ] + } + ] + }, + "summary": "Replaced '4' with '5'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 79f5f20c..284561c5 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,3 +1,3 @@", + "-i + j * 2 - j % 4;", + "+i + j * 3 - j % 5;", + " i + j * 3 - j % 5;", + " i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "41aadd5ed24ead1d8cfed0f50c9b94bf53fd46d6..df7ea23068df1b6b1cf2f08fad16caaf5d46fefc" +} +,{ + "testCaseDescription": "javascript-math-operator-replacement-test", + "expectedResult": { + "changes": { + "math-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + }, + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + ] + }, + "summary": "Replaced '3' with '2'" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 18 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 18 + ] + } + ] + }, + "summary": "Replaced '5' with '4'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 284561c5..79f5f20c 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,3 +1,3 @@", + "-i + j * 3 - j % 5;", + "+i + j * 2 - j % 4;", + " i + j * 3 - j % 5;", + " i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "df7ea23068df1b6b1cf2f08fad16caaf5d46fefc..9d073a688fa23ea66f4468ed28a10bfa165dd9b1" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "math-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'i + j * 2 - j % 4' math operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 18 + ] + } + }, + "summary": "Deleted the 'i + j * 3 - j % 5' math operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 18 + ] + } + }, + "summary": "Added the 'i + j * 2 - j % 4' math operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 79f5f20c..d1055f77 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,3 +1,2 @@", + "-i + j * 2 - j % 4;", + "-i + j * 3 - j % 5;", + " i + j * 3 - j % 5;", + "+i + j * 2 - j % 4;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9d073a688fa23ea66f4468ed28a10bfa165dd9b1..9e5f2045b4f95e3bc8348c1748d638d4e38960ea" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-test", + "expectedResult": { + "changes": { + "math-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'i + j * 3 - j % 5' math operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index d1055f77..79ba2b3f 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,2 +1 @@", + "-i + j * 3 - j % 5;", + " i + j * 2 - j % 4;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9e5f2045b4f95e3bc8348c1748d638d4e38960ea..1c13b3a5d6e0787ed69116e4cebb1115366a8f21" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-rest-test", + "expectedResult": { + "changes": { + "math-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'i + j * 2 - j % 4' math operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 79ba2b3f..e69de29b 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1 +0,0 @@", + "-i + j * 2 - j % 4;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1c13b3a5d6e0787ed69116e4cebb1115366a8f21..60e56ee717443319fd06b7b25a02393835ad25e4" +}] diff --git a/test/corpus/diff-summaries/javascript/member-access-assignment.json b/test/corpus/diff-summaries/javascript/member-access-assignment.json new file mode 100644 index 000000000..f66a13135 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/member-access-assignment.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-member-access-assignment-insert-test", + "expectedResult": { + "changes": { + "member-access-assignment.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'y.x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index e69de29b..7a99e309 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -0,0 +1 @@", + "+y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "02c7c57f6900a26076acb665ba4fc51a55fc79db..dcb111ad800e0ef13a9d25afb0df15b85a4af7f4" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-replacement-insert-test", + "expectedResult": { + "changes": { + "member-access-assignment.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'y.x' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'y.x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 7a99e309..32040068 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1 +1,3 @@", + "+y.x = 1;", + "+y.x = 0;", + " y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dcb111ad800e0ef13a9d25afb0df15b85a4af7f4..111fb2a07e2c44c853d1043081d6c01dc35d7b52" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-insert-test", + "expectedResult": { + "changes": { + "member-access-assignment.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced '1' with '0' in an assignment to y.x" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 32040068..94893a32 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y.x = 1;", + "+y.x = 0;", + " y.x = 0;", + " y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "111fb2a07e2c44c853d1043081d6c01dc35d7b52..b2fa2205d78e4eed99ec8646f82b3546e5a63f61" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-replacement-test", + "expectedResult": { + "changes": { + "member-access-assignment.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced '0' with '1' in an assignment to y.x" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 94893a32..32040068 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y.x = 0;", + "+y.x = 1;", + " y.x = 0;", + " y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b2fa2205d78e4eed99ec8646f82b3546e5a63f61..af9ba3a3f5cc6ba22e4136dc9829bb0313bd851c" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-replacement-test", + "expectedResult": { + "changes": { + "member-access-assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'y.x' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Deleted the 'y.x' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'y.x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 32040068..8d78a24f 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,3 +1,2 @@", + "-y.x = 1;", + "-y.x = 0;", + " y.x = 0;", + "+y.x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "af9ba3a3f5cc6ba22e4136dc9829bb0313bd851c..cb3945414365ac621dd6beef922186250074a2e3" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-test", + "expectedResult": { + "changes": { + "member-access-assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'y.x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 8d78a24f..799018d0 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,2 +1 @@", + "-y.x = 0;", + " y.x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cb3945414365ac621dd6beef922186250074a2e3..1fa661beacf3ac34a701bd04508b2cc4c9a5b27d" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-rest-test", + "expectedResult": { + "changes": { + "member-access-assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'y.x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 799018d0..e69de29b 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1 +0,0 @@", + "-y.x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1fa661beacf3ac34a701bd04508b2cc4c9a5b27d..c19769fba6e7c7042d1ab1915c3f9bb20d569e22" +}] diff --git a/test/corpus/diff-summaries/javascript/member-access.json b/test/corpus/diff-summaries/javascript/member-access.json new file mode 100644 index 000000000..6b48082d7 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/member-access.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-member-access-insert-test", + "expectedResult": { + "changes": { + "member-access.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the 'x.someProperty' member access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index e69de29b..3c837c9a 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -0,0 +1 @@", + "+x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "545e1f49b6e82b725cda79df3dea34555ffa1d7c..1d85812b95b56a1c7c862073890d7166d0238a6d" +} +,{ + "testCaseDescription": "javascript-member-access-replacement-insert-test", + "expectedResult": { + "changes": { + "member-access.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Added the 'x.someOtherProperty' member access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Added the 'x.someProperty' member access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 3c837c9a..858131af 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1 +1,3 @@", + "+x.someOtherProperty", + "+x.someProperty;", + " x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1d85812b95b56a1c7c862073890d7166d0238a6d..67e0cab67998526c3e57878de74f6b5e9595dcc8" +} +,{ + "testCaseDescription": "javascript-member-access-delete-insert-test", + "expectedResult": { + "changes": { + "member-access.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 20 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced the 'someOtherProperty' identifier with the 'someProperty' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 858131af..5ed8a8d2 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,3 +1,3 @@", + "-x.someOtherProperty", + "+x.someProperty;", + " x.someProperty;", + " x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "67e0cab67998526c3e57878de74f6b5e9595dcc8..df2400e47caf131a690aee596165efd80632b006" +} +,{ + "testCaseDescription": "javascript-member-access-replacement-test", + "expectedResult": { + "changes": { + "member-access.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 20 + ] + } + ] + }, + "summary": "Replaced the 'someProperty' identifier with the 'someOtherProperty' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 5ed8a8d2..858131af 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,3 +1,3 @@", + "-x.someProperty;", + "+x.someOtherProperty", + " x.someProperty;", + " x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "df2400e47caf131a690aee596165efd80632b006..9e8022c2da048071b316908f37d16865e0e16d31" +} +,{ + "testCaseDescription": "javascript-member-access-delete-replacement-test", + "expectedResult": { + "changes": { + "member-access.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Deleted the 'x.someOtherProperty' member access" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Deleted the 'x.someProperty' member access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 20 + ] + } + }, + "summary": "Added the 'x.someOtherProperty' member access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 858131af..81f5f468 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,3 +1,2 @@", + "-x.someOtherProperty", + "-x.someProperty;", + " x.someProperty;", + "+x.someOtherProperty" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9e8022c2da048071b316908f37d16865e0e16d31..95a9da83b61ad889f0935ca30e4d9d9648418edb" +} +,{ + "testCaseDescription": "javascript-member-access-delete-test", + "expectedResult": { + "changes": { + "member-access.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'x.someProperty' member access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 81f5f468..8329c770 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,2 +1 @@", + "-x.someProperty;", + " x.someOtherProperty" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "95a9da83b61ad889f0935ca30e4d9d9648418edb..e4a6b0b20943de7a301427a59c8df352956ccde7" +} +,{ + "testCaseDescription": "javascript-member-access-delete-rest-test", + "expectedResult": { + "changes": { + "member-access.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Deleted the 'x.someOtherProperty' member access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 8329c770..e69de29b 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1 +0,0 @@", + "-x.someOtherProperty" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e4a6b0b20943de7a301427a59c8df352956ccde7..ec6eea34d7c86b61e0a52fbb0b8041553b1d5af7" +}] diff --git a/test/corpus/diff-summaries/javascript/method-call.json b/test/corpus/diff-summaries/javascript/method-call.json new file mode 100644 index 000000000..06963246d --- /dev/null +++ b/test/corpus/diff-summaries/javascript/method-call.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-method-call-insert-test", + "expectedResult": { + "changes": { + "method-call.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Added the 'object.someMethod(arg1, \"arg2\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index e69de29b..07ab90c6 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -0,0 +1 @@", + "+object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2d43584fc8ddc7ca7298a1e0e0a9be013b19f0be..2bbcf16bcb88f302ddaca7d109943bba84599b95" +} +,{ + "testCaseDescription": "javascript-method-call-replacement-insert-test", + "expectedResult": { + "changes": { + "method-call.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Added the 'object.someMethod(arg1, \"arg3\")' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Added the 'object.someMethod(arg1, \"arg2\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 07ab90c6..9341e175 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1 +1,3 @@", + "+object.someMethod(arg1, \"arg3\");", + "+object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2bbcf16bcb88f302ddaca7d109943bba84599b95..e3fe295d1f47af91098115364ebdc6dd4ff9e6b1" +} +,{ + "testCaseDescription": "javascript-method-call-delete-insert-test", + "expectedResult": { + "changes": { + "method-call.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 31 + ] + }, + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 31 + ] + } + ] + }, + "summary": "Replaced the \"arg3\" string with the \"arg2\" string in the object.someMethod(arg1, \"arg2\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 9341e175..f6ada2d1 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,3 +1,3 @@", + "-object.someMethod(arg1, \"arg3\");", + "+object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e3fe295d1f47af91098115364ebdc6dd4ff9e6b1..4010e66029f1b973951d3703b7dec8adf14b1ab1" +} +,{ + "testCaseDescription": "javascript-method-call-replacement-test", + "expectedResult": { + "changes": { + "method-call.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 31 + ] + }, + { + "start": [ + 1, + 25 + ], + "end": [ + 1, + 31 + ] + } + ] + }, + "summary": "Replaced the \"arg2\" string with the \"arg3\" string in the object.someMethod(arg1, \"arg3\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index f6ada2d1..9341e175 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,3 +1,3 @@", + "-object.someMethod(arg1, \"arg2\");", + "+object.someMethod(arg1, \"arg3\");", + " object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4010e66029f1b973951d3703b7dec8adf14b1ab1..c2d8c113478796e6c6f32362271a715706bd134e" +} +,{ + "testCaseDescription": "javascript-method-call-delete-replacement-test", + "expectedResult": { + "changes": { + "method-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted the 'object.someMethod(arg1, \"arg3\")' function call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Deleted the 'object.someMethod(arg1, \"arg2\")' function call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Added the 'object.someMethod(arg1, \"arg3\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 9341e175..894dcf66 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,3 +1,2 @@", + "-object.someMethod(arg1, \"arg3\");", + "-object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");", + "+object.someMethod(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c2d8c113478796e6c6f32362271a715706bd134e..6924af1b5a822155552d2cca2fd7e382a225df77" +} +,{ + "testCaseDescription": "javascript-method-call-delete-test", + "expectedResult": { + "changes": { + "method-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted the 'object.someMethod(arg1, \"arg2\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 894dcf66..a82528c8 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,2 +1 @@", + "-object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6924af1b5a822155552d2cca2fd7e382a225df77..9b85d12b2c7ae6d1352534cd00506196925c7962" +} +,{ + "testCaseDescription": "javascript-method-call-delete-rest-test", + "expectedResult": { + "changes": { + "method-call.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted the 'object.someMethod(arg1, \"arg3\")' function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index a82528c8..e69de29b 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1 +0,0 @@", + "-object.someMethod(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9b85d12b2c7ae6d1352534cd00506196925c7962..a1cfaadb31d0f0d28d7449d160ba2ed06ec9c6af" +}] diff --git a/test/corpus/diff-summaries/javascript/named-function.json b/test/corpus/diff-summaries/javascript/named-function.json new file mode 100644 index 000000000..29634ac6e --- /dev/null +++ b/test/corpus/diff-summaries/javascript/named-function.json @@ -0,0 +1,467 @@ +[{ + "testCaseDescription": "javascript-named-function-insert-test", + "expectedResult": { + "changes": { + "named-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Added the 'myFunction' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index e69de29b..94b19f8e 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -0,0 +1 @@", + "+function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "15e84394f61437f6604f6255ce0c5d818ac3115f..6ea0687fb3c4a13e7c6c685859d2ef572a7cf2a4" +} +,{ + "testCaseDescription": "javascript-named-function-replacement-insert-test", + "expectedResult": { + "changes": { + "named-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Added the 'anotherFunction' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 42 + ] + } + }, + "summary": "Added the 'myFunction' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index 94b19f8e..cb766a0e 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1 +1,3 @@", + "+function anotherFunction() { return false; };", + "+function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6ea0687fb3c4a13e7c6c685859d2ef572a7cf2a4..65845b7ccc455c2a3e7ec8c12c7c7715176e6132" +} +,{ + "testCaseDescription": "javascript-named-function-delete-insert-test", + "expectedResult": { + "changes": { + "named-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 25 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 20 + ] + } + ] + }, + "summary": "Replaced the 'anotherFunction' identifier with the 'myFunction' identifier in the myFunction function" + }, + { + "span": { + "insert": { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 25 + ] + } + }, + "summary": "Added the 'arg1' identifier in the myFunction function" + }, + { + "span": { + "insert": { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Added the 'arg2' identifier in the myFunction function" + }, + { + "span": { + "insert": { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Added the 'arg2' identifier in the myFunction function" + }, + { + "span": { + "delete": { + "start": [ + 1, + 30 + ], + "end": [ + 1, + 43 + ] + } + }, + "summary": "Deleted the 'false' return statement in the myFunction function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index cb766a0e..c9cff077 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,3 +1,3 @@", + "-function anotherFunction() { return false; };", + "+function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "65845b7ccc455c2a3e7ec8c12c7c7715176e6132..3ce6b2ab8b35de5577106e7225b24b0cf9578f35" +} +,{ + "testCaseDescription": "javascript-named-function-replacement-test", + "expectedResult": { + "changes": { + "named-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 20 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 25 + ] + } + ] + }, + "summary": "Replaced the 'myFunction' identifier with the 'anotherFunction' identifier in the anotherFunction function" + }, + { + "span": { + "delete": { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 25 + ] + } + }, + "summary": "Deleted the 'arg1' identifier in the anotherFunction function" + }, + { + "span": { + "delete": { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Deleted the 'arg2' identifier in the anotherFunction function" + }, + { + "span": { + "insert": { + "start": [ + 1, + 30 + ], + "end": [ + 1, + 43 + ] + } + }, + "summary": "Added the 'false' return statement in the anotherFunction function" + }, + { + "span": { + "delete": { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the 'arg2' identifier in the anotherFunction function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index c9cff077..cb766a0e 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,3 +1,3 @@", + "-function myFunction(arg1, arg2) { arg2; };", + "+function anotherFunction() { return false; };", + " function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3ce6b2ab8b35de5577106e7225b24b0cf9578f35..a9a7b0743ebf205eff6b6462782fb52db98f1b16" +} +,{ + "testCaseDescription": "javascript-named-function-delete-replacement-test", + "expectedResult": { + "changes": { + "named-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Deleted the 'anotherFunction' function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 42 + ] + } + }, + "summary": "Deleted the 'myFunction' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 45 + ] + } + }, + "summary": "Added the 'anotherFunction' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index cb766a0e..148bcc77 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,3 +1,2 @@", + "-function anotherFunction() { return false; };", + "-function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };", + "+function anotherFunction() { return false; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a9a7b0743ebf205eff6b6462782fb52db98f1b16..db026024213543071e836f01b6a09784e5d35237" +} +,{ + "testCaseDescription": "javascript-named-function-delete-test", + "expectedResult": { + "changes": { + "named-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Deleted the 'myFunction' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index 148bcc77..80e11b02 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,2 +1 @@", + "-function myFunction(arg1, arg2) { arg2; };", + " function anotherFunction() { return false; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "db026024213543071e836f01b6a09784e5d35237..74e974f29677930c7734e2d5735cc2b42bf39214" +} +,{ + "testCaseDescription": "javascript-named-function-delete-rest-test", + "expectedResult": { + "changes": { + "named-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Deleted the 'anotherFunction' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index 80e11b02..e69de29b 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1 +0,0 @@", + "-function anotherFunction() { return false; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "74e974f29677930c7734e2d5735cc2b42bf39214..545e1f49b6e82b725cda79df3dea34555ffa1d7c" +}] diff --git a/test/corpus/diff-summaries/javascript/nested-do-while-in-function.json b/test/corpus/diff-summaries/javascript/nested-do-while-in-function.json new file mode 100644 index 000000000..025766844 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/nested-do-while-in-function.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-nested-do-while-in-function-insert-test", + "expectedResult": { + "changes": { + "nested-do-while-in-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 65 + ] + } + }, + "summary": "Added the 'f' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index e69de29b..d205614e 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -0,0 +1 @@", + "+function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0f9353e629ed1d4b50861305cd28aa9667f15b4a..ee19f268662c3911fec89c4454037b9f5ac4cc7c" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-replacement-insert-test", + "expectedResult": { + "changes": { + "nested-do-while-in-function.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 65 + ] + } + }, + "summary": "Added the 'f' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 65 + ] + } + }, + "summary": "Added the 'f' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index d205614e..5dfcca69 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1 +1,3 @@", + "+function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + "+function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ee19f268662c3911fec89c4454037b9f5ac4cc7c..ede2541397ede9a83a53a0929e7088ddbd01d8a4" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-insert-test", + "expectedResult": { + "changes": { + "nested-do-while-in-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + }, + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + } + ] + }, + "summary": "Replaced the 'arg2' identifier with the 'arg1' identifier in the something(arg1) function call of the 'f' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 57 + ], + "end": [ + 1, + 61 + ] + }, + { + "start": [ + 1, + 57 + ], + "end": [ + 1, + 61 + ] + } + ] + }, + "summary": "Replaced the 'arg1' identifier with the 'arg2' identifier in the arg2 do/while statement of the 'f' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 5dfcca69..49cff7e6 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,3 +1,3 @@", + "-function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + "+function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ede2541397ede9a83a53a0929e7088ddbd01d8a4..d8dc1f46228c9f0f48640548bb42615aa26c00e8" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-replacement-test", + "expectedResult": { + "changes": { + "nested-do-while-in-function.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + }, + { + "start": [ + 1, + 41 + ], + "end": [ + 1, + 45 + ] + } + ] + }, + "summary": "Replaced the 'arg1' identifier with the 'arg2' identifier in the something(arg2) function call of the 'f' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 57 + ], + "end": [ + 1, + 61 + ] + }, + { + "start": [ + 1, + 57 + ], + "end": [ + 1, + 61 + ] + } + ] + }, + "summary": "Replaced the 'arg2' identifier with the 'arg1' identifier in the arg1 do/while statement of the 'f' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 49cff7e6..5dfcca69 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,3 +1,3 @@", + "-function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + "+function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d8dc1f46228c9f0f48640548bb42615aa26c00e8..27b3672918c4d202ab57a62658c715a7ffe24a72" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-replacement-test", + "expectedResult": { + "changes": { + "nested-do-while-in-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 65 + ] + } + }, + "summary": "Deleted the 'f' function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 65 + ] + } + }, + "summary": "Deleted the 'f' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 65 + ] + } + }, + "summary": "Added the 'f' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 5dfcca69..babb1e64 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,3 +1,2 @@", + "-function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + "-function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + "+function f(arg1, arg2) { do { something(arg2); } while (arg1); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "27b3672918c4d202ab57a62658c715a7ffe24a72..a98f8cbc1a27c923c69b91a16e665661d99b278b" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-test", + "expectedResult": { + "changes": { + "nested-do-while-in-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 65 + ] + } + }, + "summary": "Deleted the 'f' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index babb1e64..2b155808 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,2 +1 @@", + "-function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg2); } while (arg1); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a98f8cbc1a27c923c69b91a16e665661d99b278b..2178857dfccf14e6705a2d50e6824cb61f69164a" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-rest-test", + "expectedResult": { + "changes": { + "nested-do-while-in-function.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 65 + ] + } + }, + "summary": "Deleted the 'f' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 2b155808..e69de29b 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1 +0,0 @@", + "-function f(arg1, arg2) { do { something(arg2); } while (arg1); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2178857dfccf14e6705a2d50e6824cb61f69164a..0c5669ab3e40b0ec94a4b0b5eb1047853c0d51b0" +}] diff --git a/test/corpus/diff-summaries/javascript/nested-functions.json b/test/corpus/diff-summaries/javascript/nested-functions.json new file mode 100644 index 000000000..9dea864ac --- /dev/null +++ b/test/corpus/diff-summaries/javascript/nested-functions.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-nested-functions-insert-test", + "expectedResult": { + "changes": { + "nested-functions.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 103 + ] + } + }, + "summary": "Added the 'parent' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index e69de29b..72531d81 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -0,0 +1 @@", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d03236f8517c53c78b398fe3778c8170b54e36ea..1662b1dfc6d38616da1fff5ad7e6ee911a77e534" +} +,{ + "testCaseDescription": "javascript-nested-functions-replacement-insert-test", + "expectedResult": { + "changes": { + "nested-functions.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 103 + ] + } + }, + "summary": "Added the 'parent' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 103 + ] + } + }, + "summary": "Added the 'parent' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 72531d81..c960aae1 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1 +1,3 @@", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1662b1dfc6d38616da1fff5ad7e6ee911a77e534..89e96daa71a3e9aeae51bf3d823785ae65027678" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-insert-test", + "expectedResult": { + "changes": { + "nested-functions.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 74 + ], + "end": [ + 1, + 78 + ] + }, + { + "start": [ + 1, + 74 + ], + "end": [ + 1, + 78 + ] + } + ] + }, + "summary": "Replaced the 'arg1' identifier with the 'arg3' identifier in the console.log(arg3) function call of the 'child' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 93 + ], + "end": [ + 1, + 97 + ] + }, + { + "start": [ + 1, + 93 + ], + "end": [ + 1, + 97 + ] + } + ] + }, + "summary": "Replaced the 'arg2' identifier with the 'arg4' identifier in the console.log(arg4) function call of the 'child' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index c960aae1..1b9b61a3 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,3 +1,3 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "89e96daa71a3e9aeae51bf3d823785ae65027678..c3d4bd3343b7ebd88669f53728aa459003a0dbe2" +} +,{ + "testCaseDescription": "javascript-nested-functions-replacement-test", + "expectedResult": { + "changes": { + "nested-functions.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 74 + ], + "end": [ + 1, + 78 + ] + }, + { + "start": [ + 1, + 74 + ], + "end": [ + 1, + 78 + ] + } + ] + }, + "summary": "Replaced the 'arg3' identifier with the 'arg1' identifier in the console.log(arg1) function call of the 'child' function" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 93 + ], + "end": [ + 1, + 97 + ] + }, + { + "start": [ + 1, + 93 + ], + "end": [ + 1, + 97 + ] + } + ] + }, + "summary": "Replaced the 'arg4' identifier with the 'arg2' identifier in the console.log(arg2) function call of the 'child' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 1b9b61a3..c960aae1 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,3 +1,3 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c3d4bd3343b7ebd88669f53728aa459003a0dbe2..767e6169749beb378d262e0c0c5995dd4d3750de" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-replacement-test", + "expectedResult": { + "changes": { + "nested-functions.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 103 + ] + } + }, + "summary": "Deleted the 'parent' function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 103 + ] + } + }, + "summary": "Deleted the 'parent' function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 103 + ] + } + }, + "summary": "Added the 'parent' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index c960aae1..81522c7d 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,3 +1,2 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "767e6169749beb378d262e0c0c5995dd4d3750de..18cd0d93c09a6f185e1f8f5b7ad1aa23e6b067bc" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-test", + "expectedResult": { + "changes": { + "nested-functions.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 103 + ] + } + }, + "summary": "Deleted the 'parent' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 81522c7d..30564800 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,2 +1 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "18cd0d93c09a6f185e1f8f5b7ad1aa23e6b067bc..2380a4af99f945cf851c2a6ffc333adae28ec1a9" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-rest-test", + "expectedResult": { + "changes": { + "nested-functions.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 103 + ] + } + }, + "summary": "Deleted the 'parent' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 30564800..e69de29b 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1 +0,0 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2380a4af99f945cf851c2a6ffc333adae28ec1a9..0f9353e629ed1d4b50861305cd28aa9667f15b4a" +}] diff --git a/test/corpus/diff-summaries/javascript/null.json b/test/corpus/diff-summaries/javascript/null.json new file mode 100644 index 000000000..ca6047848 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/null.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "javascript-null-insert-test", + "expectedResult": { + "changes": { + "null.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'null' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index e69de29b..ff464d15 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -0,0 +1 @@", + "+null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c41b2f9fe0dffe03f83ea0599b2f5fd18a1292a7..18139ee9c6e54664b4d4b5cf6cf0745c941bd15b" +} +,{ + "testCaseDescription": "javascript-null-replacement-insert-test", + "expectedResult": { + "changes": { + "null.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'null' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Added the 'null' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index ff464d15..2d3c3e03 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1 +1,3 @@", + "+return null;", + "+null;", + " null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "18139ee9c6e54664b4d4b5cf6cf0745c941bd15b..612cb0b885b5327b4216f58881116af806208992" +} +,{ + "testCaseDescription": "javascript-null-delete-insert-test", + "expectedResult": { + "changes": { + "null.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'null' identifier" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'null' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 2d3c3e03..3122897c 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,3 +1,3 @@", + "-return null;", + "+null;", + " null;", + " null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "612cb0b885b5327b4216f58881116af806208992..92332e2bee9ed58c9a9f3afcbf1f3cb794a85fe8" +} +,{ + "testCaseDescription": "javascript-null-replacement-test", + "expectedResult": { + "changes": { + "null.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'null' return statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'null' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 3122897c..2d3c3e03 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,3 +1,3 @@", + "-null;", + "+return null;", + " null;", + " null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "92332e2bee9ed58c9a9f3afcbf1f3cb794a85fe8..f55eef39ebe93820de6b591648d562c2cc6576cb" +} +,{ + "testCaseDescription": "javascript-null-delete-replacement-test", + "expectedResult": { + "changes": { + "null.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'null' return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Deleted the 'null' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the 'null' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 2d3c3e03..0eb99c86 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,3 +1,2 @@", + "-return null;", + "-null;", + " null;", + "+return null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f55eef39ebe93820de6b591648d562c2cc6576cb..40b8cea69b00672cf1932dc403a29d41bfcd77ef" +} +,{ + "testCaseDescription": "javascript-null-delete-test", + "expectedResult": { + "changes": { + "null.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'null' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 0eb99c86..76137ff0 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,2 +1 @@", + "-null;", + " return null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "40b8cea69b00672cf1932dc403a29d41bfcd77ef..7f98ec33735046c6e971f7085277629b43d91027" +} +,{ + "testCaseDescription": "javascript-null-delete-rest-test", + "expectedResult": { + "changes": { + "null.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'null' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 76137ff0..e69de29b 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1 +0,0 @@", + "-return null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7f98ec33735046c6e971f7085277629b43d91027..96b0b5fed694b8dcfb0566309faee71cfdf4dd60" +}] diff --git a/test/corpus/diff-summaries/javascript/number.json b/test/corpus/diff-summaries/javascript/number.json new file mode 100644 index 000000000..fdf9e82f2 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/number.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-number-insert-test", + "expectedResult": { + "changes": { + "number.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added '101'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index e69de29b..398050c6 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -0,0 +1 @@", + "+101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a721bbb02349218f8c3e5c1b8dff9b250d206fa5..e667b73ca854f58d4845ad175536c28f3da2e510" +} +,{ + "testCaseDescription": "javascript-number-replacement-insert-test", + "expectedResult": { + "changes": { + "number.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added '102'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added '101'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 398050c6..16da476c 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1 +1,3 @@", + "+102", + "+101", + " 101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e667b73ca854f58d4845ad175536c28f3da2e510..08aa6df3c760a024f1751290b95883fa444d3eb0" +} +,{ + "testCaseDescription": "javascript-number-delete-insert-test", + "expectedResult": { + "changes": { + "number.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + ] + }, + "summary": "Replaced '102' with '101'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 16da476c..252b3e84 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,3 +1,3 @@", + "-102", + "+101", + " 101", + " 101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "08aa6df3c760a024f1751290b95883fa444d3eb0..8334896eb44c3b974205a8f46531e4e159ef1504" +} +,{ + "testCaseDescription": "javascript-number-replacement-test", + "expectedResult": { + "changes": { + "number.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + ] + }, + "summary": "Replaced '101' with '102'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 252b3e84..16da476c 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,3 +1,3 @@", + "-101", + "+102", + " 101", + " 101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8334896eb44c3b974205a8f46531e4e159ef1504..04ceb913032a5f0b27fcdf436fb725891f846148" +} +,{ + "testCaseDescription": "javascript-number-delete-replacement-test", + "expectedResult": { + "changes": { + "number.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted '102'" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted '101'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added '102'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 16da476c..bb77dfbd 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,3 +1,2 @@", + "-102", + "-101", + " 101", + "+102" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "04ceb913032a5f0b27fcdf436fb725891f846148..377c9a2a7c7fe0296d90796cb0587e41b24c82df" +} +,{ + "testCaseDescription": "javascript-number-delete-test", + "expectedResult": { + "changes": { + "number.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted '101'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index bb77dfbd..257e5632 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,2 +1 @@", + "-101", + " 102" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "377c9a2a7c7fe0296d90796cb0587e41b24c82df..71c7b760bba28eadc1ae08039b3c40c12c65fef7" +} +,{ + "testCaseDescription": "javascript-number-delete-rest-test", + "expectedResult": { + "changes": { + "number.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted '102'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 257e5632..e69de29b 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1 +0,0 @@", + "-102" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "71c7b760bba28eadc1ae08039b3c40c12c65fef7..efab78a691fb93905e88ae443c8324acedc55608" +}] diff --git a/test/corpus/diff-summaries/javascript/object.json b/test/corpus/diff-summaries/javascript/object.json new file mode 100644 index 000000000..9cad4ed60 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/object.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "javascript-object-insert-test", + "expectedResult": { + "changes": { + "object.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the '{ \"key1\": \"value1\" }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index e69de29b..fe17bb20 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -0,0 +1 @@", + "+{ \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "abce7caf7e67e197076f10ee997f4a8e08480f93..c701fcab47a5cfe81c6c44a415e62429d18668ec" +} +,{ + "testCaseDescription": "javascript-object-replacement-insert-test", + "expectedResult": { + "changes": { + "object.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 54 + ] + } + }, + "summary": "Added the '{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" }' object" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Added the '{ \"key1\": \"value1\" }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index fe17bb20..741c3dc1 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1 +1,3 @@", + "+{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + "+{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c701fcab47a5cfe81c6c44a415e62429d18668ec..c2fc8a1697fb233aacff9572aa9e3cf0ad8bf9df" +} +,{ + "testCaseDescription": "javascript-object-delete-insert-test", + "expectedResult": { + "changes": { + "object.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 37 + ] + } + }, + "summary": "Deleted the '\"key2\": \"value2\"' pair" + }, + { + "span": { + "delete": { + "start": [ + 1, + 39 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Deleted the '\"key3\": \"3.0\"' pair" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 741c3dc1..701239d4 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,3 +1,3 @@", + "-{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + "+{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c2fc8a1697fb233aacff9572aa9e3cf0ad8bf9df..ad2eb5f77d0a45ac8677301606605b3e888da0c9" +} +,{ + "testCaseDescription": "javascript-object-replacement-test", + "expectedResult": { + "changes": { + "object.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 37 + ] + } + }, + "summary": "Added the '\"key2\": \"value2\"' pair" + }, + { + "span": { + "insert": { + "start": [ + 1, + 39 + ], + "end": [ + 1, + 52 + ] + } + }, + "summary": "Added the '\"key3\": \"3.0\"' pair" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 701239d4..741c3dc1 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,3 +1,3 @@", + "-{ \"key1\": \"value1\" };", + "+{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + " { \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ad2eb5f77d0a45ac8677301606605b3e888da0c9..143cab3431df1bf47a955baa7bf491ad034f698b" +} +,{ + "testCaseDescription": "javascript-object-delete-replacement-test", + "expectedResult": { + "changes": { + "object.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 54 + ] + } + }, + "summary": "Deleted the '{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" }' object" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Deleted the '{ \"key1\": \"value1\" }' object" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 54 + ] + } + }, + "summary": "Added the '{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 741c3dc1..9e482739 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,3 +1,2 @@", + "-{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + "-{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };", + "+{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "143cab3431df1bf47a955baa7bf491ad034f698b..a32d14229ed7d51190835ad936015498e5bcd9b4" +} +,{ + "testCaseDescription": "javascript-object-delete-test", + "expectedResult": { + "changes": { + "object.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the '{ \"key1\": \"value1\" }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 9e482739..12d063ad 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,2 +1 @@", + "-{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a32d14229ed7d51190835ad936015498e5bcd9b4..918bb4a152604b1dbd7b91ec5c16c82cce2f1377" +} +,{ + "testCaseDescription": "javascript-object-delete-rest-test", + "expectedResult": { + "changes": { + "object.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 54 + ] + } + }, + "summary": "Deleted the '{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 12d063ad..e69de29b 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1 +0,0 @@", + "-{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "918bb4a152604b1dbd7b91ec5c16c82cce2f1377..784daea9abe5781b5fb045bca826f00e058b0b62" +}] diff --git a/test/corpus/diff-summaries/javascript/objects-with-methods.json b/test/corpus/diff-summaries/javascript/objects-with-methods.json new file mode 100644 index 000000000..0c44d0a63 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/objects-with-methods.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-objects-with-methods-insert-test", + "expectedResult": { + "changes": { + "objects-with-methods.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Added the '{ add(a, b) }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index e69de29b..7421e188 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -0,0 +1 @@", + "+{ add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4dbddbfa6c4e016d944aa6ee8ef1acfb4be38af8..14c10158adabf9babb425807cc5a87091d13a4e2" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-replacement-insert-test", + "expectedResult": { + "changes": { + "objects-with-methods.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 37 + ] + } + }, + "summary": "Added the '{ subtract(a, b) }' object" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Added the '{ add(a, b) }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 7421e188..59eb3a3d 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1 +1,3 @@", + "+{ subtract(a, b) { return a - b; } };", + "+{ add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "14c10158adabf9babb425807cc5a87091d13a4e2..04bc2ca976b3ca9a5e587d32ea23875d9f906d90" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-insert-test", + "expectedResult": { + "changes": { + "objects-with-methods.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'subtract' identifier with the 'add' identifier in the 'add(a, b)' method" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 32 + ] + }, + { + "start": [ + 1, + 22 + ], + "end": [ + 1, + 27 + ] + } + ] + }, + "summary": "Replaced the 'a - b' math operator with the 'a + b' math operator in the 'add(a, b)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 59eb3a3d..05689b17 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,3 +1,3 @@", + "-{ subtract(a, b) { return a - b; } };", + "+{ add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "04bc2ca976b3ca9a5e587d32ea23875d9f906d90..66994fec008c1ea8dbacf93bcc5f9c6bcd929ce7" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-replacement-test", + "expectedResult": { + "changes": { + "objects-with-methods.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced the 'add' identifier with the 'subtract' identifier in the 'subtract(a, b)' method" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 22 + ], + "end": [ + 1, + 27 + ] + }, + { + "start": [ + 1, + 27 + ], + "end": [ + 1, + 32 + ] + } + ] + }, + "summary": "Replaced the 'a + b' math operator with the 'a - b' math operator in the 'subtract(a, b)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 05689b17..59eb3a3d 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,3 +1,3 @@", + "-{ add(a, b) { return a + b; } };", + "+{ subtract(a, b) { return a - b; } };", + " { add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "66994fec008c1ea8dbacf93bcc5f9c6bcd929ce7..8e236c7111b01c0960041bf367169f651c043c8a" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-replacement-test", + "expectedResult": { + "changes": { + "objects-with-methods.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 37 + ] + } + }, + "summary": "Deleted the '{ subtract(a, b) }' object" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Deleted the '{ add(a, b) }' object" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 37 + ] + } + }, + "summary": "Added the '{ subtract(a, b) }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 59eb3a3d..29d39987 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,3 +1,2 @@", + "-{ subtract(a, b) { return a - b; } };", + "-{ add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };", + "+{ subtract(a, b) { return a - b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8e236c7111b01c0960041bf367169f651c043c8a..3c77bf5f786cc17625ea311ab13bb5fc49256203" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-test", + "expectedResult": { + "changes": { + "objects-with-methods.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted the '{ add(a, b) }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 29d39987..80ad7f08 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,2 +1 @@", + "-{ add(a, b) { return a + b; } };", + " { subtract(a, b) { return a - b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3c77bf5f786cc17625ea311ab13bb5fc49256203..0ef207c1ce4c4f71769deb282d5e2269b9ab4bae" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-rest-test", + "expectedResult": { + "changes": { + "objects-with-methods.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 37 + ] + } + }, + "summary": "Deleted the '{ subtract(a, b) }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 80ad7f08..e69de29b 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1 +0,0 @@", + "-{ subtract(a, b) { return a - b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0ef207c1ce4c4f71769deb282d5e2269b9ab4bae..36a730d16dd73b6484407e64d7262f2b1d2260d7" +}] diff --git a/test/corpus/diff-summaries/javascript/regex.json b/test/corpus/diff-summaries/javascript/regex.json new file mode 100644 index 000000000..ffdb362ee --- /dev/null +++ b/test/corpus/diff-summaries/javascript/regex.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-regex-insert-test", + "expectedResult": { + "changes": { + "regex.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the '/one/g' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index e69de29b..b3818424 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -0,0 +1 @@", + "+/one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b9d8688abe5c6af76d88562b6f621a4e9c553dee..46137719fcddccc85be5109de5ab82155e4b7bf6" +} +,{ + "testCaseDescription": "javascript-regex-replacement-insert-test", + "expectedResult": { + "changes": { + "regex.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the '/on[^/]afe/gim' regex" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the '/one/g' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index b3818424..6ed4b424 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1 +1,3 @@", + "+/on[^/]afe/gim;", + "+/one/g;", + " /one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "46137719fcddccc85be5109de5ab82155e4b7bf6..6ae2de8f1464ee028941ff006bcddc6a8e154dc1" +} +,{ + "testCaseDescription": "javascript-regex-delete-insert-test", + "expectedResult": { + "changes": { + "regex.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the '/on[^/]afe/gim' regex with the '/one/g' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 6ed4b424..abb87ec8 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,3 +1,3 @@", + "-/on[^/]afe/gim;", + "+/one/g;", + " /one/g;", + " /one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6ae2de8f1464ee028941ff006bcddc6a8e154dc1..b48b7b35c67eec6469cd845444dc26dcaafa608e" +} +,{ + "testCaseDescription": "javascript-regex-replacement-test", + "expectedResult": { + "changes": { + "regex.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced the '/one/g' regex with the '/on[^/]afe/gim' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index abb87ec8..6ed4b424 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,3 +1,3 @@", + "-/one/g;", + "+/on[^/]afe/gim;", + " /one/g;", + " /one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b48b7b35c67eec6469cd845444dc26dcaafa608e..1276e4cc252d792491815c41102b4e2044fc55cb" +} +,{ + "testCaseDescription": "javascript-regex-delete-replacement-test", + "expectedResult": { + "changes": { + "regex.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the '/on[^/]afe/gim' regex" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the '/one/g' regex" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Added the '/on[^/]afe/gim' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 6ed4b424..9f57e919 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,3 +1,2 @@", + "-/on[^/]afe/gim;", + "-/one/g;", + " /one/g;", + "+/on[^/]afe/gim;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1276e4cc252d792491815c41102b4e2044fc55cb..045307a264efad53fdebe6dfcf29e4479cb1dc41" +} +,{ + "testCaseDescription": "javascript-regex-delete-test", + "expectedResult": { + "changes": { + "regex.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the '/one/g' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 9f57e919..9b04194d 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,2 +1 @@", + "-/one/g;", + " /on[^/]afe/gim;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "045307a264efad53fdebe6dfcf29e4479cb1dc41..8ac6858f8b302bf8667082d5cd86f97974852eb1" +} +,{ + "testCaseDescription": "javascript-regex-delete-rest-test", + "expectedResult": { + "changes": { + "regex.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the '/on[^/]afe/gim' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 9b04194d..e69de29b 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1 +0,0 @@", + "-/on[^/]afe/gim;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8ac6858f8b302bf8667082d5cd86f97974852eb1..218c2bd7314aff78af0e6556d8eed307360c25c2" +}] diff --git a/test/corpus/diff-summaries/javascript/relational-operator.json b/test/corpus/diff-summaries/javascript/relational-operator.json new file mode 100644 index 000000000..6042c6dd6 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/relational-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-relational-operator-insert-test", + "expectedResult": { + "changes": { + "relational-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x < y' relational operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index e69de29b..4021910f 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -0,0 +1 @@", + "+x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ef8d4296ee2dfe27245e4697b092bcf81f14acce..ab5c59e8e3311a3c5d43efa676f20a6273b72f76" +} +,{ + "testCaseDescription": "javascript-relational-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "relational-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'x <= y' relational operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'x < y' relational operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index 4021910f..dbef0501 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1 +1,3 @@", + "+x <= y;", + "+x < y;", + " x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ab5c59e8e3311a3c5d43efa676f20a6273b72f76..9b186a7e12610f5a263512f5f8fa6fcf6f4df01f" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-insert-test", + "expectedResult": { + "changes": { + "relational-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'x <= y' relational operator with the 'x < y' relational operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index dbef0501..a9ff7f65 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,3 +1,3 @@", + "-x <= y;", + "+x < y;", + " x < y;", + " x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9b186a7e12610f5a263512f5f8fa6fcf6f4df01f..0a77eff6d853ff69a1ce66772d3d9dff1cd5c895" +} +,{ + "testCaseDescription": "javascript-relational-operator-replacement-test", + "expectedResult": { + "changes": { + "relational-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x < y' relational operator with the 'x <= y' relational operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index a9ff7f65..dbef0501 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,3 +1,3 @@", + "-x < y;", + "+x <= y;", + " x < y;", + " x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0a77eff6d853ff69a1ce66772d3d9dff1cd5c895..d728ea5b16531558f3d1391ce6279c4599caa1b7" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "relational-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x <= y' relational operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'x < y' relational operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'x <= y' relational operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index dbef0501..1ee42eb9 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,3 +1,2 @@", + "-x <= y;", + "-x < y;", + " x < y;", + "+x <= y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d728ea5b16531558f3d1391ce6279c4599caa1b7..3aa9a1bc32c00263d45abf456580afc308b8e88c" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-test", + "expectedResult": { + "changes": { + "relational-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x < y' relational operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index 1ee42eb9..3be8450f 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,2 +1 @@", + "-x < y;", + " x <= y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3aa9a1bc32c00263d45abf456580afc308b8e88c..dab41c75b5e4f67cdb36643cab90f3929f866590" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-rest-test", + "expectedResult": { + "changes": { + "relational-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x <= y' relational operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index 3be8450f..e69de29b 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1 +0,0 @@", + "-x <= y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dab41c75b5e4f67cdb36643cab90f3929f866590..c320f90e127c691529e4c298d3ff3969a0483c8e" +}] diff --git a/test/corpus/diff-summaries/javascript/return-statement.json b/test/corpus/diff-summaries/javascript/return-statement.json new file mode 100644 index 000000000..18eecee5f --- /dev/null +++ b/test/corpus/diff-summaries/javascript/return-statement.json @@ -0,0 +1,323 @@ +[{ + "testCaseDescription": "javascript-return-statement-insert-test", + "expectedResult": { + "changes": { + "return-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the '5' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index e69de29b..63150293 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -0,0 +1 @@", + "+return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ee66417eb88b151832b600af9c2b381b2e52880e..aa418fc5f074d8c3bb6bbb729d2c8d1eceb1875c" +} +,{ + "testCaseDescription": "javascript-return-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "return-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added a return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the '5' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 63150293..22dde951 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1 +1,3 @@", + "+return;", + "+return 5;", + " return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "aa418fc5f074d8c3bb6bbb729d2c8d1eceb1875c..2afaee871a0c64ba9c55f647027d98991976c10f" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-insert-test", + "expectedResult": { + "changes": { + "return-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Added '5'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 22dde951..522349cd 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,3 +1,3 @@", + "-return;", + "+return 5;", + " return 5;", + " return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2afaee871a0c64ba9c55f647027d98991976c10f..de7c548b96662f8ae90dcea647f158ae616b9eec" +} +,{ + "testCaseDescription": "javascript-return-statement-replacement-test", + "expectedResult": { + "changes": { + "return-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted '5'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 522349cd..22dde951 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,3 +1,3 @@", + "-return 5;", + "+return;", + " return 5;", + " return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "de7c548b96662f8ae90dcea647f158ae616b9eec..9765bd3a9c9400c89a35c43cf69edfb1ac1457b4" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "return-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted a return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the '5' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added a return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 22dde951..4d44d6ac 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,3 +1,2 @@", + "-return;", + "-return 5;", + " return 5;", + "+return;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9765bd3a9c9400c89a35c43cf69edfb1ac1457b4..4e8eba1e08dd23e884d13dce01a6f7e4c8d00534" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-test", + "expectedResult": { + "changes": { + "return-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the '5' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 4d44d6ac..f312410b 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,2 +1 @@", + "-return 5;", + " return;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4e8eba1e08dd23e884d13dce01a6f7e4c8d00534..7f8ecfe4b7989470ce44c39f8b788196e5c88e94" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-rest-test", + "expectedResult": { + "changes": { + "return-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted a return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index f312410b..e69de29b 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1 +0,0 @@", + "-return;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7f8ecfe4b7989470ce44c39f8b788196e5c88e94..074b11388910f403aab4a975e06626792b23aca4" +}] diff --git a/test/corpus/diff-summaries/javascript/string.json b/test/corpus/diff-summaries/javascript/string.json new file mode 100644 index 000000000..3496f3638 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/string.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-string-insert-test", + "expectedResult": { + "changes": { + "string.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Added the 'A string with \"double\" quotes' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index e69de29b..ea5bd425 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -0,0 +1 @@", + "+'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "36a730d16dd73b6484407e64d7262f2b1d2260d7..1870b80862e625d4963fcaa20734fd9e45e20b4b" +} +,{ + "testCaseDescription": "javascript-string-replacement-insert-test", + "expectedResult": { + "changes": { + "string.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Added the 'A different string with \"double\" quotes' string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Added the 'A string with \"double\" quotes' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index ea5bd425..5cef047e 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1 +1,3 @@", + "+'A different string with \"double\" quotes';", + "+'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1870b80862e625d4963fcaa20734fd9e45e20b4b..29cc0e75eae8279de23094b6b5111fd42a20cde1" +} +,{ + "testCaseDescription": "javascript-string-delete-insert-test", + "expectedResult": { + "changes": { + "string.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + ] + }, + "summary": "Replaced the 'A different string with \"double\" quotes' string with the 'A string with \"double\" quotes' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 5cef047e..7af39a55 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,3 +1,3 @@", + "-'A different string with \"double\" quotes';", + "+'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "29cc0e75eae8279de23094b6b5111fd42a20cde1..0f0c962bf6fc4d1b7110477438f0fd2e1ecec140" +} +,{ + "testCaseDescription": "javascript-string-replacement-test", + "expectedResult": { + "changes": { + "string.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + ] + }, + "summary": "Replaced the 'A string with \"double\" quotes' string with the 'A different string with \"double\" quotes' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 7af39a55..5cef047e 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,3 +1,3 @@", + "-'A string with \"double\" quotes';", + "+'A different string with \"double\" quotes';", + " 'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0f0c962bf6fc4d1b7110477438f0fd2e1ecec140..abb4de29b8899e7bd340bd31ee4d983dc9f9cc4d" +} +,{ + "testCaseDescription": "javascript-string-delete-replacement-test", + "expectedResult": { + "changes": { + "string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Deleted the 'A different string with \"double\" quotes' string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 32 + ] + } + }, + "summary": "Deleted the 'A string with \"double\" quotes' string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 42 + ] + } + }, + "summary": "Added the 'A different string with \"double\" quotes' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 5cef047e..8dd4514f 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,3 +1,2 @@", + "-'A different string with \"double\" quotes';", + "-'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';", + "+'A different string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "abb4de29b8899e7bd340bd31ee4d983dc9f9cc4d..84c90dfe58c7824e22891e9142af453d51539c74" +} +,{ + "testCaseDescription": "javascript-string-delete-test", + "expectedResult": { + "changes": { + "string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 32 + ] + } + }, + "summary": "Deleted the 'A string with \"double\" quotes' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 8dd4514f..95fbde5d 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,2 +1 @@", + "-'A string with \"double\" quotes';", + " 'A different string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "84c90dfe58c7824e22891e9142af453d51539c74..8d96017389b1ffa96fed6b292a41d61654733899" +} +,{ + "testCaseDescription": "javascript-string-delete-rest-test", + "expectedResult": { + "changes": { + "string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 42 + ] + } + }, + "summary": "Deleted the 'A different string with \"double\" quotes' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 95fbde5d..e69de29b 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1 +0,0 @@", + "-'A different string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8d96017389b1ffa96fed6b292a41d61654733899..a721bbb02349218f8c3e5c1b8dff9b250d206fa5" +}] diff --git a/test/corpus/diff-summaries/javascript/subscript-access-assignment.json b/test/corpus/diff-summaries/javascript/subscript-access-assignment.json new file mode 100644 index 000000000..b190e8ec7 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/subscript-access-assignment.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-subscript-access-assignment-insert-test", + "expectedResult": { + "changes": { + "subscript-access-assignment.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the 'y[\"x\"]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index e69de29b..6b6d48d2 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -0,0 +1 @@", + "+y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c19769fba6e7c7042d1ab1915c3f9bb20d569e22..0cc920fcb9a611b8c6e75c061f71bba36f375f9a" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-replacement-insert-test", + "expectedResult": { + "changes": { + "subscript-access-assignment.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the 'y[\"x\"]' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Added the 'y[\"x\"]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 6b6d48d2..17d3ff48 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1 +1,3 @@", + "+y[\"x\"] = 1;", + "+y[\"x\"] = 0;", + " y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0cc920fcb9a611b8c6e75c061f71bba36f375f9a..cb74cdb2c35a8d40907b018505d8f1769379b9ca" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-insert-test", + "expectedResult": { + "changes": { + "subscript-access-assignment.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced '1' with '0' in an assignment to y[\"x\"]" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 17d3ff48..d856ac0d 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y[\"x\"] = 1;", + "+y[\"x\"] = 0;", + " y[\"x\"] = 0;", + " y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cb74cdb2c35a8d40907b018505d8f1769379b9ca..ce47993610b84c23c5956f7a598d1cc3218bdcb3" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-replacement-test", + "expectedResult": { + "changes": { + "subscript-access-assignment.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced '0' with '1' in an assignment to y[\"x\"]" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index d856ac0d..17d3ff48 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y[\"x\"] = 0;", + "+y[\"x\"] = 1;", + " y[\"x\"] = 0;", + " y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ce47993610b84c23c5956f7a598d1cc3218bdcb3..7edc956052d054a4e5d4474baedbfdccc90ffa26" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-replacement-test", + "expectedResult": { + "changes": { + "subscript-access-assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the 'y[\"x\"]' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Deleted the 'y[\"x\"]' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Added the 'y[\"x\"]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 17d3ff48..cdcb426e 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,3 +1,2 @@", + "-y[\"x\"] = 1;", + "-y[\"x\"] = 0;", + " y[\"x\"] = 0;", + "+y[\"x\"] = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7edc956052d054a4e5d4474baedbfdccc90ffa26..3447577471d7e4fa2ed142ecbdac76674cce1df3" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-test", + "expectedResult": { + "changes": { + "subscript-access-assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the 'y[\"x\"]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index cdcb426e..0407c3a1 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,2 +1 @@", + "-y[\"x\"] = 0;", + " y[\"x\"] = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3447577471d7e4fa2ed142ecbdac76674cce1df3..93d69fa6cf639f25112e6b738b5fa55f977c2232" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-rest-test", + "expectedResult": { + "changes": { + "subscript-access-assignment.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the 'y[\"x\"]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 0407c3a1..e69de29b 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1 +0,0 @@", + "-y[\"x\"] = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "93d69fa6cf639f25112e6b738b5fa55f977c2232..e49b80d7752e9f991ddcb2ff2a8c5f714d9bafa3" +}] diff --git a/test/corpus/diff-summaries/javascript/subscript-access-string.json b/test/corpus/diff-summaries/javascript/subscript-access-string.json new file mode 100644 index 000000000..edbe4a64e --- /dev/null +++ b/test/corpus/diff-summaries/javascript/subscript-access-string.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-subscript-access-string-insert-test", + "expectedResult": { + "changes": { + "subscript-access-string.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Added the 'x[\"some-string\"]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index e69de29b..42937172 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -0,0 +1 @@", + "+x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e8224a02e3ba0dc00add706c1568127b3ae6182b..e878b0903340b2a3a3be042f0aefa185e1c58975" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-replacement-insert-test", + "expectedResult": { + "changes": { + "subscript-access-string.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Added the 'x[\"some-other-string\"]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Added the 'x[\"some-string\"]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 42937172..42930094 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1 +1,3 @@", + "+x[\"some-other-string\"];", + "+x[\"some-string\"];", + " x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e878b0903340b2a3a3be042f0aefa185e1c58975..756f52d1fdddba9fa5e751771af7be483b30d6a4" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-insert-test", + "expectedResult": { + "changes": { + "subscript-access-string.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 22 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 16 + ] + } + ] + }, + "summary": "Replaced the \"some-other-string\" string with the \"some-string\" string in the x[\"some-string\"] subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 42930094..c53d07bb 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,3 +1,3 @@", + "-x[\"some-other-string\"];", + "+x[\"some-string\"];", + " x[\"some-string\"];", + " x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "756f52d1fdddba9fa5e751771af7be483b30d6a4..ec75e0ed9547f53ff2d7f8cc5212df280baa113f" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-replacement-test", + "expectedResult": { + "changes": { + "subscript-access-string.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 16 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 22 + ] + } + ] + }, + "summary": "Replaced the \"some-string\" string with the \"some-other-string\" string in the x[\"some-other-string\"] subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index c53d07bb..42930094 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,3 +1,3 @@", + "-x[\"some-string\"];", + "+x[\"some-other-string\"];", + " x[\"some-string\"];", + " x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ec75e0ed9547f53ff2d7f8cc5212df280baa113f..fc3172fc3532d111b67ce2c4c8a2d23c85e81ca2" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-replacement-test", + "expectedResult": { + "changes": { + "subscript-access-string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'x[\"some-other-string\"]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Deleted the 'x[\"some-string\"]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 23 + ] + } + }, + "summary": "Added the 'x[\"some-other-string\"]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 42930094..89c1bc26 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,3 +1,2 @@", + "-x[\"some-other-string\"];", + "-x[\"some-string\"];", + " x[\"some-string\"];", + "+x[\"some-other-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fc3172fc3532d111b67ce2c4c8a2d23c85e81ca2..d38478e3bd000e6b61450308f1bebf319d0c1514" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-test", + "expectedResult": { + "changes": { + "subscript-access-string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'x[\"some-string\"]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 89c1bc26..758f8e70 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,2 +1 @@", + "-x[\"some-string\"];", + " x[\"some-other-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d38478e3bd000e6b61450308f1bebf319d0c1514..84fa7c277121111c577e65f3f21a09363188c9c4" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-rest-test", + "expectedResult": { + "changes": { + "subscript-access-string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'x[\"some-other-string\"]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 758f8e70..e69de29b 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1 +0,0 @@", + "-x[\"some-other-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "84fa7c277121111c577e65f3f21a09363188c9c4..2ceb4d28a0554634451ed82eacdbb44d64ce6d54" +}] diff --git a/test/corpus/diff-summaries/javascript/subscript-access-variable.json b/test/corpus/diff-summaries/javascript/subscript-access-variable.json new file mode 100644 index 000000000..65ec87be3 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/subscript-access-variable.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-subscript-access-variable-insert-test", + "expectedResult": { + "changes": { + "subscript-access-variable.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 16 + ] + } + }, + "summary": "Added the 'x[someVariable]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index e69de29b..9a7b3d3e 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -0,0 +1 @@", + "+x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ec6eea34d7c86b61e0a52fbb0b8041553b1d5af7..6dad82818c86126ce330a9cd7c093a76efb8cdaf" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-replacement-insert-test", + "expectedResult": { + "changes": { + "subscript-access-variable.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the 'x[someOtherVariable]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 16 + ] + } + }, + "summary": "Added the 'x[someVariable]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 9a7b3d3e..000d190c 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1 +1,3 @@", + "+x[someOtherVariable];", + "+x[someVariable];", + " x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6dad82818c86126ce330a9cd7c093a76efb8cdaf..8c1c5fde4aa2169750f7d2f703c68e42b471ecf7" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-insert-test", + "expectedResult": { + "changes": { + "subscript-access-variable.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 20 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced the 'someOtherVariable' identifier with the 'someVariable' identifier in the x[someVariable] subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 000d190c..01f61ef9 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,3 +1,3 @@", + "-x[someOtherVariable];", + "+x[someVariable];", + " x[someVariable];", + " x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8c1c5fde4aa2169750f7d2f703c68e42b471ecf7..53bf9e0f19f42594d579ccbee1163f429a1c14c6" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-replacement-test", + "expectedResult": { + "changes": { + "subscript-access-variable.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 20 + ] + } + ] + }, + "summary": "Replaced the 'someVariable' identifier with the 'someOtherVariable' identifier in the x[someOtherVariable] subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 01f61ef9..000d190c 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,3 +1,3 @@", + "-x[someVariable];", + "+x[someOtherVariable];", + " x[someVariable];", + " x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "53bf9e0f19f42594d579ccbee1163f429a1c14c6..edb73e95c59b9fe91874106f30628ab26c22cbdb" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-replacement-test", + "expectedResult": { + "changes": { + "subscript-access-variable.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'x[someOtherVariable]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 16 + ] + } + }, + "summary": "Deleted the 'x[someVariable]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Added the 'x[someOtherVariable]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 000d190c..2aaae7e7 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,3 +1,2 @@", + "-x[someOtherVariable];", + "-x[someVariable];", + " x[someVariable];", + "+x[someOtherVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "edb73e95c59b9fe91874106f30628ab26c22cbdb..d29bb5ba94f278f6e77172dcbdd30d4fcadebba2" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-test", + "expectedResult": { + "changes": { + "subscript-access-variable.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 16 + ] + } + }, + "summary": "Deleted the 'x[someVariable]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 2aaae7e7..baa3661b 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,2 +1 @@", + "-x[someVariable];", + " x[someOtherVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d29bb5ba94f278f6e77172dcbdd30d4fcadebba2..52c8ed9cb96dc3d7f79305d80304cca93f0c2775" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-rest-test", + "expectedResult": { + "changes": { + "subscript-access-variable.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'x[someOtherVariable]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index baa3661b..e69de29b 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1 +0,0 @@", + "-x[someOtherVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "52c8ed9cb96dc3d7f79305d80304cca93f0c2775..e8224a02e3ba0dc00add706c1568127b3ae6182b" +}] diff --git a/test/corpus/diff-summaries/javascript/switch-statement.json b/test/corpus/diff-summaries/javascript/switch-statement.json new file mode 100644 index 000000000..607ab82f0 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/switch-statement.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-switch-statement-insert-test", + "expectedResult": { + "changes": { + "switch-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Added the '1' switch statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index e69de29b..5481c49f 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -0,0 +1 @@", + "+switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "98e620d7e739bab2841281450b4d879405585f38..dca11528b714e0e28922043c278b3b4628089786" +} +,{ + "testCaseDescription": "javascript-switch-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "switch-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Added the '2' switch statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 48 + ] + } + }, + "summary": "Added the '1' switch statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 5481c49f..ffd4a32a 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1 +1,3 @@", + "+switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + "+switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dca11528b714e0e28922043c278b3b4628089786..d54fa5ad0bd0b1629be149303f501364ce459d39" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-insert-test", + "expectedResult": { + "changes": { + "switch-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + }, + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + ] + }, + "summary": "Replaced '2' with '1' in the '1' switch statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 34 + ] + }, + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 34 + ] + } + ] + }, + "summary": "Replaced '2' with '1' in the '1' switch statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index ffd4a32a..302fb8bc 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,3 +1,3 @@", + "-switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + "+switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d54fa5ad0bd0b1629be149303f501364ce459d39..25472c0239ffc946df79545a6d89193906c749e3" +} +,{ + "testCaseDescription": "javascript-switch-statement-replacement-test", + "expectedResult": { + "changes": { + "switch-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + }, + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + ] + }, + "summary": "Replaced '1' with '2' in the '2' switch statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 34 + ] + }, + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 34 + ] + } + ] + }, + "summary": "Replaced '1' with '2' in the '2' switch statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 302fb8bc..ffd4a32a 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,3 +1,3 @@", + "-switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + "+switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "25472c0239ffc946df79545a6d89193906c749e3..30a9228a01816745bb3482059382bb8d8a958691" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "switch-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Deleted the '2' switch statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 48 + ] + } + }, + "summary": "Deleted the '1' switch statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 48 + ] + } + }, + "summary": "Added the '2' switch statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index ffd4a32a..9b605791 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,3 +1,2 @@", + "-switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + "-switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + "+switch (2) { case 1: 1; case 2: 2; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "30a9228a01816745bb3482059382bb8d8a958691..3107c424ae4915648b7dd8b8453ae467b7995385" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-test", + "expectedResult": { + "changes": { + "switch-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Deleted the '1' switch statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 9b605791..374091f2 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,2 +1 @@", + "-switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (2) { case 1: 1; case 2: 2; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3107c424ae4915648b7dd8b8453ae467b7995385..724cc2045ea55f544c52a15b3845b17ad71e8248" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-rest-test", + "expectedResult": { + "changes": { + "switch-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Deleted the '2' switch statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 374091f2..e69de29b 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1 +0,0 @@", + "-switch (2) { case 1: 1; case 2: 2; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "724cc2045ea55f544c52a15b3845b17ad71e8248..ceabf504bd808117c5723ab62977a38ed153f0ec" +}] diff --git a/test/corpus/diff-summaries/javascript/template-string.json b/test/corpus/diff-summaries/javascript/template-string.json new file mode 100644 index 000000000..cdb7c4a4d --- /dev/null +++ b/test/corpus/diff-summaries/javascript/template-string.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-template-string-insert-test", + "expectedResult": { + "changes": { + "template-string.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the '`one line`' template string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index e69de29b..01f859b1 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -0,0 +1 @@", + "+`one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "64dfefbc50b4a2c3c30e706f470afe7dac6fd8b2..2e98d223a00054b95e621ab004bd3633a1dcb43b" +} +,{ + "testCaseDescription": "javascript-template-string-replacement-insert-test", + "expectedResult": { + "changes": { + "template-string.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the '`multi line`' template string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Added the '`one line`' template string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 01f859b1..777fde68 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1 +1,3 @@", + "+`multi line`", + "+`one line`", + " `one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2e98d223a00054b95e621ab004bd3633a1dcb43b..d742b14e9de2e202b35c442d7c15191ee3d39c2a" +} +,{ + "testCaseDescription": "javascript-template-string-delete-insert-test", + "expectedResult": { + "changes": { + "template-string.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced the '`multi line`' template string with the '`one line`' template string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 777fde68..657129fc 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,3 +1,3 @@", + "-`multi line`", + "+`one line`", + " `one line`", + " `one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d742b14e9de2e202b35c442d7c15191ee3d39c2a..a467b085be4f17f46b0ae2f24ce6b3007b9ced8f" +} +,{ + "testCaseDescription": "javascript-template-string-replacement-test", + "expectedResult": { + "changes": { + "template-string.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced the '`one line`' template string with the '`multi line`' template string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 657129fc..777fde68 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,3 +1,3 @@", + "-`one line`", + "+`multi line`", + " `one line`", + " `one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a467b085be4f17f46b0ae2f24ce6b3007b9ced8f..14df5165b08071bd9445f3ab04855d5d19e6f401" +} +,{ + "testCaseDescription": "javascript-template-string-delete-replacement-test", + "expectedResult": { + "changes": { + "template-string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the '`multi line`' template string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Deleted the '`one line`' template string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the '`multi line`' template string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 777fde68..2b8c0dde 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,3 +1,2 @@", + "-`multi line`", + "-`one line`", + " `one line`", + "+`multi line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "14df5165b08071bd9445f3ab04855d5d19e6f401..3d67dd065db26d02ede23e3d94574b24d2a454df" +} +,{ + "testCaseDescription": "javascript-template-string-delete-test", + "expectedResult": { + "changes": { + "template-string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the '`one line`' template string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 2b8c0dde..399f1173 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,2 +1 @@", + "-`one line`", + " `multi line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3d67dd065db26d02ede23e3d94574b24d2a454df..34315d91dc0fdd1328530c63251a9fea7fad7ce8" +} +,{ + "testCaseDescription": "javascript-template-string-delete-rest-test", + "expectedResult": { + "changes": { + "template-string.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the '`multi line`' template string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 399f1173..e69de29b 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1 +0,0 @@", + "-`multi line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "34315d91dc0fdd1328530c63251a9fea7fad7ce8..58aa7b1cb85df06bb4b647466c43f5c4862c695f" +}] diff --git a/test/corpus/diff-summaries/javascript/ternary.json b/test/corpus/diff-summaries/javascript/ternary.json new file mode 100644 index 000000000..6e8a5ed2c --- /dev/null +++ b/test/corpus/diff-summaries/javascript/ternary.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "javascript-ternary-insert-test", + "expectedResult": { + "changes": { + "ternary.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Added the 'condition' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index e69de29b..a62be2e8 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -0,0 +1 @@", + "+condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1a9d89c148259dce0124722fcfdce38260c2f1b3..0056a9c72267befe79eb22254b4578eda2718bf6" +} +,{ + "testCaseDescription": "javascript-ternary-replacement-insert-test", + "expectedResult": { + "changes": { + "ternary.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 51 + ] + } + }, + "summary": "Added the 'x.y' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 26 + ] + } + }, + "summary": "Added the 'condition' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index a62be2e8..17b4f8ec 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1 +1,3 @@", + "+x.y = some.condition ? some.case : some.other.case;", + "+condition ? case1 : case2;", + " condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0056a9c72267befe79eb22254b4578eda2718bf6..7f12c13b3e180834c68d4dc2c3d3df3d1d9ac616" +} +,{ + "testCaseDescription": "javascript-ternary-delete-insert-test", + "expectedResult": { + "changes": { + "ternary.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Added the 'condition' ternary expression" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 51 + ] + } + }, + "summary": "Deleted the 'x.y' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index 17b4f8ec..aedee547 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,3 +1,3 @@", + "-x.y = some.condition ? some.case : some.other.case;", + "+condition ? case1 : case2;", + " condition ? case1 : case2;", + " condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7f12c13b3e180834c68d4dc2c3d3df3d1d9ac616..288703b7472a15119230c4375ec88b4a24fb6f75" +} +,{ + "testCaseDescription": "javascript-ternary-replacement-test", + "expectedResult": { + "changes": { + "ternary.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 51 + ] + } + }, + "summary": "Added the 'x.y' assignment" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Deleted the 'condition' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index aedee547..17b4f8ec 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,3 +1,3 @@", + "-condition ? case1 : case2;", + "+x.y = some.condition ? some.case : some.other.case;", + " condition ? case1 : case2;", + " condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "288703b7472a15119230c4375ec88b4a24fb6f75..68be2b95c254238bc5ecfa48f609a6ab3d9ce4c9" +} +,{ + "testCaseDescription": "javascript-ternary-delete-replacement-test", + "expectedResult": { + "changes": { + "ternary.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 51 + ] + } + }, + "summary": "Deleted the 'x.y' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 26 + ] + } + }, + "summary": "Deleted the 'condition' ternary expression" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 51 + ] + } + }, + "summary": "Added the 'x.y' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index 17b4f8ec..6fa999d8 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,3 +1,2 @@", + "-x.y = some.condition ? some.case : some.other.case;", + "-condition ? case1 : case2;", + " condition ? case1 : case2;", + "+x.y = some.condition ? some.case : some.other.case;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "68be2b95c254238bc5ecfa48f609a6ab3d9ce4c9..8ec8d97354cf1dd837a8f4a7eec2031de2f19ef5" +} +,{ + "testCaseDescription": "javascript-ternary-delete-test", + "expectedResult": { + "changes": { + "ternary.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Deleted the 'condition' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index 6fa999d8..b63b46d5 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,2 +1 @@", + "-condition ? case1 : case2;", + " x.y = some.condition ? some.case : some.other.case;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8ec8d97354cf1dd837a8f4a7eec2031de2f19ef5..6480831cc14b65627ccabb4c594a7c9b75da56bc" +} +,{ + "testCaseDescription": "javascript-ternary-delete-rest-test", + "expectedResult": { + "changes": { + "ternary.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 51 + ] + } + }, + "summary": "Deleted the 'x.y' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index b63b46d5..e69de29b 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1 +0,0 @@", + "-x.y = some.condition ? some.case : some.other.case;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6480831cc14b65627ccabb4c594a7c9b75da56bc..a6666c092404c291708b96e94dd932f6d3f8d7f3" +}] diff --git a/test/corpus/diff-summaries/javascript/this-expression.json b/test/corpus/diff-summaries/javascript/this-expression.json new file mode 100644 index 000000000..fceb86d9d --- /dev/null +++ b/test/corpus/diff-summaries/javascript/this-expression.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "javascript-this-expression-insert-test", + "expectedResult": { + "changes": { + "this-expression.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'this' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index e69de29b..b251f26b 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -0,0 +1 @@", + "+this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "11c817d08ac0cb3edac35eedef4ad8f04b290d77..946eafe6841a17df1464b56d3b30aa5f9944e2fb" +} +,{ + "testCaseDescription": "javascript-this-expression-replacement-insert-test", + "expectedResult": { + "changes": { + "this-expression.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'this' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Added the 'this' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index b251f26b..58047437 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1 +1,3 @@", + "+return this;", + "+this;", + " this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "946eafe6841a17df1464b56d3b30aa5f9944e2fb..8c3b8b8aee5025d5a62a85f79a55c6205ad675a7" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-insert-test", + "expectedResult": { + "changes": { + "this-expression.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'this' identifier" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'this' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 58047437..3c82a23c 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,3 +1,3 @@", + "-return this;", + "+this;", + " this;", + " this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8c3b8b8aee5025d5a62a85f79a55c6205ad675a7..5c8b79b64a6c8a13b973b23438aa04b4ee272307" +} +,{ + "testCaseDescription": "javascript-this-expression-replacement-test", + "expectedResult": { + "changes": { + "this-expression.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'this' return statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'this' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 3c82a23c..58047437 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,3 +1,3 @@", + "-this;", + "+return this;", + " this;", + " this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5c8b79b64a6c8a13b973b23438aa04b4ee272307..a24710509652274cdb4fa3260595ac6f5537510f" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-replacement-test", + "expectedResult": { + "changes": { + "this-expression.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'this' return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Deleted the 'this' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the 'this' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 58047437..81aca892 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,3 +1,2 @@", + "-return this;", + "-this;", + " this;", + "+return this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a24710509652274cdb4fa3260595ac6f5537510f..c2aa0794e99a16952284bad9e79987ac5fb93d4f" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-test", + "expectedResult": { + "changes": { + "this-expression.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'this' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 81aca892..45c3231b 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,2 +1 @@", + "-this;", + " return this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c2aa0794e99a16952284bad9e79987ac5fb93d4f..a4ccea192771f0d5226b4c8f895318cd656e8be8" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-rest-test", + "expectedResult": { + "changes": { + "this-expression.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'this' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 45c3231b..e69de29b 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1 +0,0 @@", + "-return this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a4ccea192771f0d5226b4c8f895318cd656e8be8..c41b2f9fe0dffe03f83ea0599b2f5fd18a1292a7" +}] diff --git a/test/corpus/diff-summaries/javascript/throw-statement.json b/test/corpus/diff-summaries/javascript/throw-statement.json new file mode 100644 index 000000000..8641add53 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/throw-statement.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-throw-statement-insert-test", + "expectedResult": { + "changes": { + "throw-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Added the 'new Error(\"uh oh\")' throw statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index e69de29b..e2fcb67e 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -0,0 +1 @@", + "+throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ceabf504bd808117c5723ab62977a38ed153f0ec..f61c5b9277192b23b4f628e41d0c1f0be8fb3af4" +} +,{ + "testCaseDescription": "javascript-throw-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "throw-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Added the 'new Error(\"oooooops\")' throw statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 26 + ] + } + }, + "summary": "Added the 'new Error(\"uh oh\")' throw statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index e2fcb67e..c0020c89 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1 +1,3 @@", + "+throw new Error(\"oooooops\");", + "+throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f61c5b9277192b23b4f628e41d0c1f0be8fb3af4..aa47f72c1b1466fc99f2a700da0751a62a47ec94" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-insert-test", + "expectedResult": { + "changes": { + "throw-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 27 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 24 + ] + } + ] + }, + "summary": "Replaced the \"oooooops\" string with the \"uh oh\" string in the Error(\"uh oh\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index c0020c89..46442332 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,3 +1,3 @@", + "-throw new Error(\"oooooops\");", + "+throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "aa47f72c1b1466fc99f2a700da0751a62a47ec94..26773f48167d08ece295290b48b3fac475a0ccb9" +} +,{ + "testCaseDescription": "javascript-throw-statement-replacement-test", + "expectedResult": { + "changes": { + "throw-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 24 + ] + }, + { + "start": [ + 1, + 17 + ], + "end": [ + 1, + 27 + ] + } + ] + }, + "summary": "Replaced the \"uh oh\" string with the \"oooooops\" string in the Error(\"oooooops\") function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index 46442332..c0020c89 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,3 +1,3 @@", + "-throw new Error(\"uh oh\");", + "+throw new Error(\"oooooops\");", + " throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "26773f48167d08ece295290b48b3fac475a0ccb9..b8827826ec0259bb4bc39c6d94bec55dd27160ba" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "throw-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Deleted the 'new Error(\"oooooops\")' throw statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 26 + ] + } + }, + "summary": "Deleted the 'new Error(\"uh oh\")' throw statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 29 + ] + } + }, + "summary": "Added the 'new Error(\"oooooops\")' throw statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index c0020c89..a1bbf3e1 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,3 +1,2 @@", + "-throw new Error(\"oooooops\");", + "-throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");", + "+throw new Error(\"oooooops\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b8827826ec0259bb4bc39c6d94bec55dd27160ba..15d3d1ce7799904f611549e0baf136d8a7e1d82f" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-test", + "expectedResult": { + "changes": { + "throw-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 26 + ] + } + }, + "summary": "Deleted the 'new Error(\"uh oh\")' throw statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index a1bbf3e1..cc3c5312 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,2 +1 @@", + "-throw new Error(\"uh oh\");", + " throw new Error(\"oooooops\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "15d3d1ce7799904f611549e0baf136d8a7e1d82f..af0b5f44b5bcebda992399da45b7f72fbd0a39de" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-rest-test", + "expectedResult": { + "changes": { + "throw-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Deleted the 'new Error(\"oooooops\")' throw statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index cc3c5312..e69de29b 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1 +0,0 @@", + "-throw new Error(\"oooooops\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "af0b5f44b5bcebda992399da45b7f72fbd0a39de..7868df4cf3fd89e485b2f29ce8f215068a325f5f" +}] diff --git a/test/corpus/diff-summaries/javascript/true.json b/test/corpus/diff-summaries/javascript/true.json new file mode 100644 index 000000000..c39f7e9d2 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/true.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "javascript-true-insert-test", + "expectedResult": { + "changes": { + "true.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index e69de29b..4203d4b4 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -0,0 +1 @@", + "+true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "519ad14821c401c1cca201f2a2b02cb503bbfd83..c01ba167634e4d5a7fb703acf8769be0c3626f64" +} +,{ + "testCaseDescription": "javascript-true-replacement-insert-test", + "expectedResult": { + "changes": { + "true.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'true' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Added 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 4203d4b4..65b6323f 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1 +1,3 @@", + "+return true;", + "+true;", + " true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c01ba167634e4d5a7fb703acf8769be0c3626f64..d167fa08021f842e0798378a5e88903abcf965ce" +} +,{ + "testCaseDescription": "javascript-true-delete-insert-test", + "expectedResult": { + "changes": { + "true.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added 'true'" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'true' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 65b6323f..91e1cfc7 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,3 +1,3 @@", + "-return true;", + "+true;", + " true;", + " true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d167fa08021f842e0798378a5e88903abcf965ce..b34442089140e04e79424144e5383ff642833488" +} +,{ + "testCaseDescription": "javascript-true-replacement-test", + "expectedResult": { + "changes": { + "true.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'true' return statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 91e1cfc7..65b6323f 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,3 +1,3 @@", + "-true;", + "+return true;", + " true;", + " true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b34442089140e04e79424144e5383ff642833488..cb20b615113ca3c491298499f3825342588615c3" +} +,{ + "testCaseDescription": "javascript-true-delete-replacement-test", + "expectedResult": { + "changes": { + "true.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'true' return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Deleted 'true'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the 'true' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 65b6323f..48a44d12 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,3 +1,2 @@", + "-return true;", + "-true;", + " true;", + "+return true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cb20b615113ca3c491298499f3825342588615c3..e484b1e463ee4e5b2f74935ef01d15c994aee747" +} +,{ + "testCaseDescription": "javascript-true-delete-test", + "expectedResult": { + "changes": { + "true.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 48a44d12..c1c6922d 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,2 +1 @@", + "-true;", + " return true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e484b1e463ee4e5b2f74935ef01d15c994aee747..5091b3e63579acc77cb30365da02dbe7557c9742" +} +,{ + "testCaseDescription": "javascript-true-delete-rest-test", + "expectedResult": { + "changes": { + "true.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'true' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index c1c6922d..e69de29b 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1 +0,0 @@", + "-return true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5091b3e63579acc77cb30365da02dbe7557c9742..3404e2f9981f841657789983a30885db1872d717" +}] diff --git a/test/corpus/diff-summaries/javascript/try-statement.json b/test/corpus/diff-summaries/javascript/try-statement.json new file mode 100644 index 000000000..f92431832 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/try-statement.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-try-statement-insert-test", + "expectedResult": { + "changes": { + "try-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Added the '{ f; }' try statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index e69de29b..9826f7c2 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -0,0 +1 @@", + "+try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7868df4cf3fd89e485b2f29ce8f215068a325f5f..5ecb27a4efc41c0ba83e29c564af9c82956fca9e" +} +,{ + "testCaseDescription": "javascript-try-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "try-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Added the '{ f; }' try statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 39 + ] + } + }, + "summary": "Added the '{ f; }' try statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 9826f7c2..7befc1c1 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1 +1,3 @@", + "+try { f; } catch { h; } finally { g; };", + "+try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5ecb27a4efc41c0ba83e29c564af9c82956fca9e..d122a59462ad0be5a56561e7afdc6efecb3e6eae" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-insert-test", + "expectedResult": { + "changes": { + "try-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'g' identifier in the { f; } try statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + }, + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + } + ] + }, + "summary": "Replaced the 'g' identifier with the 'h' identifier in the { f; } try statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 7befc1c1..94fed9ce 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,3 +1,3 @@", + "-try { f; } catch { h; } finally { g; };", + "+try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d122a59462ad0be5a56561e7afdc6efecb3e6eae..fbb14de7eb2a4e456bc39a562ffbc3f80cba7556" +} +,{ + "testCaseDescription": "javascript-try-statement-replacement-test", + "expectedResult": { + "changes": { + "try-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 20 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced the 'g' identifier with the 'h' identifier in the { f; } try statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + }, + { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 36 + ] + } + ] + }, + "summary": "Replaced the 'h' identifier with the 'g' identifier in the { f; } try statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 94fed9ce..7befc1c1 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,3 +1,3 @@", + "-try { f; } catch { g; } finally { h; };", + "+try { f; } catch { h; } finally { g; };", + " try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fbb14de7eb2a4e456bc39a562ffbc3f80cba7556..e95c3010e454ee6d775fc67d787959670ebdd093" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "try-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the '{ f; }' try statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 39 + ] + } + }, + "summary": "Deleted the '{ f; }' try statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 39 + ] + } + }, + "summary": "Added the '{ f; }' try statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 7befc1c1..8ab70e04 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,3 +1,2 @@", + "-try { f; } catch { h; } finally { g; };", + "-try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };", + "+try { f; } catch { h; } finally { g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e95c3010e454ee6d775fc67d787959670ebdd093..61a1515e2ce6e1b47e445d3d792399c50ace173f" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-test", + "expectedResult": { + "changes": { + "try-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the '{ f; }' try statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 8ab70e04..024f88ab 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,2 +1 @@", + "-try { f; } catch { g; } finally { h; };", + " try { f; } catch { h; } finally { g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "61a1515e2ce6e1b47e445d3d792399c50ace173f..3c936e5a29f439a385c56e97af53bd5b0ca92532" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-rest-test", + "expectedResult": { + "changes": { + "try-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 39 + ] + } + }, + "summary": "Deleted the '{ f; }' try statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 024f88ab..e69de29b 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1 +0,0 @@", + "-try { f; } catch { h; } finally { g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3c936e5a29f439a385c56e97af53bd5b0ca92532..b9d8688abe5c6af76d88562b6f621a4e9c553dee" +}] diff --git a/test/corpus/diff-summaries/javascript/type-operator.json b/test/corpus/diff-summaries/javascript/type-operator.json new file mode 100644 index 000000000..08d170346 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/type-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-type-operator-insert-test", + "expectedResult": { + "changes": { + "type-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Added the 'typeof x' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index e69de29b..08d2bf54 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -0,0 +1 @@", + "+typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a6666c092404c291708b96e94dd932f6d3f8d7f3..c56cc7aa435002e6882e9e93ffe5e889184e4c98" +} +,{ + "testCaseDescription": "javascript-type-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "type-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Added the 'x instanceof String' operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Added the 'typeof x' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 08d2bf54..8b9c2f4a 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1 +1,3 @@", + "+x instanceof String;", + "+typeof x;", + " typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c56cc7aa435002e6882e9e93ffe5e889184e4c98..de4f0e28208514814ace58817472f9c8ae13adc2" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-insert-test", + "expectedResult": { + "changes": { + "type-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'x instanceof String' operator with the 'typeof x' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 8b9c2f4a..6a5be18c 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,3 +1,3 @@", + "-x instanceof String;", + "+typeof x;", + " typeof x;", + " typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "de4f0e28208514814ace58817472f9c8ae13adc2..25330298f86668c5c0d4efac9bdd1d9f97809061" +} +,{ + "testCaseDescription": "javascript-type-operator-replacement-test", + "expectedResult": { + "changes": { + "type-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + ] + }, + "summary": "Replaced the 'typeof x' operator with the 'x instanceof String' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 6a5be18c..8b9c2f4a 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,3 +1,3 @@", + "-typeof x;", + "+x instanceof String;", + " typeof x;", + " typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "25330298f86668c5c0d4efac9bdd1d9f97809061..0fc72a1ff12fd1fc2aa5a3fd530ad8d6994a8642" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "type-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Deleted the 'x instanceof String' operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Deleted the 'typeof x' operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 20 + ] + } + }, + "summary": "Added the 'x instanceof String' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 8b9c2f4a..d438f9f3 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,3 +1,2 @@", + "-x instanceof String;", + "-typeof x;", + " typeof x;", + "+x instanceof String;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0fc72a1ff12fd1fc2aa5a3fd530ad8d6994a8642..7d2889db0fc05844fa0b463669b57eecffd86d24" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-test", + "expectedResult": { + "changes": { + "type-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted the 'typeof x' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index d438f9f3..0bf52754 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,2 +1 @@", + "-typeof x;", + " x instanceof String;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7d2889db0fc05844fa0b463669b57eecffd86d24..5e6317483ca3c74940b950df894a1fbe3bc4e2b6" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-rest-test", + "expectedResult": { + "changes": { + "type-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Deleted the 'x instanceof String' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 0bf52754..e69de29b 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1 +0,0 @@", + "-x instanceof String;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5e6317483ca3c74940b950df894a1fbe3bc4e2b6..b3e70bdf3077d7e2f3dee952ec37081e57641fbf" +}] diff --git a/test/corpus/diff-summaries/javascript/undefined.json b/test/corpus/diff-summaries/javascript/undefined.json new file mode 100644 index 000000000..4490728b0 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/undefined.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "javascript-undefined-insert-test", + "expectedResult": { + "changes": { + "undefined.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'undefined' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index e69de29b..c2ca02c0 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -0,0 +1 @@", + "+undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "96b0b5fed694b8dcfb0566309faee71cfdf4dd60..6ab47400bd7d58aef3bf7780d6835556997006e1" +} +,{ + "testCaseDescription": "javascript-undefined-replacement-insert-test", + "expectedResult": { + "changes": { + "undefined.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'undefined' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the 'undefined' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index c2ca02c0..a4352cc6 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1 +1,3 @@", + "+return undefined;", + "+undefined;", + " undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6ab47400bd7d58aef3bf7780d6835556997006e1..e4b1802fe047f8a75e0bc46cd4da315efdf60560" +} +,{ + "testCaseDescription": "javascript-undefined-delete-insert-test", + "expectedResult": { + "changes": { + "undefined.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'undefined' identifier" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'undefined' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index a4352cc6..52ea2570 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,3 +1,3 @@", + "-return undefined;", + "+undefined;", + " undefined;", + " undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e4b1802fe047f8a75e0bc46cd4da315efdf60560..4bb9b8d216bafac43c6307eebd5cfe51b4769e39" +} +,{ + "testCaseDescription": "javascript-undefined-replacement-test", + "expectedResult": { + "changes": { + "undefined.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'undefined' return statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'undefined' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index 52ea2570..a4352cc6 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,3 +1,3 @@", + "-undefined;", + "+return undefined;", + " undefined;", + " undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4bb9b8d216bafac43c6307eebd5cfe51b4769e39..6d4c04c9c6972c06d65ba9c83095a168f51e3f95" +} +,{ + "testCaseDescription": "javascript-undefined-delete-replacement-test", + "expectedResult": { + "changes": { + "undefined.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'undefined' return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the 'undefined' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 18 + ] + } + }, + "summary": "Added the 'undefined' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index a4352cc6..a16e7474 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,3 +1,2 @@", + "-return undefined;", + "-undefined;", + " undefined;", + "+return undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6d4c04c9c6972c06d65ba9c83095a168f51e3f95..11403be2f96636e2cc2cf75b2fe20435a65fe3da" +} +,{ + "testCaseDescription": "javascript-undefined-delete-test", + "expectedResult": { + "changes": { + "undefined.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'undefined' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index a16e7474..fb505bb3 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,2 +1 @@", + "-undefined;", + " return undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "11403be2f96636e2cc2cf75b2fe20435a65fe3da..f58ac582dcfbebc2199f32e97efbd82e4711f00f" +} +,{ + "testCaseDescription": "javascript-undefined-delete-rest-test", + "expectedResult": { + "changes": { + "undefined.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'undefined' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index fb505bb3..e69de29b 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1 +0,0 @@", + "-return undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f58ac582dcfbebc2199f32e97efbd82e4711f00f..519ad14821c401c1cca201f2a2b02cb503bbfd83" +}] diff --git a/test/corpus/diff-summaries/javascript/var-declaration.json b/test/corpus/diff-summaries/javascript/var-declaration.json new file mode 100644 index 000000000..9413317f8 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/var-declaration.json @@ -0,0 +1,527 @@ +[{ + "testCaseDescription": "javascript-var-declaration-insert-test", + "expectedResult": { + "changes": { + "var-declaration.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'x' variable" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index e69de29b..b506100a 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -0,0 +1 @@", + "+var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "074b11388910f403aab4a975e06626792b23aca4..a702ccd30aed98e5ff899c18985dec20177ba75a" +} +,{ + "testCaseDescription": "javascript-var-declaration-replacement-insert-test", + "expectedResult": { + "changes": { + "var-declaration.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x' variable" + }, + { + "span": { + "insert": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Added the 'y' variable" + }, + { + "span": { + "insert": { + "start": [ + 1, + 16 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Added the 'z' variable" + }, + { + "span": { + "insert": { + "start": [ + 2, + 5 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the 'x' variable" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index b506100a..b08ebfb5 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1 +1,3 @@", + "+var x, y = {}, z;", + "+var x = 1;", + " var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a702ccd30aed98e5ff899c18985dec20177ba75a..dedf9eb86128863958baa2c719eee2c2365fd38f" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-insert-test", + "expectedResult": { + "changes": { + "var-declaration.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 10 + ] + } + ] + }, + "summary": "Replaced the 'x' variable with the 'x' variable" + }, + { + "span": { + "delete": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Deleted the 'y' variable" + }, + { + "span": { + "delete": { + "start": [ + 1, + 16 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'z' variable" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index b08ebfb5..adc261e0 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,3 +1,3 @@", + "-var x, y = {}, z;", + "+var x = 1;", + " var x = 1;", + " var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dedf9eb86128863958baa2c719eee2c2365fd38f..3ac59a2a32659d91ac268d9fdb9128290ef16cfc" +} +,{ + "testCaseDescription": "javascript-var-declaration-replacement-test", + "expectedResult": { + "changes": { + "var-declaration.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 10 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'x' variable with the 'x' variable" + }, + { + "span": { + "insert": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Added the 'y' variable" + }, + { + "span": { + "insert": { + "start": [ + 1, + 16 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Added the 'z' variable" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index adc261e0..b08ebfb5 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,3 +1,3 @@", + "-var x = 1;", + "+var x, y = {}, z;", + " var x = 1;", + " var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3ac59a2a32659d91ac268d9fdb9128290ef16cfc..8d6a28ccf03158a8e6340a93d09c47328177d318" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-replacement-test", + "expectedResult": { + "changes": { + "var-declaration.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' variable" + }, + { + "span": { + "delete": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Deleted the 'y' variable" + }, + { + "span": { + "delete": { + "start": [ + 1, + 16 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'z' variable" + }, + { + "span": { + "delete": { + "start": [ + 2, + 5 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the 'x' variable" + }, + { + "span": { + "insert": { + "start": [ + 2, + 5 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'x' variable" + }, + { + "span": { + "insert": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 14 + ] + } + }, + "summary": "Added the 'y' variable" + }, + { + "span": { + "insert": { + "start": [ + 2, + 16 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Added the 'z' variable" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index b08ebfb5..514f7c48 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,3 +1,2 @@", + "-var x, y = {}, z;", + "-var x = 1;", + " var x = 1;", + "+var x, y = {}, z;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8d6a28ccf03158a8e6340a93d09c47328177d318..898d568a47e9c92b96c697433e83aaecbfc571ee" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-test", + "expectedResult": { + "changes": { + "var-declaration.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'x' variable" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index 514f7c48..9fc69e2f 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,2 +1 @@", + "-var x = 1;", + " var x, y = {}, z;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "898d568a47e9c92b96c697433e83aaecbfc571ee..8e6e21fcf3109e0e23aaeadbabaa26c5b6b65970" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-rest-test", + "expectedResult": { + "changes": { + "var-declaration.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' variable" + }, + { + "span": { + "delete": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 14 + ] + } + }, + "summary": "Deleted the 'y' variable" + }, + { + "span": { + "delete": { + "start": [ + 1, + 16 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'z' variable" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index 9fc69e2f..e69de29b 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1 +0,0 @@", + "-var x, y = {}, z;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8e6e21fcf3109e0e23aaeadbabaa26c5b6b65970..b2dce4d2365759cf652927b76a86ca88c71cb3ad" +}] diff --git a/test/corpus/diff-summaries/javascript/variable.json b/test/corpus/diff-summaries/javascript/variable.json new file mode 100644 index 000000000..8bc05ac6f --- /dev/null +++ b/test/corpus/diff-summaries/javascript/variable.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-variable-insert-test", + "expectedResult": { + "changes": { + "variable.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index e69de29b..1cf4ad05 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -0,0 +1 @@", + "+theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "efab78a691fb93905e88ae443c8324acedc55608..696f6d22c1e72a2cdecc55ae3385117149afa6ae" +} +,{ + "testCaseDescription": "javascript-variable-replacement-insert-test", + "expectedResult": { + "changes": { + "variable.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'theVar2' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 1cf4ad05..888855ad 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1 +1,3 @@", + "+theVar2", + "+theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "696f6d22c1e72a2cdecc55ae3385117149afa6ae..ec5880708208b82b42936cf282184ed5b5d09540" +} +,{ + "testCaseDescription": "javascript-variable-delete-insert-test", + "expectedResult": { + "changes": { + "variable.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'theVar2' identifier with the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 888855ad..60e041c1 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,3 +1,3 @@", + "-theVar2", + "+theVar;", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ec5880708208b82b42936cf282184ed5b5d09540..2d42dd988af2506cd2c2bf5745d0330eb566a9f9" +} +,{ + "testCaseDescription": "javascript-variable-replacement-test", + "expectedResult": { + "changes": { + "variable.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced the 'theVar' identifier with the 'theVar2' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 60e041c1..888855ad 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,3 +1,3 @@", + "-theVar;", + "+theVar2", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2d42dd988af2506cd2c2bf5745d0330eb566a9f9..cb6bcd8e70905a2a894234ded659efd79401549f" +} +,{ + "testCaseDescription": "javascript-variable-delete-replacement-test", + "expectedResult": { + "changes": { + "variable.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'theVar2' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'theVar' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'theVar2' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 888855ad..fbc7b28e 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,3 +1,2 @@", + "-theVar2", + "-theVar;", + " theVar;", + "+theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cb6bcd8e70905a2a894234ded659efd79401549f..83e306ef5a0e9632ea0510c7ae6bc93e87aa515e" +} +,{ + "testCaseDescription": "javascript-variable-delete-test", + "expectedResult": { + "changes": { + "variable.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'theVar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index fbc7b28e..7276d95d 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,2 +1 @@", + "-theVar;", + " theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "83e306ef5a0e9632ea0510c7ae6bc93e87aa515e..9616b1bcc7b2849be638e757ef8ee23dfdefa3ec" +} +,{ + "testCaseDescription": "javascript-variable-delete-rest-test", + "expectedResult": { + "changes": { + "variable.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'theVar2' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 7276d95d..e69de29b 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1 +0,0 @@", + "-theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9616b1bcc7b2849be638e757ef8ee23dfdefa3ec..2e3b3e74fb24767ec84840379177e8834c44714f" +}] diff --git a/test/corpus/diff-summaries/javascript/void-operator.json b/test/corpus/diff-summaries/javascript/void-operator.json new file mode 100644 index 000000000..a2bf74ef0 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/void-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "javascript-void-operator-insert-test", + "expectedResult": { + "changes": { + "void-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Added the 'void b()' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index e69de29b..02aa7503 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -0,0 +1 @@", + "+void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "788020560a8fdb300dff202c696815f281416456..dc92b964674c0dc509386941bd2d45bf1f91dc94" +} +,{ + "testCaseDescription": "javascript-void-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "void-operator.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Added the 'void c()' operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Added the 'void b()' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index 02aa7503..c493dc5b 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1 +1,3 @@", + "+void c()", + "+void b()", + " void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dc92b964674c0dc509386941bd2d45bf1f91dc94..832e094bb5fed9529d10252fb117c51b09953266" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-insert-test", + "expectedResult": { + "changes": { + "void-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'c' identifier with the 'b' identifier in the b() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index c493dc5b..aae2f633 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,3 +1,3 @@", + "-void c()", + "+void b()", + " void b()", + " void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "832e094bb5fed9529d10252fb117c51b09953266..1b85cc3f2c1a8d8f0c70d58ac71f8a73bef4f1cc" +} +,{ + "testCaseDescription": "javascript-void-operator-replacement-test", + "expectedResult": { + "changes": { + "void-operator.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'c' identifier in the c() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index aae2f633..c493dc5b 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,3 +1,3 @@", + "-void b()", + "+void c()", + " void b()", + " void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1b85cc3f2c1a8d8f0c70d58ac71f8a73bef4f1cc..ef13ba3f92b4fc71daefbe42bb5a183e86462df1" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "void-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted the 'void c()' operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Deleted the 'void b()' operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Added the 'void c()' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index c493dc5b..738c34a4 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,3 +1,2 @@", + "-void c()", + "-void b()", + " void b()", + "+void c()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ef13ba3f92b4fc71daefbe42bb5a183e86462df1..eb8362cf1113ee2a6f38f316ef99c21be01d3998" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-test", + "expectedResult": { + "changes": { + "void-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted the 'void b()' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index 738c34a4..8e9ceba2 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,2 +1 @@", + "-void b()", + " void c()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "eb8362cf1113ee2a6f38f316ef99c21be01d3998..90bb7ed797c75beba669a426a3c6276023b92b83" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-rest-test", + "expectedResult": { + "changes": { + "void-operator.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted the 'void c()' operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index 8e9ceba2..e69de29b 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1 +0,0 @@", + "-void c()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "90bb7ed797c75beba669a426a3c6276023b92b83..e063f0fd0c7f4b192b39469a0e1641349a596147" +}] diff --git a/test/corpus/diff-summaries/javascript/while-statement.json b/test/corpus/diff-summaries/javascript/while-statement.json new file mode 100644 index 000000000..9e4c7db5f --- /dev/null +++ b/test/corpus/diff-summaries/javascript/while-statement.json @@ -0,0 +1,401 @@ +[{ + "testCaseDescription": "javascript-while-statement-insert-test", + "expectedResult": { + "changes": { + "while-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the 'a' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index e69de29b..1ea2800e 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -0,0 +1 @@", + "+while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a43b37a27c89c6d1f96f5a83f5498c56b9e45338..921c4227b76024fcaabc893c433f997961e2a269" +} +,{ + "testCaseDescription": "javascript-while-statement-replacement-insert-test", + "expectedResult": { + "changes": { + "while-statement.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the 'b' while statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 19 + ] + } + }, + "summary": "Added the 'a' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index 1ea2800e..c322323d 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1 +1,3 @@", + "+while (b) { a(); };", + "+while (a) { b(); };", + " while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "921c4227b76024fcaabc893c433f997961e2a269..f74c514c68d3fe1b1d52f848f19f9160cc9cbbfb" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-insert-test", + "expectedResult": { + "changes": { + "while-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 13 + ], + "end": [ + 1, + 14 + ] + }, + { + "start": [ + 1, + 13 + ], + "end": [ + 1, + 14 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier in the b() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index c322323d..ea967164 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,3 +1,3 @@", + "-while (b) { a(); };", + "+while (a) { b(); };", + " while (a) { b(); };", + " while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f74c514c68d3fe1b1d52f848f19f9160cc9cbbfb..95f6613fea9dc54d5844d30b98ae5870cdf48573" +} +,{ + "testCaseDescription": "javascript-while-statement-replacement-test", + "expectedResult": { + "changes": { + "while-statement.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'b' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 13 + ], + "end": [ + 1, + 14 + ] + }, + { + "start": [ + 1, + 13 + ], + "end": [ + 1, + 14 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'a' identifier in the a() function call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index ea967164..c322323d 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,3 +1,3 @@", + "-while (a) { b(); };", + "+while (b) { a(); };", + " while (a) { b(); };", + " while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "95f6613fea9dc54d5844d30b98ae5870cdf48573..808eca07d620aa12249b3dc5e705216e7f524fed" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-replacement-test", + "expectedResult": { + "changes": { + "while-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the 'b' while statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 19 + ] + } + }, + "summary": "Deleted the 'a' while statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 19 + ] + } + }, + "summary": "Added the 'b' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index c322323d..28f4b210 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,3 +1,2 @@", + "-while (b) { a(); };", + "-while (a) { b(); };", + " while (a) { b(); };", + "+while (b) { a(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "808eca07d620aa12249b3dc5e705216e7f524fed..a7d9a5e1e7803e5841da84f1009fa272570ba6d5" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-test", + "expectedResult": { + "changes": { + "while-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the 'a' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index 28f4b210..e185b25d 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,2 +1 @@", + "-while (a) { b(); };", + " while (b) { a(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a7d9a5e1e7803e5841da84f1009fa272570ba6d5..5444eb3ca4168ec227cc4c91dac971751b705304" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-rest-test", + "expectedResult": { + "changes": { + "while-statement.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the 'b' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index e185b25d..e69de29b 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1 +0,0 @@", + "-while (b) { a(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5444eb3ca4168ec227cc4c91dac971751b705304..48d3ef87f99a7129141975782e612cef84f46829" +}] diff --git a/test/corpus/diff-summaries/javascript/yield.json b/test/corpus/diff-summaries/javascript/yield.json new file mode 100644 index 000000000..c72919274 --- /dev/null +++ b/test/corpus/diff-summaries/javascript/yield.json @@ -0,0 +1,256 @@ +[{ + "testCaseDescription": "javascript-yield-setup-test", + "expectedResult": { + "changes": { + "yield.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 35 + ] + } + }, + "summary": "Added the 'foo' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.js" + ], + "patch": [ + "diff --git a/yield.js b/yield.js", + "index e69de29b..e01b17c7 100644", + "--- a/yield.js", + "+++ b/yield.js", + "@@ -0,0 +1 @@", + "+function* foo(){ var index = 0; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f270d7e7af308e5cacc3d7334905fd5f2308dc19..cc9412be0dd1f1f5eddca6f512aa879757063215" +} +,{ + "testCaseDescription": "javascript-yield-insert-test", + "expectedResult": { + "changes": { + "yield.js": [ + { + "span": { + "insert": { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 41 + ] + } + }, + "summary": "Added the 'i' yield statement in the foo function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.js" + ], + "patch": [ + "diff --git a/yield.js b/yield.js", + "index e01b17c7..e2088166 100644", + "--- a/yield.js", + "+++ b/yield.js", + "@@ -1 +1 @@", + "-function* foo(){ var index = 0; }", + "+function* foo(){ var index = 0; yield i; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cc9412be0dd1f1f5eddca6f512aa879757063215..e1ce13cacba4d820e4e0bc77a576197e3d3030b2" +} +,{ + "testCaseDescription": "javascript-yield-replacement-test", + "expectedResult": { + "changes": { + "yield.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 41 + ] + }, + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 43 + ] + } + ] + }, + "summary": "Replaced the 'i' yield statement with the 'i++' yield statement in the foo function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.js" + ], + "patch": [ + "diff --git a/yield.js b/yield.js", + "index e2088166..78ab2efe 100644", + "--- a/yield.js", + "+++ b/yield.js", + "@@ -1 +1 @@", + "-function* foo(){ var index = 0; yield i; }", + "+function* foo(){ var index = 0; yield i++; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e1ce13cacba4d820e4e0bc77a576197e3d3030b2..5caecd28de588770be0c79798e8d6b3a6c1b1812" +} +,{ + "testCaseDescription": "javascript-yield-delete-replacement-test", + "expectedResult": { + "changes": { + "yield.js": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 43 + ] + }, + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 41 + ] + } + ] + }, + "summary": "Replaced the 'i++' yield statement with the 'i' yield statement in the foo function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.js" + ], + "patch": [ + "diff --git a/yield.js b/yield.js", + "index 78ab2efe..e2088166 100644", + "--- a/yield.js", + "+++ b/yield.js", + "@@ -1 +1 @@", + "-function* foo(){ var index = 0; yield i++; }", + "+function* foo(){ var index = 0; yield i; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5caecd28de588770be0c79798e8d6b3a6c1b1812..8b3f9678278a669487ab346c887d6808877845c6" +} +,{ + "testCaseDescription": "javascript-yield-delete-insert-test", + "expectedResult": { + "changes": { + "yield.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 41 + ] + } + }, + "summary": "Deleted the 'i' yield statement in the foo function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.js" + ], + "patch": [ + "diff --git a/yield.js b/yield.js", + "index e2088166..e01b17c7 100644", + "--- a/yield.js", + "+++ b/yield.js", + "@@ -1 +1 @@", + "-function* foo(){ var index = 0; yield i; }", + "+function* foo(){ var index = 0; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8b3f9678278a669487ab346c887d6808877845c6..05e952680260bc7b3b3229c13a91241e24ae7d79" +} +,{ + "testCaseDescription": "javascript-yield-teardown-test", + "expectedResult": { + "changes": { + "yield.js": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 35 + ] + } + }, + "summary": "Deleted the 'foo' function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.js" + ], + "patch": [ + "diff --git a/yield.js b/yield.js", + "index e01b17c7..e69de29b 100644", + "--- a/yield.js", + "+++ b/yield.js", + "@@ -1 +0,0 @@", + "-function* foo(){ var index = 0; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "05e952680260bc7b3b3229c13a91241e24ae7d79..b325b0598f3778c6c970adad5ed229e1b5633f8d" +}] diff --git a/test/corpus/diff-summaries/ruby/and-or.json b/test/corpus/diff-summaries/ruby/and-or.json new file mode 100644 index 000000000..9e9fa42f9 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/and-or.json @@ -0,0 +1,383 @@ +[{ + "testCaseDescription": "ruby-and-or-insert-test", + "expectedResult": { + "changes": { + "and-or.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Added the 'foo and bar' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "and-or.rb" + ], + "patch": [ + "diff --git a/and-or.rb b/and-or.rb", + "index e69de29..8e828c0 100644", + "--- a/and-or.rb", + "+++ b/and-or.rb", + "@@ -0,0 +1 @@", + "+foo and bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cb1564b73681fa50073f0458c77da34ccc744eec..bc13b332ee8d9e7f7ebe0acdea69bb38b51c8a90" +} +,{ + "testCaseDescription": "ruby-and-or-replacement-insert-test", + "expectedResult": { + "changes": { + "and-or.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the 'foo or bar' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the 'a or b and c' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 12 + ] + } + }, + "summary": "Added the 'foo and bar' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "and-or.rb" + ], + "patch": [ + "diff --git a/and-or.rb b/and-or.rb", + "index 8e828c0..fe52247 100644", + "--- a/and-or.rb", + "+++ b/and-or.rb", + "@@ -1 +1,4 @@", + "+foo or bar", + "+a or b and c", + "+foo and bar", + " foo and bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "bc13b332ee8d9e7f7ebe0acdea69bb38b51c8a90..8b185ecfea7ea33ebea5a731deed9dd577f3bdfa" +} +,{ + "testCaseDescription": "ruby-and-or-delete-insert-test", + "expectedResult": { + "changes": { + "and-or.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + ] + }, + "summary": "Replaced the 'foo or bar' binary statement with the 'foo and bar' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Deleted the 'a or b and c' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "and-or.rb" + ], + "patch": [ + "diff --git a/and-or.rb b/and-or.rb", + "index fe52247..b09c067 100644", + "--- a/and-or.rb", + "+++ b/and-or.rb", + "@@ -1,4 +1,3 @@", + "-foo or bar", + "-a or b and c", + "+foo and bar", + " foo and bar", + " foo and bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8b185ecfea7ea33ebea5a731deed9dd577f3bdfa..bffbb017c0ef0db3e028b1893f56270a4a0d1da9" +} +,{ + "testCaseDescription": "ruby-and-or-replacement-test", + "expectedResult": { + "changes": { + "and-or.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced the 'foo and bar' binary statement with the 'foo or bar' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the 'a or b and c' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "and-or.rb" + ], + "patch": [ + "diff --git a/and-or.rb b/and-or.rb", + "index b09c067..fe52247 100644", + "--- a/and-or.rb", + "+++ b/and-or.rb", + "@@ -1,3 +1,4 @@", + "-foo and bar", + "+foo or bar", + "+a or b and c", + " foo and bar", + " foo and bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "bffbb017c0ef0db3e028b1893f56270a4a0d1da9..b1a8efd497ef1bd9b6910900fdaeab197358d11b" +} +,{ + "testCaseDescription": "ruby-and-or-delete-replacement-test", + "expectedResult": { + "changes": { + "and-or.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 12 + ] + } + }, + "summary": "Deleted the 'foo and bar' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "and-or.rb" + ], + "patch": [ + "diff --git a/and-or.rb b/and-or.rb", + "index fe52247..a621325 100644", + "--- a/and-or.rb", + "+++ b/and-or.rb", + "@@ -1,4 +1,3 @@", + "+foo and bar", + " foo or bar", + " a or b and c", + "-foo and bar", + "-foo and bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b1a8efd497ef1bd9b6910900fdaeab197358d11b..21cd733ee050829ec0dad2f573846c8dacb2d78d" +} +,{ + "testCaseDescription": "ruby-and-or-delete-test", + "expectedResult": { + "changes": { + "and-or.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the 'foo and bar' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "and-or.rb" + ], + "patch": [ + "diff --git a/and-or.rb b/and-or.rb", + "index a621325..d2060f6 100644", + "--- a/and-or.rb", + "+++ b/and-or.rb", + "@@ -1,3 +1,2 @@", + "-foo and bar", + " foo or bar", + " a or b and c" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "21cd733ee050829ec0dad2f573846c8dacb2d78d..7275af3611c129c0be6ff258e00f4a3d8027a123" +} +,{ + "testCaseDescription": "ruby-and-or-delete-rest-test", + "expectedResult": { + "changes": { + "and-or.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the 'foo or bar' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Deleted the 'a or b and c' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "and-or.rb" + ], + "patch": [ + "diff --git a/and-or.rb b/and-or.rb", + "index d2060f6..e69de29 100644", + "--- a/and-or.rb", + "+++ b/and-or.rb", + "@@ -1,2 +0,0 @@", + "-foo or bar", + "-a or b and c" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7275af3611c129c0be6ff258e00f4a3d8027a123..2ff905a98a2dc39fc75453b6c88896e443c79021" +}] diff --git a/test/corpus/diff-summaries/ruby/array.json b/test/corpus/diff-summaries/ruby/array.json new file mode 100644 index 000000000..10c8a9aa8 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/array.json @@ -0,0 +1,473 @@ +[{ + "testCaseDescription": "ruby-array-insert-test", + "expectedResult": { + "changes": { + "array.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the '[ 1, 2, 3]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.rb" + ], + "patch": [ + "diff --git a/array.rb b/array.rb", + "index e69de29..a900520 100644", + "--- a/array.rb", + "+++ b/array.rb", + "@@ -0,0 +1 @@", + "+[ 1, 2, 3]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9fae8330e922eddbf4df2dbc2d15f8106defa0d6..a5a88f40d180baf8850c95fd7f81ea819369d8a0" +} +,{ + "testCaseDescription": "ruby-array-replacement-insert-test", + "expectedResult": { + "changes": { + "array.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 16 + ] + } + }, + "summary": "Added the '['a', 'b', 'c']' array" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Added the '[ 1, 2, 3]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.rb" + ], + "patch": [ + "diff --git a/array.rb b/array.rb", + "index a900520..c3ae0a1 100644", + "--- a/array.rb", + "+++ b/array.rb", + "@@ -1 +1,3 @@", + "+['a', 'b', 'c']", + "+[ 1, 2, 3]", + " [ 1, 2, 3]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a5a88f40d180baf8850c95fd7f81ea819369d8a0..31d085fb5ca04b49df6b583e899def634d1b0086" +} +,{ + "testCaseDescription": "ruby-array-delete-insert-test", + "expectedResult": { + "changes": { + "array.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added '1'" + }, + { + "span": { + "insert": { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added '2'" + }, + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added '3'" + }, + { + "span": { + "delete": { + "start": [ + 1, + 2 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'a' string" + }, + { + "span": { + "delete": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'b' string" + }, + { + "span": { + "delete": { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'c' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.rb" + ], + "patch": [ + "diff --git a/array.rb b/array.rb", + "index c3ae0a1..9d0ec26 100644", + "--- a/array.rb", + "+++ b/array.rb", + "@@ -1,3 +1,3 @@", + "-['a', 'b', 'c']", + "+[ 1, 2, 3]", + " [ 1, 2, 3]", + " [ 1, 2, 3]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "31d085fb5ca04b49df6b583e899def634d1b0086..e95a50c66174808786e54c936231db01dd069821" +} +,{ + "testCaseDescription": "ruby-array-replacement-test", + "expectedResult": { + "changes": { + "array.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 2 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'a' string" + }, + { + "span": { + "insert": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'b' string" + }, + { + "span": { + "insert": { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the 'c' string" + }, + { + "span": { + "delete": { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted '1'" + }, + { + "span": { + "delete": { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted '2'" + }, + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted '3'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.rb" + ], + "patch": [ + "diff --git a/array.rb b/array.rb", + "index 9d0ec26..c3ae0a1 100644", + "--- a/array.rb", + "+++ b/array.rb", + "@@ -1,3 +1,3 @@", + "-[ 1, 2, 3]", + "+['a', 'b', 'c']", + " [ 1, 2, 3]", + " [ 1, 2, 3]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e95a50c66174808786e54c936231db01dd069821..614cc502fe7ab9ac4c636c48ef99c2f2cb10c9d0" +} +,{ + "testCaseDescription": "ruby-array-delete-replacement-test", + "expectedResult": { + "changes": { + "array.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 16 + ] + } + }, + "summary": "Deleted the '['a', 'b', 'c']' array" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Deleted the '[ 1, 2, 3]' array" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 16 + ] + } + }, + "summary": "Added the '['a', 'b', 'c']' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.rb" + ], + "patch": [ + "diff --git a/array.rb b/array.rb", + "index c3ae0a1..102a972 100644", + "--- a/array.rb", + "+++ b/array.rb", + "@@ -1,3 +1,2 @@", + "-['a', 'b', 'c']", + "-[ 1, 2, 3]", + " [ 1, 2, 3]", + "+['a', 'b', 'c']" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "614cc502fe7ab9ac4c636c48ef99c2f2cb10c9d0..2fa6b0f737de07b8b62ba097eeca43d0ae15b944" +} +,{ + "testCaseDescription": "ruby-array-delete-test", + "expectedResult": { + "changes": { + "array.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the '[ 1, 2, 3]' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.rb" + ], + "patch": [ + "diff --git a/array.rb b/array.rb", + "index 102a972..939152e 100644", + "--- a/array.rb", + "+++ b/array.rb", + "@@ -1,2 +1 @@", + "-[ 1, 2, 3]", + " ['a', 'b', 'c']" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2fa6b0f737de07b8b62ba097eeca43d0ae15b944..71b5b73aad6ab9f8738dc04fc514bf74a1ade7c8" +} +,{ + "testCaseDescription": "ruby-array-delete-rest-test", + "expectedResult": { + "changes": { + "array.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 16 + ] + } + }, + "summary": "Deleted the '['a', 'b', 'c']' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "array.rb" + ], + "patch": [ + "diff --git a/array.rb b/array.rb", + "index 939152e..e69de29 100644", + "--- a/array.rb", + "+++ b/array.rb", + "@@ -1 +0,0 @@", + "-['a', 'b', 'c']" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "71b5b73aad6ab9f8738dc04fc514bf74a1ade7c8..55f10a51d28326bd851c2aee8b82fc4ec818357b" +}] diff --git a/test/corpus/diff-summaries/ruby/assignment.json b/test/corpus/diff-summaries/ruby/assignment.json new file mode 100644 index 000000000..b570ef03f --- /dev/null +++ b/test/corpus/diff-summaries/ruby/assignment.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-assignment-insert-test", + "expectedResult": { + "changes": { + "assignment.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.rb" + ], + "patch": [ + "diff --git a/assignment.rb b/assignment.rb", + "index e69de29..3aea0c5 100644", + "--- a/assignment.rb", + "+++ b/assignment.rb", + "@@ -0,0 +1 @@", + "+x = 0" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "40ddeab1794ffd56578b63bcea8a678e08f5ece8..8460806eb0b1baffb2b751ce1bc537605c36d25c" +} +,{ + "testCaseDescription": "ruby-assignment-replacement-insert-test", + "expectedResult": { + "changes": { + "assignment.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.rb" + ], + "patch": [ + "diff --git a/assignment.rb b/assignment.rb", + "index 3aea0c5..80ff640 100644", + "--- a/assignment.rb", + "+++ b/assignment.rb", + "@@ -1 +1,3 @@", + "+x = 1", + "+x = 0", + " x = 0" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8460806eb0b1baffb2b751ce1bc537605c36d25c..82dbd771dfe4fe8f86f45720900618222f57ff4d" +} +,{ + "testCaseDescription": "ruby-assignment-delete-insert-test", + "expectedResult": { + "changes": { + "assignment.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced '1' with '0' in an assignment to x" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.rb" + ], + "patch": [ + "diff --git a/assignment.rb b/assignment.rb", + "index 80ff640..e9580bc 100644", + "--- a/assignment.rb", + "+++ b/assignment.rb", + "@@ -1,3 +1,3 @@", + "-x = 1", + "+x = 0", + " x = 0", + " x = 0" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "82dbd771dfe4fe8f86f45720900618222f57ff4d..c1e37f10b940f8ef24d8fb1a8bc2a129e83aa52c" +} +,{ + "testCaseDescription": "ruby-assignment-replacement-test", + "expectedResult": { + "changes": { + "assignment.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced '0' with '1' in an assignment to x" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.rb" + ], + "patch": [ + "diff --git a/assignment.rb b/assignment.rb", + "index e9580bc..80ff640 100644", + "--- a/assignment.rb", + "+++ b/assignment.rb", + "@@ -1,3 +1,3 @@", + "-x = 0", + "+x = 1", + " x = 0", + " x = 0" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c1e37f10b940f8ef24d8fb1a8bc2a129e83aa52c..d903481d57a5c88ae863d47055218f7a04edc44d" +} +,{ + "testCaseDescription": "ruby-assignment-delete-replacement-test", + "expectedResult": { + "changes": { + "assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.rb" + ], + "patch": [ + "diff --git a/assignment.rb b/assignment.rb", + "index 80ff640..2465cb3 100644", + "--- a/assignment.rb", + "+++ b/assignment.rb", + "@@ -1,3 +1,2 @@", + "-x = 1", + "-x = 0", + " x = 0", + "+x = 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d903481d57a5c88ae863d47055218f7a04edc44d..81fecf2dba880a3fdfc8c0e489a02e4e06268f81" +} +,{ + "testCaseDescription": "ruby-assignment-delete-test", + "expectedResult": { + "changes": { + "assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.rb" + ], + "patch": [ + "diff --git a/assignment.rb b/assignment.rb", + "index 2465cb3..7d4290a 100644", + "--- a/assignment.rb", + "+++ b/assignment.rb", + "@@ -1,2 +1 @@", + "-x = 0", + " x = 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "81fecf2dba880a3fdfc8c0e489a02e4e06268f81..cf6964d3263096d3a3c5bbaf0eeaccaf14067e88" +} +,{ + "testCaseDescription": "ruby-assignment-delete-rest-test", + "expectedResult": { + "changes": { + "assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "assignment.rb" + ], + "patch": [ + "diff --git a/assignment.rb b/assignment.rb", + "index 7d4290a..e69de29 100644", + "--- a/assignment.rb", + "+++ b/assignment.rb", + "@@ -1 +0,0 @@", + "-x = 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cf6964d3263096d3a3c5bbaf0eeaccaf14067e88..2cdebaab8d402bbecd5ad02e9fe17cf082e7d55b" +}] diff --git a/test/corpus/diff-summaries/ruby/begin-block.json b/test/corpus/diff-summaries/ruby/begin-block.json new file mode 100644 index 000000000..81f2841a6 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/begin-block.json @@ -0,0 +1,410 @@ +[{ + "testCaseDescription": "ruby-begin-block-insert-test", + "expectedResult": { + "changes": { + "begin-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 2 + ] + } + }, + "summary": "Added a BEGIN block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin-block.rb" + ], + "patch": [ + "diff --git a/begin-block.rb b/begin-block.rb", + "index e69de29..689ee83 100644", + "--- a/begin-block.rb", + "+++ b/begin-block.rb", + "@@ -0,0 +1,3 @@", + "+BEGIN {", + "+ foo", + "+}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "03a751d043f1bc44ab9eae085bfde59af2495a68..f49a537446aae0dbbabb805cb2837324170ccabe" +} +,{ + "testCaseDescription": "ruby-begin-block-replacement-insert-test", + "expectedResult": { + "changes": { + "begin-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added the 'foo' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Added a BEGIN block" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Added a BEGIN block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin-block.rb" + ], + "patch": [ + "diff --git a/begin-block.rb b/begin-block.rb", + "index 689ee83..6d35684 100644", + "--- a/begin-block.rb", + "+++ b/begin-block.rb", + "@@ -1,3 +1,10 @@", + "+foo", + "+BEGIN {", + "+ bar", + "+}", + "+BEGIN {", + "+ foo", + "+}", + " BEGIN {", + " foo", + " }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f49a537446aae0dbbabb805cb2837324170ccabe..cc282f13854c118436fbaddd0edf810bb34089ff" +} +,{ + "testCaseDescription": "ruby-begin-block-delete-insert-test", + "expectedResult": { + "changes": { + "begin-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 2 + ] + } + }, + "summary": "Added a BEGIN block" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Deleted a BEGIN block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin-block.rb" + ], + "patch": [ + "diff --git a/begin-block.rb b/begin-block.rb", + "index 6d35684..59f3ea8 100644", + "--- a/begin-block.rb", + "+++ b/begin-block.rb", + "@@ -1,6 +1,5 @@", + "-foo", + " BEGIN {", + "- bar", + "+ foo", + " }", + " BEGIN {", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cc282f13854c118436fbaddd0edf810bb34089ff..127068078b1f33278c78727939ae44ea3bb56669" +} +,{ + "testCaseDescription": "ruby-begin-block-replacement-test", + "expectedResult": { + "changes": { + "begin-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added the 'foo' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 2 + ], + "end": [ + 2, + 5 + ] + }, + { + "start": [ + 3, + 2 + ], + "end": [ + 3, + 5 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in a BEGIN block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin-block.rb" + ], + "patch": [ + "diff --git a/begin-block.rb b/begin-block.rb", + "index 59f3ea8..6d35684 100644", + "--- a/begin-block.rb", + "+++ b/begin-block.rb", + "@@ -1,5 +1,6 @@", + "+foo", + " BEGIN {", + "- foo", + "+ bar", + " }", + " BEGIN {", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "127068078b1f33278c78727939ae44ea3bb56669..c383974184ea4cdde2f9267d5f3e349d1d9a15ea" +} +,{ + "testCaseDescription": "ruby-begin-block-delete-replacement-test", + "expectedResult": { + "changes": { + "begin-block.rb": [ + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 10, + 2 + ] + } + }, + "summary": "Deleted a BEGIN block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin-block.rb" + ], + "patch": [ + "diff --git a/begin-block.rb b/begin-block.rb", + "index 6d35684..422d4eb 100644", + "--- a/begin-block.rb", + "+++ b/begin-block.rb", + "@@ -1,10 +1,7 @@", + "-foo", + "-BEGIN {", + "- bar", + "-}", + " BEGIN {", + " foo", + " }", + "+foo", + " BEGIN {", + "- foo", + "+ bar", + " }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c383974184ea4cdde2f9267d5f3e349d1d9a15ea..0c80ecb1555e53e9840e415d79da2364c203a137" +} +,{ + "testCaseDescription": "ruby-begin-block-delete-test", + "expectedResult": { + "changes": { + "begin-block.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 2 + ] + } + }, + "summary": "Deleted a BEGIN block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin-block.rb" + ], + "patch": [ + "diff --git a/begin-block.rb b/begin-block.rb", + "index 422d4eb..a936ce1 100644", + "--- a/begin-block.rb", + "+++ b/begin-block.rb", + "@@ -1,6 +1,3 @@", + "-BEGIN {", + "- foo", + "-}", + " foo", + " BEGIN {", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0c80ecb1555e53e9840e415d79da2364c203a137..105174fafe27003c0e1d9ce859589eed676626cd" +} +,{ + "testCaseDescription": "ruby-begin-block-delete-rest-test", + "expectedResult": { + "changes": { + "begin-block.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Deleted a BEGIN block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin-block.rb" + ], + "patch": [ + "diff --git a/begin-block.rb b/begin-block.rb", + "index a936ce1..e69de29 100644", + "--- a/begin-block.rb", + "+++ b/begin-block.rb", + "@@ -1,4 +0,0 @@", + "-foo", + "-BEGIN {", + "- bar", + "-}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "105174fafe27003c0e1d9ce859589eed676626cd..5de93fcdb1d807e7d537ecd5843313d1d3acf001" +}] diff --git a/test/corpus/diff-summaries/ruby/begin.json b/test/corpus/diff-summaries/ruby/begin.json new file mode 100644 index 000000000..a52f26d4a --- /dev/null +++ b/test/corpus/diff-summaries/ruby/begin.json @@ -0,0 +1,244 @@ +[{ + "testCaseDescription": "ruby-begin-setup-test", + "expectedResult": { + "changes": { + "begin.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin.rb" + ], + "patch": [ + "diff --git a/begin.rb b/begin.rb", + "index e69de29..ff7bbbe 100644", + "--- a/begin.rb", + "+++ b/begin.rb", + "@@ -0,0 +1,2 @@", + "+def foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1f3f678261048f8b6cd7f6c9c9552ddbcdaa9896..ae19234a91073e808e29a46e72bf877a012d7435" +} +,{ + "testCaseDescription": "ruby-begin-insert-test", + "expectedResult": { + "changes": { + "begin.rb": [ + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added a begin statement in the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin.rb" + ], + "patch": [ + "diff --git a/begin.rb b/begin.rb", + "index ff7bbbe..7b4a3be 100644", + "--- a/begin.rb", + "+++ b/begin.rb", + "@@ -1,2 +1,4 @@", + " def foo", + "+begin", + "+end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ae19234a91073e808e29a46e72bf877a012d7435..82a4978fe7894d35888f5ce085d7143d5875cbe9" +} +,{ + "testCaseDescription": "ruby-begin-replacement-test", + "expectedResult": { + "changes": { + "begin.rb": [ + { + "span": { + "insert": { + "start": [ + 3, + 3 + ], + "end": [ + 3, + 12 + ] + } + }, + "summary": "Added the 'puts('hi')' method call in a begin statement of the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin.rb" + ], + "patch": [ + "diff --git a/begin.rb b/begin.rb", + "index 7b4a3be..7879e55 100644", + "--- a/begin.rb", + "+++ b/begin.rb", + "@@ -1,4 +1,5 @@", + " def foo", + " begin", + "+ puts 'hi'", + " end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "82a4978fe7894d35888f5ce085d7143d5875cbe9..304bb021b0376a95849ea5667aea3ba012affe8a" +} +,{ + "testCaseDescription": "ruby-begin-delete-replacement-test", + "expectedResult": { + "changes": { + "begin.rb": [ + { + "span": { + "delete": { + "start": [ + 3, + 3 + ], + "end": [ + 3, + 12 + ] + } + }, + "summary": "Deleted the 'puts('hi')' method call in a begin statement of the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin.rb" + ], + "patch": [ + "diff --git a/begin.rb b/begin.rb", + "index 7879e55..7b4a3be 100644", + "--- a/begin.rb", + "+++ b/begin.rb", + "@@ -1,5 +1,4 @@", + " def foo", + " begin", + "- puts 'hi'", + " end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "304bb021b0376a95849ea5667aea3ba012affe8a..f8b5db9ada2c9dd49af07d5ecf575a699934924b" +} +,{ + "testCaseDescription": "ruby-begin-delete-insert-test", + "expectedResult": { + "changes": { + "begin.rb": [ + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted a begin statement in the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin.rb" + ], + "patch": [ + "diff --git a/begin.rb b/begin.rb", + "index 7b4a3be..ff7bbbe 100644", + "--- a/begin.rb", + "+++ b/begin.rb", + "@@ -1,4 +1,2 @@", + " def foo", + "-begin", + "-end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f8b5db9ada2c9dd49af07d5ecf575a699934924b..42d7d52b24f3b3bbdc80bf8a6676d950ba469398" +} +,{ + "testCaseDescription": "ruby-begin-teardown-test", + "expectedResult": { + "changes": { + "begin.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "begin.rb" + ], + "patch": [ + "diff --git a/begin.rb b/begin.rb", + "index ff7bbbe..e69de29 100644", + "--- a/begin.rb", + "+++ b/begin.rb", + "@@ -1,2 +0,0 @@", + "-def foo", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "42d7d52b24f3b3bbdc80bf8a6676d950ba469398..ae19f1520c4061cc62e675b32b6b1c0154935e03" +}] diff --git a/test/corpus/diff-summaries/ruby/bitwise-operator.json b/test/corpus/diff-summaries/ruby/bitwise-operator.json new file mode 100644 index 000000000..e9ecf50ca --- /dev/null +++ b/test/corpus/diff-summaries/ruby/bitwise-operator.json @@ -0,0 +1,636 @@ +[{ + "testCaseDescription": "ruby-bitwise-operator-insert-test", + "expectedResult": { + "changes": { + "bitwise-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'a | b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'a >> b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added the 'a ^ b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.rb" + ], + "patch": [ + "diff --git a/bitwise-operator.rb b/bitwise-operator.rb", + "index e69de29..a596f03 100644", + "--- a/bitwise-operator.rb", + "+++ b/bitwise-operator.rb", + "@@ -0,0 +1,3 @@", + "+a | b", + "+a >> b", + "+a ^ b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "43e5b394550f6e013c1d5023b8946dfdf52e25f0..e68a7f252d477909eadc96c27f50c9bf61742abd" +} +,{ + "testCaseDescription": "ruby-bitwise-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "bitwise-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'a & b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'a << b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added the 'a | b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added the 'a >> b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 6 + ] + } + }, + "summary": "Added the 'a ^ b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.rb" + ], + "patch": [ + "diff --git a/bitwise-operator.rb b/bitwise-operator.rb", + "index a596f03..826d98f 100644", + "--- a/bitwise-operator.rb", + "+++ b/bitwise-operator.rb", + "@@ -1,3 +1,8 @@", + "+a & b", + "+a << b", + "+a | b", + "+a >> b", + "+a ^ b", + " a | b", + " a >> b", + " a ^ b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e68a7f252d477909eadc96c27f50c9bf61742abd..e0e890c9089e6ac5f4930793725cd9ea2da18bc0" +} +,{ + "testCaseDescription": "ruby-bitwise-operator-delete-insert-test", + "expectedResult": { + "changes": { + "bitwise-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'a & b' binary statement with the 'a | b' binary statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the 'a << b' binary statement with the 'a >> b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added the 'a ^ b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.rb" + ], + "patch": [ + "diff --git a/bitwise-operator.rb b/bitwise-operator.rb", + "index 826d98f..8f874fc 100644", + "--- a/bitwise-operator.rb", + "+++ b/bitwise-operator.rb", + "@@ -1,5 +1,6 @@", + "-a & b", + "-a << b", + "+a | b", + "+a >> b", + "+a ^ b", + " a | b", + " a >> b", + " a ^ b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e0e890c9089e6ac5f4930793725cd9ea2da18bc0..44e977cac2ce8f0c032af49b63826d6bd890073f" +} +,{ + "testCaseDescription": "ruby-bitwise-operator-replacement-test", + "expectedResult": { + "changes": { + "bitwise-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'a | b' binary statement with the 'a & b' binary statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the 'a >> b' binary statement with the 'a << b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Deleted the 'a ^ b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.rb" + ], + "patch": [ + "diff --git a/bitwise-operator.rb b/bitwise-operator.rb", + "index 8f874fc..826d98f 100644", + "--- a/bitwise-operator.rb", + "+++ b/bitwise-operator.rb", + "@@ -1,6 +1,5 @@", + "-a | b", + "-a >> b", + "-a ^ b", + "+a & b", + "+a << b", + " a | b", + " a >> b", + " a ^ b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "44e977cac2ce8f0c032af49b63826d6bd890073f..c376e71cb4bdf1694b0c42bf1effadeb02c68b8c" +} +,{ + "testCaseDescription": "ruby-bitwise-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "bitwise-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'a & b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'a << b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Deleted the 'a | b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Deleted the 'a >> b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 6 + ] + } + }, + "summary": "Deleted the 'a ^ b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'a & b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Added the 'a << b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.rb" + ], + "patch": [ + "diff --git a/bitwise-operator.rb b/bitwise-operator.rb", + "index 826d98f..1a2a6da 100644", + "--- a/bitwise-operator.rb", + "+++ b/bitwise-operator.rb", + "@@ -1,8 +1,5 @@", + "-a & b", + "-a << b", + "-a | b", + "-a >> b", + "-a ^ b", + " a | b", + " a >> b", + " a ^ b", + "+a & b", + "+a << b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c376e71cb4bdf1694b0c42bf1effadeb02c68b8c..a5ae43038a0a3fe9dec980f7c65c4fe109f6f5d6" +} +,{ + "testCaseDescription": "ruby-bitwise-operator-delete-test", + "expectedResult": { + "changes": { + "bitwise-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'a | b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'a >> b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Deleted the 'a ^ b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.rb" + ], + "patch": [ + "diff --git a/bitwise-operator.rb b/bitwise-operator.rb", + "index 1a2a6da..97e763b 100644", + "--- a/bitwise-operator.rb", + "+++ b/bitwise-operator.rb", + "@@ -1,5 +1,2 @@", + "-a | b", + "-a >> b", + "-a ^ b", + " a & b", + " a << b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a5ae43038a0a3fe9dec980f7c65c4fe109f6f5d6..536d38f2281ec10e9a683473c6ee2f120422dde5" +} +,{ + "testCaseDescription": "ruby-bitwise-operator-delete-rest-test", + "expectedResult": { + "changes": { + "bitwise-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'a & b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'a << b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "bitwise-operator.rb" + ], + "patch": [ + "diff --git a/bitwise-operator.rb b/bitwise-operator.rb", + "index 97e763b..e69de29 100644", + "--- a/bitwise-operator.rb", + "+++ b/bitwise-operator.rb", + "@@ -1,2 +0,0 @@", + "-a & b", + "-a << b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "536d38f2281ec10e9a683473c6ee2f120422dde5..61d726641b460d2461b15149863a3c17583ca600" +}] diff --git a/test/corpus/diff-summaries/ruby/boolean-operator.json b/test/corpus/diff-summaries/ruby/boolean-operator.json new file mode 100644 index 000000000..e0a51a7d5 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/boolean-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-boolean-operator-insert-test", + "expectedResult": { + "changes": { + "boolean-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'a || b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.rb" + ], + "patch": [ + "diff --git a/boolean-operator.rb b/boolean-operator.rb", + "index e69de29..ba0778d 100644", + "--- a/boolean-operator.rb", + "+++ b/boolean-operator.rb", + "@@ -0,0 +1 @@", + "+a || b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fc62b0d430cee4f179260f256a053b4b124d6ce4..eb6792519d65c7f8d2eb6a6d341ba3703bd11116" +} +,{ + "testCaseDescription": "ruby-boolean-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "boolean-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'a && b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'a || b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.rb" + ], + "patch": [ + "diff --git a/boolean-operator.rb b/boolean-operator.rb", + "index ba0778d..2d34b94 100644", + "--- a/boolean-operator.rb", + "+++ b/boolean-operator.rb", + "@@ -1 +1,3 @@", + "+a && b", + "+a || b", + " a || b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "eb6792519d65c7f8d2eb6a6d341ba3703bd11116..312ff1a745746c0943c2a66d5cc1af344c98cd94" +} +,{ + "testCaseDescription": "ruby-boolean-operator-delete-insert-test", + "expectedResult": { + "changes": { + "boolean-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'a && b' binary statement with the 'a || b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.rb" + ], + "patch": [ + "diff --git a/boolean-operator.rb b/boolean-operator.rb", + "index 2d34b94..2c61248 100644", + "--- a/boolean-operator.rb", + "+++ b/boolean-operator.rb", + "@@ -1,3 +1,3 @@", + "-a && b", + "+a || b", + " a || b", + " a || b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "312ff1a745746c0943c2a66d5cc1af344c98cd94..3eb45a29d9b8a8b134eb42f567305b1d7b099c52" +} +,{ + "testCaseDescription": "ruby-boolean-operator-replacement-test", + "expectedResult": { + "changes": { + "boolean-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'a || b' binary statement with the 'a && b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.rb" + ], + "patch": [ + "diff --git a/boolean-operator.rb b/boolean-operator.rb", + "index 2c61248..2d34b94 100644", + "--- a/boolean-operator.rb", + "+++ b/boolean-operator.rb", + "@@ -1,3 +1,3 @@", + "-a || b", + "+a && b", + " a || b", + " a || b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3eb45a29d9b8a8b134eb42f567305b1d7b099c52..0ab661e8a7f86270cabebaec6973bf82f7c8aacc" +} +,{ + "testCaseDescription": "ruby-boolean-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "boolean-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'a && b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'a || b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'a && b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.rb" + ], + "patch": [ + "diff --git a/boolean-operator.rb b/boolean-operator.rb", + "index 2d34b94..32a41c9 100644", + "--- a/boolean-operator.rb", + "+++ b/boolean-operator.rb", + "@@ -1,3 +1,2 @@", + "-a && b", + "-a || b", + " a || b", + "+a && b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0ab661e8a7f86270cabebaec6973bf82f7c8aacc..d3349221ddb0a0f39b9b279decb8d0b86ed9f034" +} +,{ + "testCaseDescription": "ruby-boolean-operator-delete-test", + "expectedResult": { + "changes": { + "boolean-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'a || b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.rb" + ], + "patch": [ + "diff --git a/boolean-operator.rb b/boolean-operator.rb", + "index 32a41c9..b0af58d 100644", + "--- a/boolean-operator.rb", + "+++ b/boolean-operator.rb", + "@@ -1,2 +1 @@", + "-a || b", + " a && b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d3349221ddb0a0f39b9b279decb8d0b86ed9f034..290e361907c420d7522cb7a902e1ab3787e381d1" +} +,{ + "testCaseDescription": "ruby-boolean-operator-delete-rest-test", + "expectedResult": { + "changes": { + "boolean-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'a && b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "boolean-operator.rb" + ], + "patch": [ + "diff --git a/boolean-operator.rb b/boolean-operator.rb", + "index b0af58d..e69de29 100644", + "--- a/boolean-operator.rb", + "+++ b/boolean-operator.rb", + "@@ -1 +0,0 @@", + "-a && b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "290e361907c420d7522cb7a902e1ab3787e381d1..546a8ae29d4964d2d9e5fc7e22788161d4a41040" +}] diff --git a/test/corpus/diff-summaries/ruby/class.json b/test/corpus/diff-summaries/ruby/class.json new file mode 100644 index 000000000..4fb035c7d --- /dev/null +++ b/test/corpus/diff-summaries/ruby/class.json @@ -0,0 +1,345 @@ +[{ + "testCaseDescription": "ruby-class-insert-test", + "expectedResult": { + "changes": { + "class.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.rb" + ], + "patch": [ + "diff --git a/class.rb b/class.rb", + "index e69de29..81b916c 100644", + "--- a/class.rb", + "+++ b/class.rb", + "@@ -0,0 +1,3 @@", + "+class Foo < Super", + "+ def test; end", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a4bb88876d23a00075e16a8d8ea040a69755a759..3b90bc86408911a7ad03bf80959f0575b5fbf100" +} +,{ + "testCaseDescription": "ruby-class-replacement-insert-test", + "expectedResult": { + "changes": { + "class.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'Foo' class" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.rb" + ], + "patch": [ + "diff --git a/class.rb b/class.rb", + "index 81b916c..e67922c 100644", + "--- a/class.rb", + "+++ b/class.rb", + "@@ -1,3 +1,9 @@", + "+class Foo", + "+ def test; end", + "+end", + "+class Foo < Super", + "+ def test; end", + "+end", + " class Foo < Super", + " def test; end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3b90bc86408911a7ad03bf80959f0575b5fbf100..23cebb2dfc58cb01e4f219705196a0c07f09fe34" +} +,{ + "testCaseDescription": "ruby-class-delete-insert-test", + "expectedResult": { + "changes": { + "class.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 13 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'Super' identifier in the Foo class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.rb" + ], + "patch": [ + "diff --git a/class.rb b/class.rb", + "index e67922c..c371fd8 100644", + "--- a/class.rb", + "+++ b/class.rb", + "@@ -1,4 +1,4 @@", + "-class Foo", + "+class Foo < Super", + " def test; end", + " end", + " class Foo < Super" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "23cebb2dfc58cb01e4f219705196a0c07f09fe34..86ea4b9cd4d28a2451b90c515e43f8598d0b6524" +} +,{ + "testCaseDescription": "ruby-class-replacement-test", + "expectedResult": { + "changes": { + "class.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 13 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'Super' identifier in the Foo class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.rb" + ], + "patch": [ + "diff --git a/class.rb b/class.rb", + "index c371fd8..e67922c 100644", + "--- a/class.rb", + "+++ b/class.rb", + "@@ -1,4 +1,4 @@", + "-class Foo < Super", + "+class Foo", + " def test; end", + " end", + " class Foo < Super" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "86ea4b9cd4d28a2451b90c515e43f8598d0b6524..919796ae245a447dfa2f5cf0d5927d84a3995f3c" +} +,{ + "testCaseDescription": "ruby-class-delete-replacement-test", + "expectedResult": { + "changes": { + "class.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' class" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' class" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.rb" + ], + "patch": [ + "diff --git a/class.rb b/class.rb", + "index e67922c..818d26a 100644", + "--- a/class.rb", + "+++ b/class.rb", + "@@ -1,9 +1,6 @@", + "-class Foo", + "- def test; end", + "-end", + " class Foo < Super", + " def test; end", + " end", + "-class Foo < Super", + "+class Foo", + " def test; end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "919796ae245a447dfa2f5cf0d5927d84a3995f3c..d9ddfcec10a47ea7718918b71f27820e6c59691c" +} +,{ + "testCaseDescription": "ruby-class-delete-test", + "expectedResult": { + "changes": { + "class.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.rb" + ], + "patch": [ + "diff --git a/class.rb b/class.rb", + "index 818d26a..bab2e9f 100644", + "--- a/class.rb", + "+++ b/class.rb", + "@@ -1,6 +1,3 @@", + "-class Foo < Super", + "- def test; end", + "-end", + " class Foo", + " def test; end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d9ddfcec10a47ea7718918b71f27820e6c59691c..9907e82b34c3b065eb0d1933adfca48b99016685" +} +,{ + "testCaseDescription": "ruby-class-delete-rest-test", + "expectedResult": { + "changes": { + "class.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "class.rb" + ], + "patch": [ + "diff --git a/class.rb b/class.rb", + "index bab2e9f..e69de29 100644", + "--- a/class.rb", + "+++ b/class.rb", + "@@ -1,3 +0,0 @@", + "-class Foo", + "- def test; end", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9907e82b34c3b065eb0d1933adfca48b99016685..df1a78de0a4748fd622579937f1b94b6af7a7a22" +}] diff --git a/test/corpus/diff-summaries/ruby/comment.json b/test/corpus/diff-summaries/ruby/comment.json new file mode 100644 index 000000000..d9af40ecf --- /dev/null +++ b/test/corpus/diff-summaries/ruby/comment.json @@ -0,0 +1,169 @@ +[{ + "testCaseDescription": "ruby-comment-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.rb" + ], + "patch": [ + "diff --git a/comment.rb b/comment.rb", + "index e69de29..7dd15c1 100644", + "--- a/comment.rb", + "+++ b/comment.rb", + "@@ -0,0 +1 @@", + "+# This is a comment" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2cdebaab8d402bbecd5ad02e9fe17cf082e7d55b..3585a644261dbc1ab0c9ed35331f8d07a1115b3f" +} +,{ + "testCaseDescription": "ruby-comment-replacement-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.rb" + ], + "patch": [ + "diff --git a/comment.rb b/comment.rb", + "index 7dd15c1..ef7e0e6 100644", + "--- a/comment.rb", + "+++ b/comment.rb", + "@@ -1 +1,6 @@", + "+=begin", + "+This is a multiline", + "+comment", + "+=end", + "+# This is a comment", + " # This is a comment" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3585a644261dbc1ab0c9ed35331f8d07a1115b3f..aaac39e5084889b9d69a5b31832570b1110e1857" +} +,{ + "testCaseDescription": "ruby-comment-delete-insert-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.rb" + ], + "patch": [ + "diff --git a/comment.rb b/comment.rb", + "index ef7e0e6..b2a9858 100644", + "--- a/comment.rb", + "+++ b/comment.rb", + "@@ -1,6 +1,3 @@", + "-=begin", + "-This is a multiline", + "-comment", + "-=end", + "+# This is a comment", + " # This is a comment", + " # This is a comment" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "aaac39e5084889b9d69a5b31832570b1110e1857..640658627ee68bc1038256a1ea9325422126f244" +} +,{ + "testCaseDescription": "ruby-comment-replacement-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.rb" + ], + "patch": [ + "diff --git a/comment.rb b/comment.rb", + "index b2a9858..ef7e0e6 100644", + "--- a/comment.rb", + "+++ b/comment.rb", + "@@ -1,3 +1,6 @@", + "-# This is a comment", + "+=begin", + "+This is a multiline", + "+comment", + "+=end", + " # This is a comment", + " # This is a comment" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "640658627ee68bc1038256a1ea9325422126f244..f823f41203f327790f22be5a24eb9fa15f5f1027" +} +,{ + "testCaseDescription": "ruby-comment-delete-replacement-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.rb" + ], + "patch": [ + "diff --git a/comment.rb b/comment.rb", + "index ef7e0e6..787b019 100644", + "--- a/comment.rb", + "+++ b/comment.rb", + "@@ -1,6 +1,5 @@", + "+# This is a comment", + " =begin", + " This is a multiline", + " comment", + " =end", + "-# This is a comment", + "-# This is a comment" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f823f41203f327790f22be5a24eb9fa15f5f1027..01390b3907a04277d6f77c675968bdefc62fc07e" +} +,{ + "testCaseDescription": "ruby-comment-delete-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.rb" + ], + "patch": [ + "diff --git a/comment.rb b/comment.rb", + "index 787b019..5bbcda3 100644", + "--- a/comment.rb", + "+++ b/comment.rb", + "@@ -1,4 +1,3 @@", + "-# This is a comment", + " =begin", + " This is a multiline", + " comment" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "01390b3907a04277d6f77c675968bdefc62fc07e..58503fc2c12269cdbd5d74d50513be53b407502e" +} +,{ + "testCaseDescription": "ruby-comment-delete-rest-test", + "expectedResult": { + "changes": {}, + "errors": {} + }, + "filePaths": [ + "comment.rb" + ], + "patch": [ + "diff --git a/comment.rb b/comment.rb", + "index 5bbcda3..e69de29 100644", + "--- a/comment.rb", + "+++ b/comment.rb", + "@@ -1,4 +0,0 @@", + "-=begin", + "-This is a multiline", + "-comment", + "-=end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "58503fc2c12269cdbd5d74d50513be53b407502e..0a572cb338bc566ebf42126063cd97d903560bec" +}] diff --git a/test/corpus/diff-summaries/ruby/comparision-operator.json b/test/corpus/diff-summaries/ruby/comparision-operator.json new file mode 100644 index 000000000..5fbb94347 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/comparision-operator.json @@ -0,0 +1,538 @@ +[{ + "testCaseDescription": "ruby-comparision-operator-insert-test", + "expectedResult": { + "changes": { + "comparision-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x < y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'a > b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comparision-operator.rb" + ], + "patch": [ + "diff --git a/comparision-operator.rb b/comparision-operator.rb", + "index e69de29..582cb83 100644", + "--- a/comparision-operator.rb", + "+++ b/comparision-operator.rb", + "@@ -0,0 +1,2 @@", + "+x < y", + "+a > b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cef9371cb4d1a05f91067637d7e9256fdc8b846c..f16e266ee0009f7a4c65641bea11cc026780fe0c" +} +,{ + "testCaseDescription": "ruby-comparision-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "comparision-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'x <= y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'a >= b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added the 'x < y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'a > b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comparision-operator.rb" + ], + "patch": [ + "diff --git a/comparision-operator.rb b/comparision-operator.rb", + "index 582cb83..b96996d 100644", + "--- a/comparision-operator.rb", + "+++ b/comparision-operator.rb", + "@@ -1,2 +1,6 @@", + "+x <= y", + "+a >= b", + "+x < y", + "+a > b", + " x < y", + " a > b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f16e266ee0009f7a4c65641bea11cc026780fe0c..0bd2b5d4f8f5ccdc89cc8a66f48fd5ac2f58d558" +} +,{ + "testCaseDescription": "ruby-comparision-operator-delete-insert-test", + "expectedResult": { + "changes": { + "comparision-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'x <= y' binary statement with the 'x < y' binary statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + ] + }, + "summary": "Replaced the 'a >= b' binary statement with the 'a > b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comparision-operator.rb" + ], + "patch": [ + "diff --git a/comparision-operator.rb b/comparision-operator.rb", + "index b96996d..3b7fde7 100644", + "--- a/comparision-operator.rb", + "+++ b/comparision-operator.rb", + "@@ -1,5 +1,5 @@", + "-x <= y", + "-a >= b", + "+x < y", + "+a > b", + " x < y", + " a > b", + " x < y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0bd2b5d4f8f5ccdc89cc8a66f48fd5ac2f58d558..6fb2119dabcb8f81561d66436b4efa1acb9171f7" +} +,{ + "testCaseDescription": "ruby-comparision-operator-replacement-test", + "expectedResult": { + "changes": { + "comparision-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x < y' binary statement with the 'x <= y' binary statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the 'a > b' binary statement with the 'a >= b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comparision-operator.rb" + ], + "patch": [ + "diff --git a/comparision-operator.rb b/comparision-operator.rb", + "index 3b7fde7..b96996d 100644", + "--- a/comparision-operator.rb", + "+++ b/comparision-operator.rb", + "@@ -1,5 +1,5 @@", + "-x < y", + "-a > b", + "+x <= y", + "+a >= b", + " x < y", + " a > b", + " x < y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6fb2119dabcb8f81561d66436b4efa1acb9171f7..26c601907f4dbfde2a4638e513ec156a847fc80f" +} +,{ + "testCaseDescription": "ruby-comparision-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "comparision-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x <= y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'a >= b' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Deleted the 'x < y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the 'a > b' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added the 'x <= y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added the 'a >= b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comparision-operator.rb" + ], + "patch": [ + "diff --git a/comparision-operator.rb b/comparision-operator.rb", + "index b96996d..1cfa010 100644", + "--- a/comparision-operator.rb", + "+++ b/comparision-operator.rb", + "@@ -1,6 +1,4 @@", + "-x <= y", + "-a >= b", + "-x < y", + "-a > b", + " x < y", + " a > b", + "+x <= y", + "+a >= b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "26c601907f4dbfde2a4638e513ec156a847fc80f..6153b556fdc873f0d439c52a385b5330625e6fa8" +} +,{ + "testCaseDescription": "ruby-comparision-operator-delete-test", + "expectedResult": { + "changes": { + "comparision-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x < y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'a > b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comparision-operator.rb" + ], + "patch": [ + "diff --git a/comparision-operator.rb b/comparision-operator.rb", + "index 1cfa010..71b2892 100644", + "--- a/comparision-operator.rb", + "+++ b/comparision-operator.rb", + "@@ -1,4 +1,2 @@", + "-x < y", + "-a > b", + " x <= y", + " a >= b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6153b556fdc873f0d439c52a385b5330625e6fa8..f0e3e2476ab21d12a757629d0d8937d5de2ede9c" +} +,{ + "testCaseDescription": "ruby-comparision-operator-delete-rest-test", + "expectedResult": { + "changes": { + "comparision-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x <= y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'a >= b' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "comparision-operator.rb" + ], + "patch": [ + "diff --git a/comparision-operator.rb b/comparision-operator.rb", + "index 71b2892..e69de29 100644", + "--- a/comparision-operator.rb", + "+++ b/comparision-operator.rb", + "@@ -1,2 +0,0 @@", + "-x <= y", + "-a >= b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f0e3e2476ab21d12a757629d0d8937d5de2ede9c..43e5b394550f6e013c1d5023b8946dfdf52e25f0" +}] diff --git a/test/corpus/diff-summaries/ruby/conditional-assignment.json b/test/corpus/diff-summaries/ruby/conditional-assignment.json new file mode 100644 index 000000000..9cda26b5c --- /dev/null +++ b/test/corpus/diff-summaries/ruby/conditional-assignment.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-conditional-assignment-insert-test", + "expectedResult": { + "changes": { + "conditional-assignment.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "conditional-assignment.rb" + ], + "patch": [ + "diff --git a/conditional-assignment.rb b/conditional-assignment.rb", + "index e69de29..f8f538b 100644", + "--- a/conditional-assignment.rb", + "+++ b/conditional-assignment.rb", + "@@ -0,0 +1 @@", + "+x ||= 5" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "80da23eff17f9285f3cb5f9ceb16f8bf50f4d722..530c1e3e8fdef88bab2c68a74b5885f90118920d" +} +,{ + "testCaseDescription": "ruby-conditional-assignment-replacement-insert-test", + "expectedResult": { + "changes": { + "conditional-assignment.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "conditional-assignment.rb" + ], + "patch": [ + "diff --git a/conditional-assignment.rb b/conditional-assignment.rb", + "index f8f538b..6c10ae5 100644", + "--- a/conditional-assignment.rb", + "+++ b/conditional-assignment.rb", + "@@ -1 +1,3 @@", + "+x &&= 7", + "+x ||= 5", + " x ||= 5" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "530c1e3e8fdef88bab2c68a74b5885f90118920d..11ca938ae3f5d9c8a7e63c0843c6131f5da9b5dc" +} +,{ + "testCaseDescription": "ruby-conditional-assignment-delete-insert-test", + "expectedResult": { + "changes": { + "conditional-assignment.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced '7' with '5' in the x operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "conditional-assignment.rb" + ], + "patch": [ + "diff --git a/conditional-assignment.rb b/conditional-assignment.rb", + "index 6c10ae5..a333810 100644", + "--- a/conditional-assignment.rb", + "+++ b/conditional-assignment.rb", + "@@ -1,3 +1,3 @@", + "-x &&= 7", + "+x ||= 5", + " x ||= 5", + " x ||= 5" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "11ca938ae3f5d9c8a7e63c0843c6131f5da9b5dc..52c0db7943309198a5f11bdc5a7e6a70c72b801f" +} +,{ + "testCaseDescription": "ruby-conditional-assignment-replacement-test", + "expectedResult": { + "changes": { + "conditional-assignment.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced '5' with '7' in the x operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "conditional-assignment.rb" + ], + "patch": [ + "diff --git a/conditional-assignment.rb b/conditional-assignment.rb", + "index a333810..6c10ae5 100644", + "--- a/conditional-assignment.rb", + "+++ b/conditional-assignment.rb", + "@@ -1,3 +1,3 @@", + "-x ||= 5", + "+x &&= 7", + " x ||= 5", + " x ||= 5" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "52c0db7943309198a5f11bdc5a7e6a70c72b801f..4283472329b817d55f29a45ea756e6971c86a7d3" +} +,{ + "testCaseDescription": "ruby-conditional-assignment-delete-replacement-test", + "expectedResult": { + "changes": { + "conditional-assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "conditional-assignment.rb" + ], + "patch": [ + "diff --git a/conditional-assignment.rb b/conditional-assignment.rb", + "index 6c10ae5..a56ffee 100644", + "--- a/conditional-assignment.rb", + "+++ b/conditional-assignment.rb", + "@@ -1,3 +1,2 @@", + "-x &&= 7", + "-x ||= 5", + " x ||= 5", + "+x &&= 7" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4283472329b817d55f29a45ea756e6971c86a7d3..cc576f5286416a8fa5aa7109a7961a1a14f59104" +} +,{ + "testCaseDescription": "ruby-conditional-assignment-delete-test", + "expectedResult": { + "changes": { + "conditional-assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "conditional-assignment.rb" + ], + "patch": [ + "diff --git a/conditional-assignment.rb b/conditional-assignment.rb", + "index a56ffee..1abca02 100644", + "--- a/conditional-assignment.rb", + "+++ b/conditional-assignment.rb", + "@@ -1,2 +1 @@", + "-x ||= 5", + " x &&= 7" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cc576f5286416a8fa5aa7109a7961a1a14f59104..ce68f255dfe40712360aa04dec6bc7844f1a003b" +} +,{ + "testCaseDescription": "ruby-conditional-assignment-delete-rest-test", + "expectedResult": { + "changes": { + "conditional-assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "conditional-assignment.rb" + ], + "patch": [ + "diff --git a/conditional-assignment.rb b/conditional-assignment.rb", + "index 1abca02..e69de29 100644", + "--- a/conditional-assignment.rb", + "+++ b/conditional-assignment.rb", + "@@ -1 +0,0 @@", + "-x &&= 7" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ce68f255dfe40712360aa04dec6bc7844f1a003b..9ee3b98240d86d88fb36b4434854030701b21d2d" +}] diff --git a/test/corpus/diff-summaries/ruby/delimiter.json b/test/corpus/diff-summaries/ruby/delimiter.json new file mode 100644 index 000000000..c67eb6f05 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/delimiter.json @@ -0,0 +1,1315 @@ +[{ + "testCaseDescription": "ruby-delimiter-insert-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the %q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the %qc> string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Added the %#a# string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the %Q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %c> string" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index e69de29..8ec39b8 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -0,0 +1,6 @@", + "+%q#a#", + "+%qc>", + "+%#a#", + "+%Q#a#", + "+%c>", + "+%Qc>" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "370c0a6d0e774ad3b0d66bf1c3a960572964e039..f981ad9b7b08c03ccb3e55b8599b6c9b6c650a9e" +} +,{ + "testCaseDescription": "ruby-delimiter-replacement-insert-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the %q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the %q{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Added the %/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the %Q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the %Q{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Added the %q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Added the %qc> string" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Added the %#a# string" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Added the %Q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 9 + ] + } + }, + "summary": "Added the %c> string" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 10 + ] + } + }, + "summary": "Added the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 8ec39b8..5b0f7ec 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,3 +1,15 @@", + "+%q/b/", + "+%q{d{e}f}", + "+%/b/", + "+%Q/b/", + "+%{d{e}f}", + "+%Q{d{e}f}", + "+%q#a#", + "+%qc>", + "+%#a#", + "+%Q#a#", + "+%c>", + "+%Qc>", + " %q#a#", + " %qc>", + " %#a#" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f981ad9b7b08c03ccb3e55b8599b6c9b6c650a9e..d8a2dfbbac91bce79fb46fe9a198f814aac20937" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-insert-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the %q#a# string" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + ] + }, + "summary": "Replaced the %q/b/ string with the %qc> string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Added the %#a# string" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced the %q{d{e}f} string with the %Q#a# string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %c> string" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the %Qc> string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Q{d{e}f} string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 5b0f7ec..64d6df4 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,9 +1,9 @@", + "-%q/b/", + "-%q{d{e}f}", + "-%/b/", + "-%Q/b/", + "-%{d{e}f}", + "-%Q{d{e}f}", + "+%q#a#", + "+%qc>", + "+%#a#", + "+%Q#a#", + "+%c>", + "+%Qc>", + " %q#a#", + " %qc>", + " %#a#" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d8a2dfbbac91bce79fb46fe9a198f814aac20937..fff394caa4305cd7ae0fa12009f544d29b4412e8" +} +,{ + "testCaseDescription": "ruby-delimiter-replacement-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the %q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the %q{d{e}f} string" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + ] + }, + "summary": "Replaced the %q#a# string with the %/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the %Q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Added the %{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Added the %Q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %qc> string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %#a# string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %c> string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 64d6df4..5b0f7ec 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,9 +1,9 @@", + "-%q#a#", + "-%qc>", + "-%#a#", + "-%Q#a#", + "-%c>", + "-%Qc>", + "+%q/b/", + "+%q{d{e}f}", + "+%/b/", + "+%Q/b/", + "+%{d{e}f}", + "+%Q{d{e}f}", + " %q#a#", + " %qc>", + " %#a#" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fff394caa4305cd7ae0fa12009f544d29b4412e8..19b745482dc2432e84a2950ccfabcbb100965df1" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-replacement-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the %q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Deleted the %q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Deleted the %qc> string" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Deleted the %#a# string" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Deleted the %Q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 9 + ] + } + }, + "summary": "Deleted the %c> string" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 10 + ] + } + }, + "summary": "Deleted the %Qc> string" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Added the %q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 10 + ] + } + }, + "summary": "Added the %q{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Added the %/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Added the %Q/b/ string" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 9 + ] + } + }, + "summary": "Added the %{d{e}f} string" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 10 + ] + } + }, + "summary": "Added the %Q{d{e}f} string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 5b0f7ec..2095136 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,18 +1,12 @@", + "-%q/b/", + "-%q{d{e}f}", + "-%/b/", + "-%Q/b/", + "-%{d{e}f}", + "-%Q{d{e}f}", + "-%q#a#", + "-%qc>", + "-%#a#", + "-%Q#a#", + "-%c>", + "-%Qc>", + " %q#a#", + " %qc>", + " %#a#", + " %Q#a#", + " %c>", + " %Qc>", + "+%q/b/", + "+%q{d{e}f}", + "+%/b/", + "+%Q/b/", + "+%{d{e}f}", + "+%Q{d{e}f}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "19b745482dc2432e84a2950ccfabcbb100965df1..7aa017c6cf47c36a10d7c113d839cdc920fc04e5" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the %q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %qc> string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %#a# string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q#a# string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %c> string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Qc> string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 2095136..3843090 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,9 +1,3 @@", + "-%q#a#", + "-%qc>", + "-%#a#", + "-%Q#a#", + "-%c>", + "-%Qc>", + " %q/b/", + " %q{d{e}f}", + " %/b/" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7aa017c6cf47c36a10d7c113d839cdc920fc04e5..8143f610d5ad0f1a7ba62bc8c7232030cddbc416" +} +,{ + "testCaseDescription": "ruby-delimiter-delete-rest-test", + "expectedResult": { + "changes": { + "delimiter.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the %q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the %q{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted the %/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the %Q/b/ string" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 9 + ] + } + }, + "summary": "Deleted the %{d{e}f} string" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 10 + ] + } + }, + "summary": "Deleted the %Q{d{e}f} string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "delimiter.rb" + ], + "patch": [ + "diff --git a/delimiter.rb b/delimiter.rb", + "index 3843090..e69de29 100644", + "--- a/delimiter.rb", + "+++ b/delimiter.rb", + "@@ -1,6 +0,0 @@", + "-%q/b/", + "-%q{d{e}f}", + "-%/b/", + "-%Q/b/", + "-%{d{e}f}", + "-%Q{d{e}f}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8143f610d5ad0f1a7ba62bc8c7232030cddbc416..6f7fda4304f4cd5dfe0e528d2d6bdb800b773821" +}] diff --git a/test/corpus/diff-summaries/ruby/element-reference.json b/test/corpus/diff-summaries/ruby/element-reference.json new file mode 100644 index 000000000..73d3912a5 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/element-reference.json @@ -0,0 +1,690 @@ +[{ + "testCaseDescription": "ruby-element-reference-insert-test", + "expectedResult": { + "changes": { + "element-reference.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Added the 'foo[bar]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the 'foo[:bar]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 13 + ] + } + }, + "summary": "Added the 'foo[bar]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "element-reference.rb" + ], + "patch": [ + "diff --git a/element-reference.rb b/element-reference.rb", + "index e69de29..f088562 100644", + "--- a/element-reference.rb", + "+++ b/element-reference.rb", + "@@ -0,0 +1,3 @@", + "+foo[bar]", + "+foo[:bar]", + "+foo[bar] = 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "643d85053b9b9c5d600585bb7e1e8fe4160aae30..2a05255178a5a4b7c6d24c808ef3870edfe06b93" +} +,{ + "testCaseDescription": "ruby-element-reference-replacement-insert-test", + "expectedResult": { + "changes": { + "element-reference.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'x[\"b\"]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'x[:\"c\"]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 9 + ] + } + }, + "summary": "Added the 'foo[bar]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Added the 'foo[:bar]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Added the 'foo[bar]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "element-reference.rb" + ], + "patch": [ + "diff --git a/element-reference.rb b/element-reference.rb", + "index f088562..7c45cae 100644", + "--- a/element-reference.rb", + "+++ b/element-reference.rb", + "@@ -1,3 +1,8 @@", + "+x[\"b\"]", + "+x[:\"c\"]", + "+foo[bar]", + "+foo[:bar]", + "+foo[bar] = 1", + " foo[bar]", + " foo[:bar]", + " foo[bar] = 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2a05255178a5a4b7c6d24c808ef3870edfe06b93..9c481f4dceb513e7cd1c4c93ab1101233cc5f100" +} +,{ + "testCaseDescription": "ruby-element-reference-delete-insert-test", + "expectedResult": { + "changes": { + "element-reference.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'x[\"b\"]' subscript access with the 'foo[bar]' subscript access" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 2 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'foo' identifier in the foo[:bar] subscript access" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 2, + 5 + ], + "end": [ + 2, + 9 + ] + } + ] + }, + "summary": "Replaced the ':\"c\"' symbol with the ':bar' symbol in the foo[:bar] subscript access" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 13 + ] + } + }, + "summary": "Added the 'foo[bar]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "element-reference.rb" + ], + "patch": [ + "diff --git a/element-reference.rb b/element-reference.rb", + "index 7c45cae..8e3c23d 100644", + "--- a/element-reference.rb", + "+++ b/element-reference.rb", + "@@ -1,5 +1,6 @@", + "-x[\"b\"]", + "-x[:\"c\"]", + "+foo[bar]", + "+foo[:bar]", + "+foo[bar] = 1", + " foo[bar]", + " foo[:bar]", + " foo[bar] = 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9c481f4dceb513e7cd1c4c93ab1101233cc5f100..21d98934f83b18f7931a0fe33116f83565ce1ed2" +} +,{ + "testCaseDescription": "ruby-element-reference-replacement-test", + "expectedResult": { + "changes": { + "element-reference.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'foo[bar]' subscript access with the 'x[\"b\"]' subscript access" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 2 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'x' identifier in the x[:\"c\"] subscript access" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 5 + ], + "end": [ + 2, + 9 + ] + }, + { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the ':bar' symbol with the ':\"c\"' symbol in the x[:\"c\"] subscript access" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 13 + ] + } + }, + "summary": "Deleted the 'foo[bar]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "element-reference.rb" + ], + "patch": [ + "diff --git a/element-reference.rb b/element-reference.rb", + "index 8e3c23d..7c45cae 100644", + "--- a/element-reference.rb", + "+++ b/element-reference.rb", + "@@ -1,6 +1,5 @@", + "-foo[bar]", + "-foo[:bar]", + "-foo[bar] = 1", + "+x[\"b\"]", + "+x[:\"c\"]", + " foo[bar]", + " foo[:bar]", + " foo[bar] = 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "21d98934f83b18f7931a0fe33116f83565ce1ed2..aaff584b4e8cf3a27b77c5140144fc1ec0a506fc" +} +,{ + "testCaseDescription": "ruby-element-reference-delete-replacement-test", + "expectedResult": { + "changes": { + "element-reference.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x[\"b\"]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Deleted the 'x[:\"c\"]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 9 + ] + } + }, + "summary": "Deleted the 'foo[bar]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Deleted the 'foo[:bar]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 13 + ] + } + }, + "summary": "Deleted the 'foo[bar]' assignment" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added the 'x[\"b\"]' subscript access" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Added the 'x[:\"c\"]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "element-reference.rb" + ], + "patch": [ + "diff --git a/element-reference.rb b/element-reference.rb", + "index 7c45cae..165629c 100644", + "--- a/element-reference.rb", + "+++ b/element-reference.rb", + "@@ -1,8 +1,5 @@", + "-x[\"b\"]", + "-x[:\"c\"]", + "-foo[bar]", + "-foo[:bar]", + "-foo[bar] = 1", + " foo[bar]", + " foo[:bar]", + " foo[bar] = 1", + "+x[\"b\"]", + "+x[:\"c\"]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "aaff584b4e8cf3a27b77c5140144fc1ec0a506fc..b585b91b6aa8c3d7a74958f9c68363d965f91c9b" +} +,{ + "testCaseDescription": "ruby-element-reference-delete-test", + "expectedResult": { + "changes": { + "element-reference.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted the 'foo[bar]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the 'foo[:bar]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 13 + ] + } + }, + "summary": "Deleted the 'foo[bar]' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "element-reference.rb" + ], + "patch": [ + "diff --git a/element-reference.rb b/element-reference.rb", + "index 165629c..d1fa515 100644", + "--- a/element-reference.rb", + "+++ b/element-reference.rb", + "@@ -1,5 +1,2 @@", + "-foo[bar]", + "-foo[:bar]", + "-foo[bar] = 1", + " x[\"b\"]", + " x[:\"c\"]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b585b91b6aa8c3d7a74958f9c68363d965f91c9b..3355009927744d8ab014a51216acc81de66c6cfb" +} +,{ + "testCaseDescription": "ruby-element-reference-delete-rest-test", + "expectedResult": { + "changes": { + "element-reference.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x[\"b\"]' subscript access" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Deleted the 'x[:\"c\"]' subscript access" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "element-reference.rb" + ], + "patch": [ + "diff --git a/element-reference.rb b/element-reference.rb", + "index d1fa515..e69de29 100644", + "--- a/element-reference.rb", + "+++ b/element-reference.rb", + "@@ -1,2 +0,0 @@", + "-x[\"b\"]", + "-x[:\"c\"]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3355009927744d8ab014a51216acc81de66c6cfb..1f3f678261048f8b6cd7f6c9c9552ddbcdaa9896" +}] diff --git a/test/corpus/diff-summaries/ruby/else.json b/test/corpus/diff-summaries/ruby/else.json new file mode 100644 index 000000000..ee2bdddd5 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/else.json @@ -0,0 +1,270 @@ +[{ + "testCaseDescription": "ruby-else-setup-test", + "expectedResult": { + "changes": { + "else.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "else.rb" + ], + "patch": [ + "diff --git a/else.rb b/else.rb", + "index e69de29..d2757f9 100644", + "--- a/else.rb", + "+++ b/else.rb", + "@@ -0,0 +1,3 @@", + "+begin", + "+ foo()", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ae19f1520c4061cc62e675b32b6b1c0154935e03..39aecf1c5690efa3bae2fb219a635672420aea1b" +} +,{ + "testCaseDescription": "ruby-else-insert-test", + "expectedResult": { + "changes": { + "else.rb": [ + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + } + }, + "summary": "Added an else block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "else.rb" + ], + "patch": [ + "diff --git a/else.rb b/else.rb", + "index d2757f9..09f6b12 100644", + "--- a/else.rb", + "+++ b/else.rb", + "@@ -1,3 +1,4 @@", + " begin", + " foo()", + "+else", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "39aecf1c5690efa3bae2fb219a635672420aea1b..570b0542c8f1c4386148bfb9efc17f8a7f1aa8df" +} +,{ + "testCaseDescription": "ruby-else-replacement-test", + "expectedResult": { + "changes": { + "else.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + }, + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 8 + ] + } + ] + }, + "summary": "Replaced an else block with the 'bar()' method call in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "else.rb" + ], + "patch": [ + "diff --git a/else.rb b/else.rb", + "index 09f6b12..f9c269d 100644", + "--- a/else.rb", + "+++ b/else.rb", + "@@ -1,4 +1,5 @@", + " begin", + " foo()", + " else", + "+ bar()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "570b0542c8f1c4386148bfb9efc17f8a7f1aa8df..3626e8bea9a4e54d40eba511b6cd3e9ac34bf298" +} +,{ + "testCaseDescription": "ruby-else-delete-replacement-test", + "expectedResult": { + "changes": { + "else.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 8 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + } + ] + }, + "summary": "Replaced the 'bar()' method call with an else block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "else.rb" + ], + "patch": [ + "diff --git a/else.rb b/else.rb", + "index f9c269d..09f6b12 100644", + "--- a/else.rb", + "+++ b/else.rb", + "@@ -1,5 +1,4 @@", + " begin", + " foo()", + " else", + "- bar()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3626e8bea9a4e54d40eba511b6cd3e9ac34bf298..a7f840b2ee14d068ff17748ec97b4b4f15fb3652" +} +,{ + "testCaseDescription": "ruby-else-delete-insert-test", + "expectedResult": { + "changes": { + "else.rb": [ + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + } + }, + "summary": "Deleted an else block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "else.rb" + ], + "patch": [ + "diff --git a/else.rb b/else.rb", + "index 09f6b12..d2757f9 100644", + "--- a/else.rb", + "+++ b/else.rb", + "@@ -1,4 +1,3 @@", + " begin", + " foo()", + "-else", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a7f840b2ee14d068ff17748ec97b4b4f15fb3652..38207054cf88fcf9080daddcd645cbe4529eaab9" +} +,{ + "testCaseDescription": "ruby-else-teardown-test", + "expectedResult": { + "changes": { + "else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "else.rb" + ], + "patch": [ + "diff --git a/else.rb b/else.rb", + "index d2757f9..e69de29 100644", + "--- a/else.rb", + "+++ b/else.rb", + "@@ -1,3 +0,0 @@", + "-begin", + "- foo()", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "38207054cf88fcf9080daddcd645cbe4529eaab9..04ad53865dc136bdb36eaaaa52eadbbfe5061307" +}] diff --git a/test/corpus/diff-summaries/ruby/elsif.json b/test/corpus/diff-summaries/ruby/elsif.json new file mode 100644 index 000000000..8b3e03289 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/elsif.json @@ -0,0 +1,246 @@ +[{ + "testCaseDescription": "ruby-elsif-setup-test", + "expectedResult": { + "changes": { + "elsif.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'bar' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "elsif.rb" + ], + "patch": [ + "diff --git a/elsif.rb b/elsif.rb", + "index e69de29..89b5cd5 100644", + "--- a/elsif.rb", + "+++ b/elsif.rb", + "@@ -0,0 +1,3 @@", + "+if bar", + "+ foo()", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "04ad53865dc136bdb36eaaaa52eadbbfe5061307..61cd462d68a7c2fd6f7a2e5cdb709fe68ff424a7" +} +,{ + "testCaseDescription": "ruby-elsif-insert-test", + "expectedResult": { + "changes": { + "elsif.rb": [ + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + } + }, + "summary": "Added the 'baz' elsif block in the 'bar' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "elsif.rb" + ], + "patch": [ + "diff --git a/elsif.rb b/elsif.rb", + "index 89b5cd5..945e953 100644", + "--- a/elsif.rb", + "+++ b/elsif.rb", + "@@ -1,3 +1,4 @@", + " if bar", + " foo()", + "+elsif baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "61cd462d68a7c2fd6f7a2e5cdb709fe68ff424a7..af3351a2c8615bd4c6cb8f420615705a6bac70ef" +} +,{ + "testCaseDescription": "ruby-elsif-replacement-test", + "expectedResult": { + "changes": { + "elsif.rb": [ + { + "span": { + "insert": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 8 + ] + } + }, + "summary": "Added the 'qoz()' method call in the 'baz' elsif block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "elsif.rb" + ], + "patch": [ + "diff --git a/elsif.rb b/elsif.rb", + "index 945e953..8e4733f 100644", + "--- a/elsif.rb", + "+++ b/elsif.rb", + "@@ -1,4 +1,5 @@", + " if bar", + " foo()", + " elsif baz", + "+ qoz()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "af3351a2c8615bd4c6cb8f420615705a6bac70ef..e644031d9edb7e676f737a61bac4ce3234d1842f" +} +,{ + "testCaseDescription": "ruby-elsif-delete-replacement-test", + "expectedResult": { + "changes": { + "elsif.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 8 + ] + } + }, + "summary": "Deleted the 'qoz()' method call in the 'baz' elsif block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "elsif.rb" + ], + "patch": [ + "diff --git a/elsif.rb b/elsif.rb", + "index 8e4733f..945e953 100644", + "--- a/elsif.rb", + "+++ b/elsif.rb", + "@@ -1,5 +1,4 @@", + " if bar", + " foo()", + " elsif baz", + "- qoz()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e644031d9edb7e676f737a61bac4ce3234d1842f..a1ca718dc1a5af46c8f9c29ed3ac1cb3cd13cf09" +} +,{ + "testCaseDescription": "ruby-elsif-delete-insert-test", + "expectedResult": { + "changes": { + "elsif.rb": [ + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + } + }, + "summary": "Deleted the 'baz' elsif block in the 'bar' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "elsif.rb" + ], + "patch": [ + "diff --git a/elsif.rb b/elsif.rb", + "index 945e953..89b5cd5 100644", + "--- a/elsif.rb", + "+++ b/elsif.rb", + "@@ -1,4 +1,3 @@", + " if bar", + " foo()", + "-elsif baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a1ca718dc1a5af46c8f9c29ed3ac1cb3cd13cf09..f9378bce5c2a1dc392dff25c0bce2b943ca4e593" +} +,{ + "testCaseDescription": "ruby-elsif-teardown-test", + "expectedResult": { + "changes": { + "elsif.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'bar' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "elsif.rb" + ], + "patch": [ + "diff --git a/elsif.rb b/elsif.rb", + "index 89b5cd5..e69de29 100644", + "--- a/elsif.rb", + "+++ b/elsif.rb", + "@@ -1,3 +0,0 @@", + "-if bar", + "- foo()", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f9378bce5c2a1dc392dff25c0bce2b943ca4e593..08a206422217a4c25117cdd9e4c7cf57ec7e6093" +}] diff --git a/test/corpus/diff-summaries/ruby/end-block.json b/test/corpus/diff-summaries/ruby/end-block.json new file mode 100644 index 000000000..f3e2d987c --- /dev/null +++ b/test/corpus/diff-summaries/ruby/end-block.json @@ -0,0 +1,410 @@ +[{ + "testCaseDescription": "ruby-end-block-insert-test", + "expectedResult": { + "changes": { + "end-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 2 + ] + } + }, + "summary": "Added an END block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "end-block.rb" + ], + "patch": [ + "diff --git a/end-block.rb b/end-block.rb", + "index e69de29..0684d73 100644", + "--- a/end-block.rb", + "+++ b/end-block.rb", + "@@ -0,0 +1,3 @@", + "+END {", + "+ foo", + "+}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5de93fcdb1d807e7d537ecd5843313d1d3acf001..62b16961b5bf75b1e0c22b68d4c3f4f2844daa8e" +} +,{ + "testCaseDescription": "ruby-end-block-replacement-insert-test", + "expectedResult": { + "changes": { + "end-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added the 'foo' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Added an END block" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 7, + 2 + ] + } + }, + "summary": "Added an END block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "end-block.rb" + ], + "patch": [ + "diff --git a/end-block.rb b/end-block.rb", + "index 0684d73..6ab1278 100644", + "--- a/end-block.rb", + "+++ b/end-block.rb", + "@@ -1,3 +1,10 @@", + "+foo", + "+END {", + "+ bar", + "+}", + "+END {", + "+ foo", + "+}", + " END {", + " foo", + " }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "62b16961b5bf75b1e0c22b68d4c3f4f2844daa8e..791f90791016f5048c1a6a0ca62aa7d9ea22bed2" +} +,{ + "testCaseDescription": "ruby-end-block-delete-insert-test", + "expectedResult": { + "changes": { + "end-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 2 + ] + } + }, + "summary": "Added an END block" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Deleted an END block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "end-block.rb" + ], + "patch": [ + "diff --git a/end-block.rb b/end-block.rb", + "index 6ab1278..6a9e874 100644", + "--- a/end-block.rb", + "+++ b/end-block.rb", + "@@ -1,6 +1,5 @@", + "-foo", + " END {", + "- bar", + "+ foo", + " }", + " END {", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "791f90791016f5048c1a6a0ca62aa7d9ea22bed2..ee048050e801dff05f80d3855bdfc48888d67afc" +} +,{ + "testCaseDescription": "ruby-end-block-replacement-test", + "expectedResult": { + "changes": { + "end-block.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added the 'foo' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 2 + ], + "end": [ + 2, + 5 + ] + }, + { + "start": [ + 3, + 2 + ], + "end": [ + 3, + 5 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in an END block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "end-block.rb" + ], + "patch": [ + "diff --git a/end-block.rb b/end-block.rb", + "index 6a9e874..6ab1278 100644", + "--- a/end-block.rb", + "+++ b/end-block.rb", + "@@ -1,5 +1,6 @@", + "+foo", + " END {", + "- foo", + "+ bar", + " }", + " END {", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ee048050e801dff05f80d3855bdfc48888d67afc..b16881a60b9a8a40d61e8ff9e98e79a3a3469754" +} +,{ + "testCaseDescription": "ruby-end-block-delete-replacement-test", + "expectedResult": { + "changes": { + "end-block.rb": [ + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 10, + 2 + ] + } + }, + "summary": "Deleted an END block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "end-block.rb" + ], + "patch": [ + "diff --git a/end-block.rb b/end-block.rb", + "index 6ab1278..ad181ce 100644", + "--- a/end-block.rb", + "+++ b/end-block.rb", + "@@ -1,10 +1,7 @@", + "-foo", + "-END {", + "- bar", + "-}", + " END {", + " foo", + " }", + "+foo", + " END {", + "- foo", + "+ bar", + " }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b16881a60b9a8a40d61e8ff9e98e79a3a3469754..e5d578e9a4c5d74dc7eb4156444f5c7a3e92b61f" +} +,{ + "testCaseDescription": "ruby-end-block-delete-test", + "expectedResult": { + "changes": { + "end-block.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 2 + ] + } + }, + "summary": "Deleted an END block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "end-block.rb" + ], + "patch": [ + "diff --git a/end-block.rb b/end-block.rb", + "index ad181ce..dd2d1da 100644", + "--- a/end-block.rb", + "+++ b/end-block.rb", + "@@ -1,6 +1,3 @@", + "-END {", + "- foo", + "-}", + " foo", + " END {", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e5d578e9a4c5d74dc7eb4156444f5c7a3e92b61f..b18119fab94a46220722a90bc31e7820dc405094" +} +,{ + "testCaseDescription": "ruby-end-block-delete-rest-test", + "expectedResult": { + "changes": { + "end-block.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Deleted an END block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "end-block.rb" + ], + "patch": [ + "diff --git a/end-block.rb b/end-block.rb", + "index dd2d1da..e69de29 100644", + "--- a/end-block.rb", + "+++ b/end-block.rb", + "@@ -1,4 +0,0 @@", + "-foo", + "-END {", + "- bar", + "-}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b18119fab94a46220722a90bc31e7820dc405094..65e9e9e96571a8ccd1c8e2e3fef5dc47a03b9a1e" +}] diff --git a/test/corpus/diff-summaries/ruby/ensure.json b/test/corpus/diff-summaries/ruby/ensure.json new file mode 100644 index 000000000..e7ff38d6e --- /dev/null +++ b/test/corpus/diff-summaries/ruby/ensure.json @@ -0,0 +1,270 @@ +[{ + "testCaseDescription": "ruby-ensure-setup-test", + "expectedResult": { + "changes": { + "ensure.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ensure.rb" + ], + "patch": [ + "diff --git a/ensure.rb b/ensure.rb", + "index e69de29..dbcd28c 100644", + "--- a/ensure.rb", + "+++ b/ensure.rb", + "@@ -0,0 +1,3 @@", + "+begin", + "+ foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "08a206422217a4c25117cdd9e4c7cf57ec7e6093..5d373c28cbc9b169d4ce1d745708bb67962d6860" +} +,{ + "testCaseDescription": "ruby-ensure-insert-test", + "expectedResult": { + "changes": { + "ensure.rb": [ + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added an ensure block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ensure.rb" + ], + "patch": [ + "diff --git a/ensure.rb b/ensure.rb", + "index dbcd28c..4332810 100644", + "--- a/ensure.rb", + "+++ b/ensure.rb", + "@@ -1,3 +1,4 @@", + " begin", + " foo", + "+ensure", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5d373c28cbc9b169d4ce1d745708bb67962d6860..b35ee909c06da2c4ec7cd6218e376d137f96ee52" +} +,{ + "testCaseDescription": "ruby-ensure-replacement-test", + "expectedResult": { + "changes": { + "ensure.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + }, + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + ] + }, + "summary": "Replaced an ensure block with the 'bar' identifier in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ensure.rb" + ], + "patch": [ + "diff --git a/ensure.rb b/ensure.rb", + "index 4332810..ddde828 100644", + "--- a/ensure.rb", + "+++ b/ensure.rb", + "@@ -1,4 +1,5 @@", + " begin", + " foo", + " ensure", + "+ bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b35ee909c06da2c4ec7cd6218e376d137f96ee52..80f82a56a5ae5005dc6e84ac8d600af579dc294a" +} +,{ + "testCaseDescription": "ruby-ensure-delete-replacement-test", + "expectedResult": { + "changes": { + "ensure.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with an ensure block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ensure.rb" + ], + "patch": [ + "diff --git a/ensure.rb b/ensure.rb", + "index ddde828..4332810 100644", + "--- a/ensure.rb", + "+++ b/ensure.rb", + "@@ -1,5 +1,4 @@", + " begin", + " foo", + " ensure", + "- bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "80f82a56a5ae5005dc6e84ac8d600af579dc294a..7c709056275578aae8a2046ad3b424ddb4f5e5d4" +} +,{ + "testCaseDescription": "ruby-ensure-delete-insert-test", + "expectedResult": { + "changes": { + "ensure.rb": [ + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted an ensure block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ensure.rb" + ], + "patch": [ + "diff --git a/ensure.rb b/ensure.rb", + "index 4332810..dbcd28c 100644", + "--- a/ensure.rb", + "+++ b/ensure.rb", + "@@ -1,4 +1,3 @@", + " begin", + " foo", + "-ensure", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7c709056275578aae8a2046ad3b424ddb4f5e5d4..1f3fbe7780f91483eb5396bdc3c105321b1d4cfc" +} +,{ + "testCaseDescription": "ruby-ensure-teardown-test", + "expectedResult": { + "changes": { + "ensure.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ensure.rb" + ], + "patch": [ + "diff --git a/ensure.rb b/ensure.rb", + "index dbcd28c..e69de29 100644", + "--- a/ensure.rb", + "+++ b/ensure.rb", + "@@ -1,3 +0,0 @@", + "-begin", + "- foo", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1f3fbe7780f91483eb5396bdc3c105321b1d4cfc..71e169c7a4f73c1796a93e0301458608ca7a8740" +}] diff --git a/test/corpus/diff-summaries/ruby/for.json b/test/corpus/diff-summaries/ruby/for.json new file mode 100644 index 000000000..ec8f5c72e --- /dev/null +++ b/test/corpus/diff-summaries/ruby/for.json @@ -0,0 +1,374 @@ +[{ + "testCaseDescription": "ruby-for-insert-test", + "expectedResult": { + "changes": { + "for.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'x in y' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for.rb" + ], + "patch": [ + "diff --git a/for.rb b/for.rb", + "index e69de29..e4ea259 100644", + "--- a/for.rb", + "+++ b/for.rb", + "@@ -0,0 +1,3 @@", + "+for x in y", + "+ f", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "71e30ebbe7714f111528f8bd73008afd586d89b6..440934ba850ee0b6115144448c7c1b93b7f72722" +} +,{ + "testCaseDescription": "ruby-for-replacement-insert-test", + "expectedResult": { + "changes": { + "for.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'i in [1,2,3]' for statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'x in y' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for.rb" + ], + "patch": [ + "diff --git a/for.rb b/for.rb", + "index e4ea259..1ec5fb3 100644", + "--- a/for.rb", + "+++ b/for.rb", + "@@ -1,3 +1,9 @@", + "+for i in [1,2,3] do", + "+ print i", + "+end", + "+for x in y", + "+ f", + "+end", + " for x in y", + " f", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "440934ba850ee0b6115144448c7c1b93b7f72722..8d467f1f773254598c4fc26d0863cd66052e6dc9" +} +,{ + "testCaseDescription": "ruby-for-delete-insert-test", + "expectedResult": { + "changes": { + "for.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + ] + }, + "summary": "Replaced the 'i in [1,2,3]' for statement with the 'x in y' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for.rb" + ], + "patch": [ + "diff --git a/for.rb b/for.rb", + "index 1ec5fb3..b6b5bdd 100644", + "--- a/for.rb", + "+++ b/for.rb", + "@@ -1,5 +1,5 @@", + "-for i in [1,2,3] do", + "- print i", + "+for x in y", + "+ f", + " end", + " for x in y", + " f" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8d467f1f773254598c4fc26d0863cd66052e6dc9..a23ae69e2d83d7950653c5afd51bfd005ba67f18" +} +,{ + "testCaseDescription": "ruby-for-replacement-test", + "expectedResult": { + "changes": { + "for.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + ] + }, + "summary": "Replaced the 'x in y' for statement with the 'i in [1,2,3]' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for.rb" + ], + "patch": [ + "diff --git a/for.rb b/for.rb", + "index b6b5bdd..1ec5fb3 100644", + "--- a/for.rb", + "+++ b/for.rb", + "@@ -1,5 +1,5 @@", + "-for x in y", + "- f", + "+for i in [1,2,3] do", + "+ print i", + " end", + " for x in y", + " f" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a23ae69e2d83d7950653c5afd51bfd005ba67f18..8e03103f4c36dab3f49fba6521ae40a28be37c15" +} +,{ + "testCaseDescription": "ruby-for-delete-replacement-test", + "expectedResult": { + "changes": { + "for.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'i in [1,2,3]' for statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'x in y' for statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'i in [1,2,3]' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for.rb" + ], + "patch": [ + "diff --git a/for.rb b/for.rb", + "index 1ec5fb3..543a0c8 100644", + "--- a/for.rb", + "+++ b/for.rb", + "@@ -1,9 +1,6 @@", + "-for i in [1,2,3] do", + "- print i", + "-end", + " for x in y", + " f", + " end", + "-for x in y", + "- f", + "+for i in [1,2,3] do", + "+ print i", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8e03103f4c36dab3f49fba6521ae40a28be37c15..a094c66739b4b4089e3d69d022db0de9f59aa833" +} +,{ + "testCaseDescription": "ruby-for-delete-test", + "expectedResult": { + "changes": { + "for.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'x in y' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for.rb" + ], + "patch": [ + "diff --git a/for.rb b/for.rb", + "index 543a0c8..9031ee4 100644", + "--- a/for.rb", + "+++ b/for.rb", + "@@ -1,6 +1,3 @@", + "-for x in y", + "- f", + "-end", + " for i in [1,2,3] do", + " print i", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a094c66739b4b4089e3d69d022db0de9f59aa833..da5fa61e50a5112f25338df27d0e4cf549680d15" +} +,{ + "testCaseDescription": "ruby-for-delete-rest-test", + "expectedResult": { + "changes": { + "for.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'i in [1,2,3]' for statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "for.rb" + ], + "patch": [ + "diff --git a/for.rb b/for.rb", + "index 9031ee4..e69de29 100644", + "--- a/for.rb", + "+++ b/for.rb", + "@@ -1,3 +0,0 @@", + "-for i in [1,2,3] do", + "- print i", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "da5fa61e50a5112f25338df27d0e4cf549680d15..643d85053b9b9c5d600585bb7e1e8fe4160aae30" +}] diff --git a/test/corpus/diff-summaries/ruby/hash.json b/test/corpus/diff-summaries/ruby/hash.json new file mode 100644 index 000000000..eda2e3c33 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/hash.json @@ -0,0 +1,494 @@ +[{ + "testCaseDescription": "ruby-hash-insert-test", + "expectedResult": { + "changes": { + "hash.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 71 + ] + } + }, + "summary": "Added the '{ :key1 => \"value\", :key2 => 1, \"key3\": false, :\"symbol_key\" => 10 }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "hash.rb" + ], + "patch": [ + "diff --git a/hash.rb b/hash.rb", + "index e69de29..925618f 100644", + "--- a/hash.rb", + "+++ b/hash.rb", + "@@ -0,0 +1 @@", + "+{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "254bef3dc300da92915a826e73d24917af88cf5d..c1fb1ba8ae5833cd27a1714477f699691c163bbc" +} +,{ + "testCaseDescription": "ruby-hash-replacement-insert-test", + "expectedResult": { + "changes": { + "hash.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 47 + ] + } + }, + "summary": "Added the '{ key1: \"changed value\", key2: 2, key3: true }' object" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 71 + ] + } + }, + "summary": "Added the '{ :key1 => \"value\", :key2 => 1, \"key3\": false, :\"symbol_key\" => 10 }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "hash.rb" + ], + "patch": [ + "diff --git a/hash.rb b/hash.rb", + "index 925618f..a0c7d41 100644", + "--- a/hash.rb", + "+++ b/hash.rb", + "@@ -1 +1,3 @@", + "+{ key1: \"changed value\", key2: 2, key3: true }", + "+{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + " { :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c1fb1ba8ae5833cd27a1714477f699691c163bbc..97fb7c7c84cb9cd6f0fdb1db8ce31b861fa1b928" +} +,{ + "testCaseDescription": "ruby-hash-delete-insert-test", + "expectedResult": { + "changes": { + "hash.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 24 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 19 + ] + } + ] + }, + "summary": "Replaced the 'key1: \"changed value\"' pair with the ':key1 => \"value\"' pair" + }, + { + "span": { + "insert": { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Added the ':key2 => 1' pair" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 26 + ], + "end": [ + 1, + 33 + ] + }, + { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 48 + ] + } + ] + }, + "summary": "Replaced the 'key2: 2' pair with the '\"key3\": false' pair" + }, + { + "span": { + "insert": { + "start": [ + 1, + 50 + ], + "end": [ + 1, + 69 + ] + } + }, + "summary": "Added the ':\"symbol_key\" => 10' pair" + }, + { + "span": { + "delete": { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Deleted the 'key3: true' pair" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "hash.rb" + ], + "patch": [ + "diff --git a/hash.rb b/hash.rb", + "index a0c7d41..d4ed2ec 100644", + "--- a/hash.rb", + "+++ b/hash.rb", + "@@ -1,3 +1,3 @@", + "-{ key1: \"changed value\", key2: 2, key3: true }", + "+{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + " { :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + " { :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "97fb7c7c84cb9cd6f0fdb1db8ce31b861fa1b928..ed013b222c24601a99a76680d4de8210e84ffefd" +} +,{ + "testCaseDescription": "ruby-hash-replacement-test", + "expectedResult": { + "changes": { + "hash.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 19 + ] + }, + { + "start": [ + 1, + 3 + ], + "end": [ + 1, + 24 + ] + } + ] + }, + "summary": "Replaced the ':key1 => \"value\"' pair with the 'key1: \"changed value\"' pair" + }, + { + "span": { + "insert": { + "start": [ + 1, + 26 + ], + "end": [ + 1, + 33 + ] + } + }, + "summary": "Added the 'key2: 2' pair" + }, + { + "span": { + "insert": { + "start": [ + 1, + 35 + ], + "end": [ + 1, + 45 + ] + } + }, + "summary": "Added the 'key3: true' pair" + }, + { + "span": { + "delete": { + "start": [ + 1, + 21 + ], + "end": [ + 1, + 31 + ] + } + }, + "summary": "Deleted the ':key2 => 1' pair" + }, + { + "span": { + "delete": { + "start": [ + 1, + 33 + ], + "end": [ + 1, + 48 + ] + } + }, + "summary": "Deleted the '\"key3\": false' pair" + }, + { + "span": { + "delete": { + "start": [ + 1, + 50 + ], + "end": [ + 1, + 69 + ] + } + }, + "summary": "Deleted the ':\"symbol_key\" => 10' pair" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "hash.rb" + ], + "patch": [ + "diff --git a/hash.rb b/hash.rb", + "index d4ed2ec..a0c7d41 100644", + "--- a/hash.rb", + "+++ b/hash.rb", + "@@ -1,3 +1,3 @@", + "-{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + "+{ key1: \"changed value\", key2: 2, key3: true }", + " { :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + " { :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ed013b222c24601a99a76680d4de8210e84ffefd..fab17632a25b79077b9fed2c6c0fb1af0f7fdca4" +} +,{ + "testCaseDescription": "ruby-hash-delete-replacement-test", + "expectedResult": { + "changes": { + "hash.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 47 + ] + } + }, + "summary": "Deleted the '{ key1: \"changed value\", key2: 2, key3: true }' object" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 71 + ] + } + }, + "summary": "Deleted the '{ :key1 => \"value\", :key2 => 1, \"key3\": false, :\"symbol_key\" => 10 }' object" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 47 + ] + } + }, + "summary": "Added the '{ key1: \"changed value\", key2: 2, key3: true }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "hash.rb" + ], + "patch": [ + "diff --git a/hash.rb b/hash.rb", + "index a0c7d41..4154b7d 100644", + "--- a/hash.rb", + "+++ b/hash.rb", + "@@ -1,3 +1,2 @@", + "-{ key1: \"changed value\", key2: 2, key3: true }", + "-{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + " { :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + "+{ key1: \"changed value\", key2: 2, key3: true }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fab17632a25b79077b9fed2c6c0fb1af0f7fdca4..22bb2e8e2f1ce44a35dc2719f37c50720a8fd7da" +} +,{ + "testCaseDescription": "ruby-hash-delete-test", + "expectedResult": { + "changes": { + "hash.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 71 + ] + } + }, + "summary": "Deleted the '{ :key1 => \"value\", :key2 => 1, \"key3\": false, :\"symbol_key\" => 10 }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "hash.rb" + ], + "patch": [ + "diff --git a/hash.rb b/hash.rb", + "index 4154b7d..4a0e8d0 100644", + "--- a/hash.rb", + "+++ b/hash.rb", + "@@ -1,2 +1 @@", + "-{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + " { key1: \"changed value\", key2: 2, key3: true }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "22bb2e8e2f1ce44a35dc2719f37c50720a8fd7da..308a3c73e7af4a230df5a16c8a390f622ba64cfa" +} +,{ + "testCaseDescription": "ruby-hash-delete-rest-test", + "expectedResult": { + "changes": { + "hash.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 47 + ] + } + }, + "summary": "Deleted the '{ key1: \"changed value\", key2: 2, key3: true }' object" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "hash.rb" + ], + "patch": [ + "diff --git a/hash.rb b/hash.rb", + "index 4a0e8d0..e69de29 100644", + "--- a/hash.rb", + "+++ b/hash.rb", + "@@ -1 +0,0 @@", + "-{ key1: \"changed value\", key2: 2, key3: true }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "308a3c73e7af4a230df5a16c8a390f622ba64cfa..fc62b0d430cee4f179260f256a053b4b124d6ce4" +}] diff --git a/test/corpus/diff-summaries/ruby/if-unless-modifiers.json b/test/corpus/diff-summaries/ruby/if-unless-modifiers.json new file mode 100644 index 000000000..6b1fcbb90 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/if-unless-modifiers.json @@ -0,0 +1,353 @@ +[{ + "testCaseDescription": "ruby-if-unless-modifiers-insert-test", + "expectedResult": { + "changes": { + "if-unless-modifiers.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Added the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-unless-modifiers.rb" + ], + "patch": [ + "diff --git a/if-unless-modifiers.rb b/if-unless-modifiers.rb", + "index e69de29..45ff4a6 100644", + "--- a/if-unless-modifiers.rb", + "+++ b/if-unless-modifiers.rb", + "@@ -0,0 +1 @@", + "+print unless foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "83f860d780243e3aae7889d9d0c3d7452d096ea9..3e01610ccd15c03cfe3d4887120eb14ea70641cc" +} +,{ + "testCaseDescription": "ruby-if-unless-modifiers-replacement-insert-test", + "expectedResult": { + "changes": { + "if-unless-modifiers.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'foo' if statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Added the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-unless-modifiers.rb" + ], + "patch": [ + "diff --git a/if-unless-modifiers.rb b/if-unless-modifiers.rb", + "index 45ff4a6..cb2925a 100644", + "--- a/if-unless-modifiers.rb", + "+++ b/if-unless-modifiers.rb", + "@@ -1 +1,3 @@", + "+print if foo", + "+print unless foo", + " print unless foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3e01610ccd15c03cfe3d4887120eb14ea70641cc..1fa7428a24e2b74614a782d770d4e87f3da64f3b" +} +,{ + "testCaseDescription": "ruby-if-unless-modifiers-delete-insert-test", + "expectedResult": { + "changes": { + "if-unless-modifiers.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Added the 'foo' unless statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'foo' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-unless-modifiers.rb" + ], + "patch": [ + "diff --git a/if-unless-modifiers.rb b/if-unless-modifiers.rb", + "index cb2925a..04f425e 100644", + "--- a/if-unless-modifiers.rb", + "+++ b/if-unless-modifiers.rb", + "@@ -1,3 +1,3 @@", + "-print if foo", + "+print unless foo", + " print unless foo", + " print unless foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1fa7428a24e2b74614a782d770d4e87f3da64f3b..79340c2e1587977520b4f171aea61ca20695be0d" +} +,{ + "testCaseDescription": "ruby-if-unless-modifiers-replacement-test", + "expectedResult": { + "changes": { + "if-unless-modifiers.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'foo' if statement" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-unless-modifiers.rb" + ], + "patch": [ + "diff --git a/if-unless-modifiers.rb b/if-unless-modifiers.rb", + "index 04f425e..cb2925a 100644", + "--- a/if-unless-modifiers.rb", + "+++ b/if-unless-modifiers.rb", + "@@ -1,3 +1,3 @@", + "-print unless foo", + "+print if foo", + " print unless foo", + " print unless foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "79340c2e1587977520b4f171aea61ca20695be0d..35ae35ab5f2a2f770696d9b2a6fcbf71ceae99ec" +} +,{ + "testCaseDescription": "ruby-if-unless-modifiers-delete-replacement-test", + "expectedResult": { + "changes": { + "if-unless-modifiers.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'foo' if statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Deleted the 'foo' unless statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the 'foo' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-unless-modifiers.rb" + ], + "patch": [ + "diff --git a/if-unless-modifiers.rb b/if-unless-modifiers.rb", + "index cb2925a..a3f9060 100644", + "--- a/if-unless-modifiers.rb", + "+++ b/if-unless-modifiers.rb", + "@@ -1,3 +1,2 @@", + "-print if foo", + "-print unless foo", + " print unless foo", + "+print if foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "35ae35ab5f2a2f770696d9b2a6fcbf71ceae99ec..c7e3619d596dd8e2b97f7c635e415ca8da0b21fc" +} +,{ + "testCaseDescription": "ruby-if-unless-modifiers-delete-test", + "expectedResult": { + "changes": { + "if-unless-modifiers.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-unless-modifiers.rb" + ], + "patch": [ + "diff --git a/if-unless-modifiers.rb b/if-unless-modifiers.rb", + "index a3f9060..2021b1b 100644", + "--- a/if-unless-modifiers.rb", + "+++ b/if-unless-modifiers.rb", + "@@ -1,2 +1 @@", + "-print unless foo", + " print if foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c7e3619d596dd8e2b97f7c635e415ca8da0b21fc..8c0cc12ff2198b60850dbf2fdbbc466fea5a7efe" +} +,{ + "testCaseDescription": "ruby-if-unless-modifiers-delete-rest-test", + "expectedResult": { + "changes": { + "if-unless-modifiers.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'foo' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if-unless-modifiers.rb" + ], + "patch": [ + "diff --git a/if-unless-modifiers.rb b/if-unless-modifiers.rb", + "index 2021b1b..e69de29 100644", + "--- a/if-unless-modifiers.rb", + "+++ b/if-unless-modifiers.rb", + "@@ -1 +0,0 @@", + "-print if foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8c0cc12ff2198b60850dbf2fdbbc466fea5a7efe..cb1564b73681fa50073f0458c77da34ccc744eec" +}] diff --git a/test/corpus/diff-summaries/ruby/if.json b/test/corpus/diff-summaries/ruby/if.json new file mode 100644 index 000000000..647454ccb --- /dev/null +++ b/test/corpus/diff-summaries/ruby/if.json @@ -0,0 +1,498 @@ +[{ + "testCaseDescription": "ruby-if-insert-test", + "expectedResult": { + "changes": { + "if.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 7, + 4 + ] + } + }, + "summary": "Added the 'foo' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.rb" + ], + "patch": [ + "diff --git a/if.rb b/if.rb", + "index e69de29..c4c729f 100644", + "--- a/if.rb", + "+++ b/if.rb", + "@@ -0,0 +1,7 @@", + "+if foo", + "+ bar", + "+elsif quux", + "+ baz", + "+else", + "+ bat", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "895ec09c6b1830368e488d03e9bdef18e730e946..8063575d180f343235440191fad18a0bb5fb8c76" +} +,{ + "testCaseDescription": "ruby-if-replacement-insert-test", + "expectedResult": { + "changes": { + "if.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'x' if statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'y' if statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 11, + 4 + ] + } + }, + "summary": "Added the 'foo' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.rb" + ], + "patch": [ + "diff --git a/if.rb b/if.rb", + "index c4c729f..326833f 100644", + "--- a/if.rb", + "+++ b/if.rb", + "@@ -1,3 +1,14 @@", + "+if x", + "+end", + "+if y then", + "+end", + "+if foo", + "+ bar", + "+elsif quux", + "+ baz", + "+else", + "+ bat", + "+end", + " if foo", + " bar", + " elsif quux" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8063575d180f343235440191fad18a0bb5fb8c76..c3d5206979581d0afae21a0e38ff352f81810b42" +} +,{ + "testCaseDescription": "ruby-if-delete-insert-test", + "expectedResult": { + "changes": { + "if.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 5 + ] + }, + { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'foo' identifier in the 'foo' if statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'bar' identifier in the 'foo' if statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 7, + 1 + ] + } + }, + "summary": "Added the 'quux' elsif block in the 'foo' if statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'y' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.rb" + ], + "patch": [ + "diff --git a/if.rb b/if.rb", + "index 326833f..2cbbfda 100644", + "--- a/if.rb", + "+++ b/if.rb", + "@@ -1,6 +1,9 @@", + "-if x", + "-end", + "-if y then", + "+if foo", + "+ bar", + "+elsif quux", + "+ baz", + "+else", + "+ bat", + " end", + " if foo", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c3d5206979581d0afae21a0e38ff352f81810b42..21450a8410cb551ce5db0aa969c649657493ecdb" +} +,{ + "testCaseDescription": "ruby-if-replacement-test", + "expectedResult": { + "changes": { + "if.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 5 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'x' identifier in the 'x' if statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'bar' identifier in the 'x' if statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 7, + 1 + ] + } + }, + "summary": "Deleted the 'quux' elsif block in the 'x' if statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'y' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.rb" + ], + "patch": [ + "diff --git a/if.rb b/if.rb", + "index 2cbbfda..326833f 100644", + "--- a/if.rb", + "+++ b/if.rb", + "@@ -1,9 +1,6 @@", + "-if foo", + "- bar", + "-elsif quux", + "- baz", + "-else", + "- bat", + "+if x", + "+end", + "+if y then", + " end", + " if foo", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "21450a8410cb551ce5db0aa969c649657493ecdb..9fb361c2df2445bf8fe6b32444438c1993a9a5c5" +} +,{ + "testCaseDescription": "ruby-if-delete-replacement-test", + "expectedResult": { + "changes": { + "if.rb": [ + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 18, + 4 + ] + } + }, + "summary": "Deleted the 'foo' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.rb" + ], + "patch": [ + "diff --git a/if.rb b/if.rb", + "index 326833f..2927cc0 100644", + "--- a/if.rb", + "+++ b/if.rb", + "@@ -1,7 +1,3 @@", + "-if x", + "-end", + "-if y then", + "-end", + " if foo", + " bar", + " elsif quux", + "@@ -9,10 +5,7 @@ elsif quux", + " else", + " bat", + " end", + "-if foo", + "- bar", + "-elsif quux", + "- baz", + "-else", + "- bat", + "+if x", + "+end", + "+if y then", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9fb361c2df2445bf8fe6b32444438c1993a9a5c5..88a366ccd4c7c230da7b3f8c269db206e55d35f1" +} +,{ + "testCaseDescription": "ruby-if-delete-test", + "expectedResult": { + "changes": { + "if.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 7, + 4 + ] + } + }, + "summary": "Deleted the 'foo' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.rb" + ], + "patch": [ + "diff --git a/if.rb b/if.rb", + "index 2927cc0..5bfb167 100644", + "--- a/if.rb", + "+++ b/if.rb", + "@@ -1,10 +1,3 @@", + "-if foo", + "- bar", + "-elsif quux", + "- baz", + "-else", + "- bat", + "-end", + " if x", + " end", + " if y then" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "88a366ccd4c7c230da7b3f8c269db206e55d35f1..c2a0f4fbca1cffe775c7ac81025ab077fa1534ea" +} +,{ + "testCaseDescription": "ruby-if-delete-rest-test", + "expectedResult": { + "changes": { + "if.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'x' if statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'y' if statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "if.rb" + ], + "patch": [ + "diff --git a/if.rb b/if.rb", + "index 5bfb167..e69de29 100644", + "--- a/if.rb", + "+++ b/if.rb", + "@@ -1,4 +0,0 @@", + "-if x", + "-end", + "-if y then", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c2a0f4fbca1cffe775c7ac81025ab077fa1534ea..357b28a188fc8984427a1ae219edd194329ebebc" +}] diff --git a/test/corpus/diff-summaries/ruby/interpolation.json b/test/corpus/diff-summaries/ruby/interpolation.json new file mode 100644 index 000000000..f9afadddc --- /dev/null +++ b/test/corpus/diff-summaries/ruby/interpolation.json @@ -0,0 +1,538 @@ +[{ + "testCaseDescription": "ruby-interpolation-insert-test", + "expectedResult": { + "changes": { + "interpolation.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Added the 'bar' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Added the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interpolation.rb" + ], + "patch": [ + "diff --git a/interpolation.rb b/interpolation.rb", + "index e69de29..a37ad45 100644", + "--- a/interpolation.rb", + "+++ b/interpolation.rb", + "@@ -0,0 +1,2 @@", + "+:\"foo #{bar}\"", + "+\"foo #{bar}\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "57121851289086218aea914888bd04b3ab064716..c2ba702430f25eb241e30acdb7764fd422b1d989" +} +,{ + "testCaseDescription": "ruby-interpolation-replacement-insert-test", + "expectedResult": { + "changes": { + "interpolation.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Added the 'foo' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Added the 'foo' identifier" + }, + { + "span": { + "insert": { + "start": [ + 3, + 9 + ], + "end": [ + 3, + 12 + ] + } + }, + "summary": "Added the 'bar' identifier" + }, + { + "span": { + "insert": { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interpolation.rb" + ], + "patch": [ + "diff --git a/interpolation.rb b/interpolation.rb", + "index a37ad45..c024bd6 100644", + "--- a/interpolation.rb", + "+++ b/interpolation.rb", + "@@ -1,2 +1,6 @@", + "+:\"bar #{foo}\"", + "+\"bar #{foo}\"", + "+:\"foo #{bar}\"", + "+\"foo #{bar}\"", + " :\"foo #{bar}\"", + " \"foo #{bar}\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c2ba702430f25eb241e30acdb7764fd422b1d989..35bd1657e6377602413f3395baf5d1b37ff29d8b" +} +,{ + "testCaseDescription": "ruby-interpolation-delete-insert-test", + "expectedResult": { + "changes": { + "interpolation.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + }, + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + }, + { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interpolation.rb" + ], + "patch": [ + "diff --git a/interpolation.rb b/interpolation.rb", + "index c024bd6..ce70dd5 100644", + "--- a/interpolation.rb", + "+++ b/interpolation.rb", + "@@ -1,5 +1,5 @@", + "-:\"bar #{foo}\"", + "-\"bar #{foo}\"", + "+:\"foo #{bar}\"", + "+\"foo #{bar}\"", + " :\"foo #{bar}\"", + " \"foo #{bar}\"", + " :\"foo #{bar}\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "35bd1657e6377602413f3395baf5d1b37ff29d8b..1705098a82f575d1fd258aee6710726310dcae97" +} +,{ + "testCaseDescription": "ruby-interpolation-replacement-test", + "expectedResult": { + "changes": { + "interpolation.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + }, + { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + }, + { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interpolation.rb" + ], + "patch": [ + "diff --git a/interpolation.rb b/interpolation.rb", + "index ce70dd5..c024bd6 100644", + "--- a/interpolation.rb", + "+++ b/interpolation.rb", + "@@ -1,5 +1,5 @@", + "-:\"foo #{bar}\"", + "-\"foo #{bar}\"", + "+:\"bar #{foo}\"", + "+\"bar #{foo}\"", + " :\"foo #{bar}\"", + " \"foo #{bar}\"", + " :\"foo #{bar}\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1705098a82f575d1fd258aee6710726310dcae97..6771369e5922cd7d1386b5b4aab61ef734b9a1f9" +} +,{ + "testCaseDescription": "ruby-interpolation-delete-replacement-test", + "expectedResult": { + "changes": { + "interpolation.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + }, + { + "span": { + "delete": { + "start": [ + 3, + 9 + ], + "end": [ + 3, + 12 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + }, + { + "span": { + "delete": { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + }, + { + "span": { + "insert": { + "start": [ + 3, + 9 + ], + "end": [ + 3, + 12 + ] + } + }, + "summary": "Added the 'foo' identifier" + }, + { + "span": { + "insert": { + "start": [ + 4, + 8 + ], + "end": [ + 4, + 11 + ] + } + }, + "summary": "Added the 'foo' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interpolation.rb" + ], + "patch": [ + "diff --git a/interpolation.rb b/interpolation.rb", + "index c024bd6..f56366a 100644", + "--- a/interpolation.rb", + "+++ b/interpolation.rb", + "@@ -1,6 +1,4 @@", + "-:\"bar #{foo}\"", + "-\"bar #{foo}\"", + "-:\"foo #{bar}\"", + "-\"foo #{bar}\"", + " :\"foo #{bar}\"", + " \"foo #{bar}\"", + "+:\"bar #{foo}\"", + "+\"bar #{foo}\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6771369e5922cd7d1386b5b4aab61ef734b9a1f9..768d0209feac8bb2cbcca835fca75a6cd0d0e732" +} +,{ + "testCaseDescription": "ruby-interpolation-delete-test", + "expectedResult": { + "changes": { + "interpolation.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interpolation.rb" + ], + "patch": [ + "diff --git a/interpolation.rb b/interpolation.rb", + "index f56366a..9b7bb17 100644", + "--- a/interpolation.rb", + "+++ b/interpolation.rb", + "@@ -1,4 +1,2 @@", + "-:\"foo #{bar}\"", + "-\"foo #{bar}\"", + " :\"bar #{foo}\"", + " \"bar #{foo}\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "768d0209feac8bb2cbcca835fca75a6cd0d0e732..d5cb9abbeac42729ad4a83f7ff4581fa83171528" +} +,{ + "testCaseDescription": "ruby-interpolation-delete-rest-test", + "expectedResult": { + "changes": { + "interpolation.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 8 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "interpolation.rb" + ], + "patch": [ + "diff --git a/interpolation.rb b/interpolation.rb", + "index 9b7bb17..e69de29 100644", + "--- a/interpolation.rb", + "+++ b/interpolation.rb", + "@@ -1,2 +0,0 @@", + "-:\"bar #{foo}\"", + "-\"bar #{foo}\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d5cb9abbeac42729ad4a83f7ff4581fa83171528..370c0a6d0e774ad3b0d66bf1c3a960572964e039" +}] diff --git a/test/corpus/diff-summaries/ruby/lambda-dash-rocket.json b/test/corpus/diff-summaries/ruby/lambda-dash-rocket.json new file mode 100644 index 000000000..a46c25e03 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/lambda-dash-rocket.json @@ -0,0 +1,372 @@ +[{ + "testCaseDescription": "ruby-lambda-dash-rocket-insert-test", + "expectedResult": { + "changes": { + "lambda-dash-rocket.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Added an anonymous(a, b, c) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda-dash-rocket.rb" + ], + "patch": [ + "diff --git a/lambda-dash-rocket.rb b/lambda-dash-rocket.rb", + "index e69de29..87e5852 100644", + "--- a/lambda-dash-rocket.rb", + "+++ b/lambda-dash-rocket.rb", + "@@ -0,0 +1,4 @@", + "+-> (a, b, c) {", + "+ 1", + "+ 2", + "+}" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f1330cd221cc5290eff93e43fae52bea85ae512b..8057513f7571e9b8a73b0a6e76f1b1b79e233b74" +} +,{ + "testCaseDescription": "ruby-lambda-dash-rocket-replacement-insert-test", + "expectedResult": { + "changes": { + "lambda-dash-rocket.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added an anonymous() function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Added an anonymous(a, b, c) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda-dash-rocket.rb" + ], + "patch": [ + "diff --git a/lambda-dash-rocket.rb b/lambda-dash-rocket.rb", + "index 87e5852..3daf118 100644", + "--- a/lambda-dash-rocket.rb", + "+++ b/lambda-dash-rocket.rb", + "@@ -1,3 +1,8 @@", + "+-> { foo }", + "+-> (a, b, c) {", + "+ 1", + "+ 2", + "+}", + " -> (a, b, c) {", + " 1", + " 2" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8057513f7571e9b8a73b0a6e76f1b1b79e233b74..c2f7023365f0af9ed5267acaf4c7e4bef7ba4837" +} +,{ + "testCaseDescription": "ruby-lambda-dash-rocket-delete-insert-test", + "expectedResult": { + "changes": { + "lambda-dash-rocket.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 2 + ] + } + ] + }, + "summary": "Replaced an anonymous() function with an anonymous(a, b, c) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda-dash-rocket.rb" + ], + "patch": [ + "diff --git a/lambda-dash-rocket.rb b/lambda-dash-rocket.rb", + "index 3daf118..53ea219 100644", + "--- a/lambda-dash-rocket.rb", + "+++ b/lambda-dash-rocket.rb", + "@@ -1,4 +1,7 @@", + "--> { foo }", + "+-> (a, b, c) {", + "+ 1", + "+ 2", + "+}", + " -> (a, b, c) {", + " 1", + " 2" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c2f7023365f0af9ed5267acaf4c7e4bef7ba4837..24d7890407ed66c9f6b3cf1190247169f14aca30" +} +,{ + "testCaseDescription": "ruby-lambda-dash-rocket-replacement-test", + "expectedResult": { + "changes": { + "lambda-dash-rocket.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 2 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced an anonymous(a, b, c) function with an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda-dash-rocket.rb" + ], + "patch": [ + "diff --git a/lambda-dash-rocket.rb b/lambda-dash-rocket.rb", + "index 53ea219..3daf118 100644", + "--- a/lambda-dash-rocket.rb", + "+++ b/lambda-dash-rocket.rb", + "@@ -1,7 +1,4 @@", + "--> (a, b, c) {", + "- 1", + "- 2", + "-}", + "+-> { foo }", + " -> (a, b, c) {", + " 1", + " 2" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "24d7890407ed66c9f6b3cf1190247169f14aca30..889fdca02bc486869c143c5c1badb40ece77ed43" +} +,{ + "testCaseDescription": "ruby-lambda-dash-rocket-delete-replacement-test", + "expectedResult": { + "changes": { + "lambda-dash-rocket.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted an anonymous() function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 5, + 2 + ] + } + }, + "summary": "Deleted an anonymous(a, b, c) function" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 11 + ] + } + }, + "summary": "Added an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda-dash-rocket.rb" + ], + "patch": [ + "diff --git a/lambda-dash-rocket.rb b/lambda-dash-rocket.rb", + "index 3daf118..5e26f49 100644", + "--- a/lambda-dash-rocket.rb", + "+++ b/lambda-dash-rocket.rb", + "@@ -1,9 +1,5 @@", + "--> { foo }", + "--> (a, b, c) {", + "- 1", + "- 2", + "-}", + " -> (a, b, c) {", + " 1", + " 2", + " }", + "+-> { foo }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "889fdca02bc486869c143c5c1badb40ece77ed43..d3feb7074747782d905843ce7a56f641a1a5703d" +} +,{ + "testCaseDescription": "ruby-lambda-dash-rocket-delete-test", + "expectedResult": { + "changes": { + "lambda-dash-rocket.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 2 + ] + } + }, + "summary": "Deleted an anonymous(a, b, c) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda-dash-rocket.rb" + ], + "patch": [ + "diff --git a/lambda-dash-rocket.rb b/lambda-dash-rocket.rb", + "index 5e26f49..72c62f8 100644", + "--- a/lambda-dash-rocket.rb", + "+++ b/lambda-dash-rocket.rb", + "@@ -1,5 +1 @@", + "--> (a, b, c) {", + "- 1", + "- 2", + "-}", + " -> { foo }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d3feb7074747782d905843ce7a56f641a1a5703d..de70a8072f57897642e8dd0c17b0b17ce60d0791" +} +,{ + "testCaseDescription": "ruby-lambda-dash-rocket-delete-rest-test", + "expectedResult": { + "changes": { + "lambda-dash-rocket.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda-dash-rocket.rb" + ], + "patch": [ + "diff --git a/lambda-dash-rocket.rb b/lambda-dash-rocket.rb", + "index 72c62f8..e69de29 100644", + "--- a/lambda-dash-rocket.rb", + "+++ b/lambda-dash-rocket.rb", + "@@ -1 +0,0 @@", + "--> { foo }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "de70a8072f57897642e8dd0c17b0b17ce60d0791..e9b82da017d2fd0d80f3425faa89c3cfe005493e" +}] diff --git a/test/corpus/diff-summaries/ruby/lambda.json b/test/corpus/diff-summaries/ruby/lambda.json new file mode 100644 index 000000000..9c596bdb9 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/lambda.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-lambda-insert-test", + "expectedResult": { + "changes": { + "lambda.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda.rb" + ], + "patch": [ + "diff --git a/lambda.rb b/lambda.rb", + "index e69de29..943ace3 100644", + "--- a/lambda.rb", + "+++ b/lambda.rb", + "@@ -0,0 +1 @@", + "+lambda { foo }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e9b82da017d2fd0d80f3425faa89c3cfe005493e..43fd80cc492c0d186062fa3f25886bb3213c36b7" +} +,{ + "testCaseDescription": "ruby-lambda-replacement-insert-test", + "expectedResult": { + "changes": { + "lambda.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added an anonymous(x) function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Added an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda.rb" + ], + "patch": [ + "diff --git a/lambda.rb b/lambda.rb", + "index 943ace3..cb843af 100644", + "--- a/lambda.rb", + "+++ b/lambda.rb", + "@@ -1 +1,3 @@", + "+lambda { |x| x + 1 }", + "+lambda { foo }", + " lambda { foo }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "43fd80cc492c0d186062fa3f25886bb3213c36b7..2e6150409a4e7b1dd12ba66e429e04d041b2e31f" +} +,{ + "testCaseDescription": "ruby-lambda-delete-insert-test", + "expectedResult": { + "changes": { + "lambda.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced an anonymous(x) function with an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda.rb" + ], + "patch": [ + "diff --git a/lambda.rb b/lambda.rb", + "index cb843af..447bfb7 100644", + "--- a/lambda.rb", + "+++ b/lambda.rb", + "@@ -1,3 +1,3 @@", + "-lambda { |x| x + 1 }", + "+lambda { foo }", + " lambda { foo }", + " lambda { foo }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2e6150409a4e7b1dd12ba66e429e04d041b2e31f..7f531df6a4968d0a034b15cea699dbdfe9e10fcc" +} +,{ + "testCaseDescription": "ruby-lambda-replacement-test", + "expectedResult": { + "changes": { + "lambda.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + ] + }, + "summary": "Replaced an anonymous() function with an anonymous(x) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda.rb" + ], + "patch": [ + "diff --git a/lambda.rb b/lambda.rb", + "index 447bfb7..cb843af 100644", + "--- a/lambda.rb", + "+++ b/lambda.rb", + "@@ -1,3 +1,3 @@", + "-lambda { foo }", + "+lambda { |x| x + 1 }", + " lambda { foo }", + " lambda { foo }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7f531df6a4968d0a034b15cea699dbdfe9e10fcc..867fbe7dfab585d67803cf3f080d9d31a3de72b4" +} +,{ + "testCaseDescription": "ruby-lambda-delete-replacement-test", + "expectedResult": { + "changes": { + "lambda.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted an anonymous(x) function" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Deleted an anonymous() function" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Added an anonymous(x) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda.rb" + ], + "patch": [ + "diff --git a/lambda.rb b/lambda.rb", + "index cb843af..4ebf1f8 100644", + "--- a/lambda.rb", + "+++ b/lambda.rb", + "@@ -1,3 +1,2 @@", + "-lambda { |x| x + 1 }", + "-lambda { foo }", + " lambda { foo }", + "+lambda { |x| x + 1 }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "867fbe7dfab585d67803cf3f080d9d31a3de72b4..8c541c2efb635966f9f3a848bd3aa4e0ae52f966" +} +,{ + "testCaseDescription": "ruby-lambda-delete-test", + "expectedResult": { + "changes": { + "lambda.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted an anonymous() function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda.rb" + ], + "patch": [ + "diff --git a/lambda.rb b/lambda.rb", + "index 4ebf1f8..dfe1b8b 100644", + "--- a/lambda.rb", + "+++ b/lambda.rb", + "@@ -1,2 +1 @@", + "-lambda { foo }", + " lambda { |x| x + 1 }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8c541c2efb635966f9f3a848bd3aa4e0ae52f966..4e1e452d4ddff1d7128637e1a3e9440a5940aa1f" +} +,{ + "testCaseDescription": "ruby-lambda-delete-rest-test", + "expectedResult": { + "changes": { + "lambda.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted an anonymous(x) function" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "lambda.rb" + ], + "patch": [ + "diff --git a/lambda.rb b/lambda.rb", + "index dfe1b8b..e69de29 100644", + "--- a/lambda.rb", + "+++ b/lambda.rb", + "@@ -1 +0,0 @@", + "-lambda { |x| x + 1 }" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4e1e452d4ddff1d7128637e1a3e9440a5940aa1f..71e30ebbe7714f111528f8bd73008afd586d89b6" +}] diff --git a/test/corpus/diff-summaries/ruby/math-assignment.json b/test/corpus/diff-summaries/ruby/math-assignment.json new file mode 100644 index 000000000..5764a1a51 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/math-assignment.json @@ -0,0 +1,744 @@ +[{ + "testCaseDescription": "ruby-math-assignment-insert-test", + "expectedResult": { + "changes": { + "math-assignment.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Added the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment.rb" + ], + "patch": [ + "diff --git a/math-assignment.rb b/math-assignment.rb", + "index e69de29..9c3bd32 100644", + "--- a/math-assignment.rb", + "+++ b/math-assignment.rb", + "@@ -0,0 +1,5 @@", + "+x += 1", + "+x -= 1", + "+x *= 1", + "+x /= 1", + "+x **= 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6f7fda4304f4cd5dfe0e528d2d6bdb800b773821..b73e7b1ce9ffe48cb6378ef9412cf9705e023d69" +} +,{ + "testCaseDescription": "ruby-math-assignment-replacement-insert-test", + "expectedResult": { + "changes": { + "math-assignment.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 7 + ] + } + }, + "summary": "Added the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 8 + ] + } + }, + "summary": "Added the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment.rb" + ], + "patch": [ + "diff --git a/math-assignment.rb b/math-assignment.rb", + "index 9c3bd32..ebf1cd7 100644", + "--- a/math-assignment.rb", + "+++ b/math-assignment.rb", + "@@ -1,3 +1,13 @@", + "+x+= 2", + "+x -= 1", + "+x *= 1", + "+x /= 1", + "+x **= 1", + "+x += 1", + "+x -= 1", + "+x *= 1", + "+x /= 1", + "+x **= 1", + " x += 1", + " x -= 1", + " x *= 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b73e7b1ce9ffe48cb6378ef9412cf9705e023d69..aacfb2e75b0d8b9ff68e8a5829b9fcf0183455dd" +} +,{ + "testCaseDescription": "ruby-math-assignment-delete-insert-test", + "expectedResult": { + "changes": { + "math-assignment.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced '2' with '1' in the x operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment.rb" + ], + "patch": [ + "diff --git a/math-assignment.rb b/math-assignment.rb", + "index ebf1cd7..8751768 100644", + "--- a/math-assignment.rb", + "+++ b/math-assignment.rb", + "@@ -1,4 +1,4 @@", + "-x+= 2", + "+x += 1", + " x -= 1", + " x *= 1", + " x /= 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "aacfb2e75b0d8b9ff68e8a5829b9fcf0183455dd..765c112881f9f5b2eff93b884e58cb650b6ead8d" +} +,{ + "testCaseDescription": "ruby-math-assignment-replacement-test", + "expectedResult": { + "changes": { + "math-assignment.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 6 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced '1' with '2' in the x operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment.rb" + ], + "patch": [ + "diff --git a/math-assignment.rb b/math-assignment.rb", + "index 8751768..ebf1cd7 100644", + "--- a/math-assignment.rb", + "+++ b/math-assignment.rb", + "@@ -1,4 +1,4 @@", + "-x += 1", + "+x+= 2", + " x -= 1", + " x *= 1", + " x /= 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "765c112881f9f5b2eff93b884e58cb650b6ead8d..0bc46fb99327da758833ae005ed425950b5a86d7" +} +,{ + "testCaseDescription": "ruby-math-assignment-delete-replacement-test", + "expectedResult": { + "changes": { + "math-assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Added the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment.rb" + ], + "patch": [ + "diff --git a/math-assignment.rb b/math-assignment.rb", + "index ebf1cd7..207ee13 100644", + "--- a/math-assignment.rb", + "+++ b/math-assignment.rb", + "@@ -1,14 +1,9 @@", + "-x+= 2", + "-x -= 1", + "-x *= 1", + "-x /= 1", + "-x **= 1", + " x += 1", + " x -= 1", + " x *= 1", + " x /= 1", + " x **= 1", + "-x += 1", + "+x+= 2", + " x -= 1", + " x *= 1", + " x /= 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0bc46fb99327da758833ae005ed425950b5a86d7..d189598fc6e00c336f9cbeacefdc435b30e94beb" +} +,{ + "testCaseDescription": "ruby-math-assignment-delete-test", + "expectedResult": { + "changes": { + "math-assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment.rb" + ], + "patch": [ + "diff --git a/math-assignment.rb b/math-assignment.rb", + "index 207ee13..fd6ee10 100644", + "--- a/math-assignment.rb", + "+++ b/math-assignment.rb", + "@@ -1,8 +1,3 @@", + "-x += 1", + "-x -= 1", + "-x *= 1", + "-x /= 1", + "-x **= 1", + " x+= 2", + " x -= 1", + " x *= 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d189598fc6e00c336f9cbeacefdc435b30e94beb..c0f4dbd0aa0da12c301f0acc3e3a3e7d47bbb3c2" +} +,{ + "testCaseDescription": "ruby-math-assignment-delete-rest-test", + "expectedResult": { + "changes": { + "math-assignment.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 8 + ] + } + }, + "summary": "Deleted the 'x' operator assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "math-assignment.rb" + ], + "patch": [ + "diff --git a/math-assignment.rb b/math-assignment.rb", + "index fd6ee10..e69de29 100644", + "--- a/math-assignment.rb", + "+++ b/math-assignment.rb", + "@@ -1,5 +0,0 @@", + "-x+= 2", + "-x -= 1", + "-x *= 1", + "-x /= 1", + "-x **= 1" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c0f4dbd0aa0da12c301f0acc3e3a3e7d47bbb3c2..80da23eff17f9285f3cb5f9ceb16f8bf50f4d722" +}] diff --git a/test/corpus/diff-summaries/ruby/method-calls-hash-args.json b/test/corpus/diff-summaries/ruby/method-calls-hash-args.json new file mode 100644 index 000000000..5f9845141 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-calls-hash-args.json @@ -0,0 +1,323 @@ +[{ + "testCaseDescription": "ruby-method-calls-hash-args-insert-test", + "expectedResult": { + "changes": { + "method-calls-hash-args.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'foo(:bar => true)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-hash-args.rb" + ], + "patch": [ + "diff --git a/method-calls-hash-args.rb b/method-calls-hash-args.rb", + "index e69de29..32f81aa 100644", + "--- a/method-calls-hash-args.rb", + "+++ b/method-calls-hash-args.rb", + "@@ -0,0 +1 @@", + "+foo(:bar => true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8f74866f528fd7841bdf10e1e592e94d7b623957..cbc78fa1005061795263227e02aaa9675fc9bafe" +} +,{ + "testCaseDescription": "ruby-method-calls-hash-args-replacement-insert-test", + "expectedResult": { + "changes": { + "method-calls-hash-args.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Added the 'foo(:bar => true, :baz => 1)' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 18 + ] + } + }, + "summary": "Added the 'foo(:bar => true)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-hash-args.rb" + ], + "patch": [ + "diff --git a/method-calls-hash-args.rb b/method-calls-hash-args.rb", + "index 32f81aa..0028a70 100644", + "--- a/method-calls-hash-args.rb", + "+++ b/method-calls-hash-args.rb", + "@@ -1 +1,3 @@", + "+foo(:bar => true, :baz => 1)", + "+foo(:bar => true)", + " foo(:bar => true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cbc78fa1005061795263227e02aaa9675fc9bafe..8a9e62bd027a6d7b722f9618c19333613fe287c8" +} +,{ + "testCaseDescription": "ruby-method-calls-hash-args-delete-insert-test", + "expectedResult": { + "changes": { + "method-calls-hash-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 19 + ], + "end": [ + 1, + 28 + ] + } + }, + "summary": "Deleted the ':baz => 1' pair in the foo(:bar => true) method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-hash-args.rb" + ], + "patch": [ + "diff --git a/method-calls-hash-args.rb b/method-calls-hash-args.rb", + "index 0028a70..67cb62b 100644", + "--- a/method-calls-hash-args.rb", + "+++ b/method-calls-hash-args.rb", + "@@ -1,3 +1,3 @@", + "-foo(:bar => true, :baz => 1)", + "+foo(:bar => true)", + " foo(:bar => true)", + " foo(:bar => true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8a9e62bd027a6d7b722f9618c19333613fe287c8..80826cb6722dc55acb3af86c45e0a68f3dd785a3" +} +,{ + "testCaseDescription": "ruby-method-calls-hash-args-replacement-test", + "expectedResult": { + "changes": { + "method-calls-hash-args.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 19 + ], + "end": [ + 1, + 28 + ] + } + }, + "summary": "Added the ':baz => 1' pair in the foo(:bar => true, :baz => 1) method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-hash-args.rb" + ], + "patch": [ + "diff --git a/method-calls-hash-args.rb b/method-calls-hash-args.rb", + "index 67cb62b..0028a70 100644", + "--- a/method-calls-hash-args.rb", + "+++ b/method-calls-hash-args.rb", + "@@ -1,3 +1,3 @@", + "-foo(:bar => true)", + "+foo(:bar => true, :baz => 1)", + " foo(:bar => true)", + " foo(:bar => true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "80826cb6722dc55acb3af86c45e0a68f3dd785a3..f0856c24f5cf0da371839c4f925db1a4cd09fe2b" +} +,{ + "testCaseDescription": "ruby-method-calls-hash-args-delete-replacement-test", + "expectedResult": { + "changes": { + "method-calls-hash-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Deleted the 'foo(:bar => true, :baz => 1)' method call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 18 + ] + } + }, + "summary": "Deleted the 'foo(:bar => true)' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 29 + ] + } + }, + "summary": "Added the 'foo(:bar => true, :baz => 1)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-hash-args.rb" + ], + "patch": [ + "diff --git a/method-calls-hash-args.rb b/method-calls-hash-args.rb", + "index 0028a70..402c698 100644", + "--- a/method-calls-hash-args.rb", + "+++ b/method-calls-hash-args.rb", + "@@ -1,3 +1,2 @@", + "-foo(:bar => true, :baz => 1)", + "-foo(:bar => true)", + " foo(:bar => true)", + "+foo(:bar => true, :baz => 1)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f0856c24f5cf0da371839c4f925db1a4cd09fe2b..2148372fa7374df37a14e83be5d769686b3b6e87" +} +,{ + "testCaseDescription": "ruby-method-calls-hash-args-delete-test", + "expectedResult": { + "changes": { + "method-calls-hash-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'foo(:bar => true)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-hash-args.rb" + ], + "patch": [ + "diff --git a/method-calls-hash-args.rb b/method-calls-hash-args.rb", + "index 402c698..3a6326e 100644", + "--- a/method-calls-hash-args.rb", + "+++ b/method-calls-hash-args.rb", + "@@ -1,2 +1 @@", + "-foo(:bar => true)", + " foo(:bar => true, :baz => 1)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2148372fa7374df37a14e83be5d769686b3b6e87..caa835d3a2d88c1e8fe1e12ee15891ef6fbdf356" +} +,{ + "testCaseDescription": "ruby-method-calls-hash-args-delete-rest-test", + "expectedResult": { + "changes": { + "method-calls-hash-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 29 + ] + } + }, + "summary": "Deleted the 'foo(:bar => true, :baz => 1)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-hash-args.rb" + ], + "patch": [ + "diff --git a/method-calls-hash-args.rb b/method-calls-hash-args.rb", + "index 3a6326e..e69de29 100644", + "--- a/method-calls-hash-args.rb", + "+++ b/method-calls-hash-args.rb", + "@@ -1 +0,0 @@", + "-foo(:bar => true, :baz => 1)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "caa835d3a2d88c1e8fe1e12ee15891ef6fbdf356..a4bb88876d23a00075e16a8d8ea040a69755a759" +}] diff --git a/test/corpus/diff-summaries/ruby/method-calls-keyword-args.json b/test/corpus/diff-summaries/ruby/method-calls-keyword-args.json new file mode 100644 index 000000000..76df85949 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-calls-keyword-args.json @@ -0,0 +1,323 @@ +[{ + "testCaseDescription": "ruby-method-calls-keyword-args-insert-test", + "expectedResult": { + "changes": { + "method-calls-keyword-args.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the 'foo(bar: true)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-keyword-args.rb" + ], + "patch": [ + "diff --git a/method-calls-keyword-args.rb b/method-calls-keyword-args.rb", + "index e69de29..3f6eb85 100644", + "--- a/method-calls-keyword-args.rb", + "+++ b/method-calls-keyword-args.rb", + "@@ -0,0 +1 @@", + "+foo(bar: true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e777ccc8b43fbcd22c221aed892326e4794e9fd6..e0bd723e464633d4f9e5c31b4311a93636b76e6a" +} +,{ + "testCaseDescription": "ruby-method-calls-keyword-args-replacement-insert-test", + "expectedResult": { + "changes": { + "method-calls-keyword-args.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Added the 'foo(bar: true, baz: 1)' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Added the 'foo(bar: true)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-keyword-args.rb" + ], + "patch": [ + "diff --git a/method-calls-keyword-args.rb b/method-calls-keyword-args.rb", + "index 3f6eb85..2ceed79 100644", + "--- a/method-calls-keyword-args.rb", + "+++ b/method-calls-keyword-args.rb", + "@@ -1 +1,3 @@", + "+foo(bar: true, baz: 1)", + "+foo(bar: true)", + " foo(bar: true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e0bd723e464633d4f9e5c31b4311a93636b76e6a..39c7164697d2c3282c5103e586f0fd124a6527e8" +} +,{ + "testCaseDescription": "ruby-method-calls-keyword-args-delete-insert-test", + "expectedResult": { + "changes": { + "method-calls-keyword-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 16 + ], + "end": [ + 1, + 22 + ] + } + }, + "summary": "Deleted the 'baz: 1' pair in the foo(bar: true) method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-keyword-args.rb" + ], + "patch": [ + "diff --git a/method-calls-keyword-args.rb b/method-calls-keyword-args.rb", + "index 2ceed79..515a317 100644", + "--- a/method-calls-keyword-args.rb", + "+++ b/method-calls-keyword-args.rb", + "@@ -1,3 +1,3 @@", + "-foo(bar: true, baz: 1)", + "+foo(bar: true)", + " foo(bar: true)", + " foo(bar: true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "39c7164697d2c3282c5103e586f0fd124a6527e8..d5126ab784ac1a19cd7c52e4461b2564a9a58635" +} +,{ + "testCaseDescription": "ruby-method-calls-keyword-args-replacement-test", + "expectedResult": { + "changes": { + "method-calls-keyword-args.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 16 + ], + "end": [ + 1, + 22 + ] + } + }, + "summary": "Added the 'baz: 1' pair in the foo(bar: true, baz: 1) method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-keyword-args.rb" + ], + "patch": [ + "diff --git a/method-calls-keyword-args.rb b/method-calls-keyword-args.rb", + "index 515a317..2ceed79 100644", + "--- a/method-calls-keyword-args.rb", + "+++ b/method-calls-keyword-args.rb", + "@@ -1,3 +1,3 @@", + "-foo(bar: true)", + "+foo(bar: true, baz: 1)", + " foo(bar: true)", + " foo(bar: true)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d5126ab784ac1a19cd7c52e4461b2564a9a58635..2592689e2644c550f52917d7a0e1748984a306fa" +} +,{ + "testCaseDescription": "ruby-method-calls-keyword-args-delete-replacement-test", + "expectedResult": { + "changes": { + "method-calls-keyword-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'foo(bar: true, baz: 1)' method call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Deleted the 'foo(bar: true)' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 23 + ] + } + }, + "summary": "Added the 'foo(bar: true, baz: 1)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-keyword-args.rb" + ], + "patch": [ + "diff --git a/method-calls-keyword-args.rb b/method-calls-keyword-args.rb", + "index 2ceed79..47d70d1 100644", + "--- a/method-calls-keyword-args.rb", + "+++ b/method-calls-keyword-args.rb", + "@@ -1,3 +1,2 @@", + "-foo(bar: true, baz: 1)", + "-foo(bar: true)", + " foo(bar: true)", + "+foo(bar: true, baz: 1)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2592689e2644c550f52917d7a0e1748984a306fa..97f76903d79f0b2587418067cdf2b7a51567258c" +} +,{ + "testCaseDescription": "ruby-method-calls-keyword-args-delete-test", + "expectedResult": { + "changes": { + "method-calls-keyword-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'foo(bar: true)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-keyword-args.rb" + ], + "patch": [ + "diff --git a/method-calls-keyword-args.rb b/method-calls-keyword-args.rb", + "index 47d70d1..2977518 100644", + "--- a/method-calls-keyword-args.rb", + "+++ b/method-calls-keyword-args.rb", + "@@ -1,2 +1 @@", + "-foo(bar: true)", + " foo(bar: true, baz: 1)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "97f76903d79f0b2587418067cdf2b7a51567258c..2960a2056e45ab20c86f3f4b734afdf710de96e1" +} +,{ + "testCaseDescription": "ruby-method-calls-keyword-args-delete-rest-test", + "expectedResult": { + "changes": { + "method-calls-keyword-args.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'foo(bar: true, baz: 1)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls-keyword-args.rb" + ], + "patch": [ + "diff --git a/method-calls-keyword-args.rb b/method-calls-keyword-args.rb", + "index 2977518..e69de29 100644", + "--- a/method-calls-keyword-args.rb", + "+++ b/method-calls-keyword-args.rb", + "@@ -1 +0,0 @@", + "-foo(bar: true, baz: 1)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2960a2056e45ab20c86f3f4b734afdf710de96e1..8f74866f528fd7841bdf10e1e592e94d7b623957" +}] diff --git a/test/corpus/diff-summaries/ruby/method-calls.json b/test/corpus/diff-summaries/ruby/method-calls.json new file mode 100644 index 000000000..371e77acd --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-calls.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-method-calls-insert-test", + "expectedResult": { + "changes": { + "method-calls.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'x.foo()' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls.rb" + ], + "patch": [ + "diff --git a/method-calls.rb b/method-calls.rb", + "index e69de29..5831d31 100644", + "--- a/method-calls.rb", + "+++ b/method-calls.rb", + "@@ -0,0 +1 @@", + "+x.foo()" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0480734c620a35b17db09731da0fd90f7e8a8633..0c1a6edbb3eb578ac5753c1ae82c9508ba71c9a3" +} +,{ + "testCaseDescription": "ruby-method-calls-replacement-insert-test", + "expectedResult": { + "changes": { + "method-calls.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'bar()' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'x.foo()' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls.rb" + ], + "patch": [ + "diff --git a/method-calls.rb b/method-calls.rb", + "index 5831d31..ce891a7 100644", + "--- a/method-calls.rb", + "+++ b/method-calls.rb", + "@@ -1 +1,3 @@", + "+bar()", + "+x.foo()", + " x.foo()" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0c1a6edbb3eb578ac5753c1ae82c9508ba71c9a3..540addf07afb612fc3108134fd5eb9cecc5e87dc" +} +,{ + "testCaseDescription": "ruby-method-calls-delete-insert-test", + "expectedResult": { + "changes": { + "method-calls.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced the 'bar()' method call with the 'x.foo()' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls.rb" + ], + "patch": [ + "diff --git a/method-calls.rb b/method-calls.rb", + "index ce891a7..472abf1 100644", + "--- a/method-calls.rb", + "+++ b/method-calls.rb", + "@@ -1,3 +1,3 @@", + "-bar()", + "+x.foo()", + " x.foo()", + " x.foo()" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "540addf07afb612fc3108134fd5eb9cecc5e87dc..e9293a2c8241bc816ccedf08c63decebfae494b2" +} +,{ + "testCaseDescription": "ruby-method-calls-replacement-test", + "expectedResult": { + "changes": { + "method-calls.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'x.foo()' method call with the 'bar()' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls.rb" + ], + "patch": [ + "diff --git a/method-calls.rb b/method-calls.rb", + "index 472abf1..ce891a7 100644", + "--- a/method-calls.rb", + "+++ b/method-calls.rb", + "@@ -1,3 +1,3 @@", + "-x.foo()", + "+bar()", + " x.foo()", + " x.foo()" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e9293a2c8241bc816ccedf08c63decebfae494b2..53d50b0328d4c4ebfc030d81721e9ae751581a23" +} +,{ + "testCaseDescription": "ruby-method-calls-delete-replacement-test", + "expectedResult": { + "changes": { + "method-calls.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'bar()' method call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Deleted the 'x.foo()' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'bar()' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls.rb" + ], + "patch": [ + "diff --git a/method-calls.rb b/method-calls.rb", + "index ce891a7..6c5bbe0 100644", + "--- a/method-calls.rb", + "+++ b/method-calls.rb", + "@@ -1,3 +1,2 @@", + "-bar()", + "-x.foo()", + " x.foo()", + "+bar()" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "53d50b0328d4c4ebfc030d81721e9ae751581a23..a18fc9c470fd7e904525685c480e465b70c0acc7" +} +,{ + "testCaseDescription": "ruby-method-calls-delete-test", + "expectedResult": { + "changes": { + "method-calls.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'x.foo()' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls.rb" + ], + "patch": [ + "diff --git a/method-calls.rb b/method-calls.rb", + "index 6c5bbe0..4be2e26 100644", + "--- a/method-calls.rb", + "+++ b/method-calls.rb", + "@@ -1,2 +1 @@", + "-x.foo()", + " bar()" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a18fc9c470fd7e904525685c480e465b70c0acc7..7cab7ec34bfcc58b315fb5a5f4997e9d06e4c0a9" +} +,{ + "testCaseDescription": "ruby-method-calls-delete-rest-test", + "expectedResult": { + "changes": { + "method-calls.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'bar()' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-calls.rb" + ], + "patch": [ + "diff --git a/method-calls.rb b/method-calls.rb", + "index 4be2e26..e69de29 100644", + "--- a/method-calls.rb", + "+++ b/method-calls.rb", + "@@ -1 +0,0 @@", + "-bar()" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7cab7ec34bfcc58b315fb5a5f4997e9d06e4c0a9..e777ccc8b43fbcd22c221aed892326e4794e9fd6" +}] diff --git a/test/corpus/diff-summaries/ruby/method-declaration-keyword-param.json b/test/corpus/diff-summaries/ruby/method-declaration-keyword-param.json new file mode 100644 index 000000000..715c6a522 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-declaration-keyword-param.json @@ -0,0 +1,335 @@ +[{ + "testCaseDescription": "ruby-method-declaration-keyword-param-insert-test", + "expectedResult": { + "changes": { + "method-declaration-keyword-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-keyword-param.rb b/method-declaration-keyword-param.rb", + "index e69de29..439647e 100644", + "--- a/method-declaration-keyword-param.rb", + "+++ b/method-declaration-keyword-param.rb", + "@@ -0,0 +1,2 @@", + "+def foo()", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f3e88d78204efa57ab931973735fdd5123e7f8bb..e231bdf5449494c34722aa886f0d61e641124c04" +} +,{ + "testCaseDescription": "ruby-method-declaration-keyword-param-replacement-insert-test", + "expectedResult": { + "changes": { + "method-declaration-keyword-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo(name: nil)' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-keyword-param.rb b/method-declaration-keyword-param.rb", + "index 439647e..758e8ad 100644", + "--- a/method-declaration-keyword-param.rb", + "+++ b/method-declaration-keyword-param.rb", + "@@ -1,2 +1,6 @@", + "+def foo(name: nil)", + "+end", + "+def foo()", + "+end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e231bdf5449494c34722aa886f0d61e641124c04..f8f988f7f6bf04ee478b3ce94741cd697cf36cae" +} +,{ + "testCaseDescription": "ruby-method-declaration-keyword-param-delete-insert-test", + "expectedResult": { + "changes": { + "method-declaration-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Deleted the 'name: nil' parameter in the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-keyword-param.rb b/method-declaration-keyword-param.rb", + "index 758e8ad..e856a7a 100644", + "--- a/method-declaration-keyword-param.rb", + "+++ b/method-declaration-keyword-param.rb", + "@@ -1,4 +1,4 @@", + "-def foo(name: nil)", + "+def foo()", + " end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f8f988f7f6bf04ee478b3ce94741cd697cf36cae..a6d8c96342090f041ac4acbc53fffcf79928aa13" +} +,{ + "testCaseDescription": "ruby-method-declaration-keyword-param-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-keyword-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 18 + ] + } + }, + "summary": "Added the 'name: nil' parameter in the 'foo(name: nil)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-keyword-param.rb b/method-declaration-keyword-param.rb", + "index e856a7a..758e8ad 100644", + "--- a/method-declaration-keyword-param.rb", + "+++ b/method-declaration-keyword-param.rb", + "@@ -1,4 +1,4 @@", + "-def foo()", + "+def foo(name: nil)", + " end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a6d8c96342090f041ac4acbc53fffcf79928aa13..3e3afcadec1e295d4ea54f21e81fbb354a747d97" +} +,{ + "testCaseDescription": "ruby-method-declaration-keyword-param-delete-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name: nil)' method" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo(name: nil)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-keyword-param.rb b/method-declaration-keyword-param.rb", + "index 758e8ad..2edfe49 100644", + "--- a/method-declaration-keyword-param.rb", + "+++ b/method-declaration-keyword-param.rb", + "@@ -1,6 +1,4 @@", + "-def foo(name: nil)", + "-end", + " def foo()", + " end", + "-def foo()", + "+def foo(name: nil)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3e3afcadec1e295d4ea54f21e81fbb354a747d97..a9531e67bca8aa6c9a27e03bd0f92b036ce51a5d" +} +,{ + "testCaseDescription": "ruby-method-declaration-keyword-param-delete-test", + "expectedResult": { + "changes": { + "method-declaration-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-keyword-param.rb b/method-declaration-keyword-param.rb", + "index 2edfe49..ba716d6 100644", + "--- a/method-declaration-keyword-param.rb", + "+++ b/method-declaration-keyword-param.rb", + "@@ -1,4 +1,2 @@", + "-def foo()", + "-end", + " def foo(name: nil)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a9531e67bca8aa6c9a27e03bd0f92b036ce51a5d..65f70098f0e1086cb5b46c794695b4be5b760ae2" +} +,{ + "testCaseDescription": "ruby-method-declaration-keyword-param-delete-rest-test", + "expectedResult": { + "changes": { + "method-declaration-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name: nil)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-keyword-param.rb b/method-declaration-keyword-param.rb", + "index ba716d6..e69de29 100644", + "--- a/method-declaration-keyword-param.rb", + "+++ b/method-declaration-keyword-param.rb", + "@@ -1,2 +0,0 @@", + "-def foo(name: nil)", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "65f70098f0e1086cb5b46c794695b4be5b760ae2..8a6e7c324fb948068f1b493bde7223d8bf8b65ca" +}] diff --git a/test/corpus/diff-summaries/ruby/method-declaration-param-default.json b/test/corpus/diff-summaries/ruby/method-declaration-param-default.json new file mode 100644 index 000000000..f429ffcc4 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-declaration-param-default.json @@ -0,0 +1,335 @@ +[{ + "testCaseDescription": "ruby-method-declaration-param-default-insert-test", + "expectedResult": { + "changes": { + "method-declaration-param-default.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-param-default.rb" + ], + "patch": [ + "diff --git a/method-declaration-param-default.rb b/method-declaration-param-default.rb", + "index e69de29..439647e 100644", + "--- a/method-declaration-param-default.rb", + "+++ b/method-declaration-param-default.rb", + "@@ -0,0 +1,2 @@", + "+def foo()", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8a6e7c324fb948068f1b493bde7223d8bf8b65ca..cfd96e5d96ffd822f9e1a57f1f1f2bd3968b5e25" +} +,{ + "testCaseDescription": "ruby-method-declaration-param-default-replacement-insert-test", + "expectedResult": { + "changes": { + "method-declaration-param-default.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo(name: nil)' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-param-default.rb" + ], + "patch": [ + "diff --git a/method-declaration-param-default.rb b/method-declaration-param-default.rb", + "index 439647e..b0c2a93 100644", + "--- a/method-declaration-param-default.rb", + "+++ b/method-declaration-param-default.rb", + "@@ -1,2 +1,6 @@", + "+def foo(name = nil)", + "+end", + "+def foo()", + "+end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cfd96e5d96ffd822f9e1a57f1f1f2bd3968b5e25..7efbb25b3b51667a539b28478b3ff8f1f54a23b1" +} +,{ + "testCaseDescription": "ruby-method-declaration-param-default-delete-insert-test", + "expectedResult": { + "changes": { + "method-declaration-param-default.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the 'name: nil' parameter in the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-param-default.rb" + ], + "patch": [ + "diff --git a/method-declaration-param-default.rb b/method-declaration-param-default.rb", + "index b0c2a93..e856a7a 100644", + "--- a/method-declaration-param-default.rb", + "+++ b/method-declaration-param-default.rb", + "@@ -1,4 +1,4 @@", + "-def foo(name = nil)", + "+def foo()", + " end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7efbb25b3b51667a539b28478b3ff8f1f54a23b1..6bcc4e20023e17ee77d7cf56b65222134c1242cb" +} +,{ + "testCaseDescription": "ruby-method-declaration-param-default-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-param-default.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the 'name: nil' parameter in the 'foo(name: nil)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-param-default.rb" + ], + "patch": [ + "diff --git a/method-declaration-param-default.rb b/method-declaration-param-default.rb", + "index e856a7a..b0c2a93 100644", + "--- a/method-declaration-param-default.rb", + "+++ b/method-declaration-param-default.rb", + "@@ -1,4 +1,4 @@", + "-def foo()", + "+def foo(name = nil)", + " end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6bcc4e20023e17ee77d7cf56b65222134c1242cb..3cccc57179ac3199b47dd726199f9554e864d559" +} +,{ + "testCaseDescription": "ruby-method-declaration-param-default-delete-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-param-default.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name: nil)' method" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo(name: nil)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-param-default.rb" + ], + "patch": [ + "diff --git a/method-declaration-param-default.rb b/method-declaration-param-default.rb", + "index b0c2a93..6f207f9 100644", + "--- a/method-declaration-param-default.rb", + "+++ b/method-declaration-param-default.rb", + "@@ -1,6 +1,4 @@", + "-def foo(name = nil)", + "-end", + " def foo()", + " end", + "-def foo()", + "+def foo(name = nil)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3cccc57179ac3199b47dd726199f9554e864d559..7e9249643203450f84e9da644e6cdf824ed29d05" +} +,{ + "testCaseDescription": "ruby-method-declaration-param-default-delete-test", + "expectedResult": { + "changes": { + "method-declaration-param-default.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-param-default.rb" + ], + "patch": [ + "diff --git a/method-declaration-param-default.rb b/method-declaration-param-default.rb", + "index 6f207f9..ec9b373 100644", + "--- a/method-declaration-param-default.rb", + "+++ b/method-declaration-param-default.rb", + "@@ -1,4 +1,2 @@", + "-def foo()", + "-end", + " def foo(name = nil)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7e9249643203450f84e9da644e6cdf824ed29d05..7ab9fff9193afe31545386ae7b303e16dc3a0fa4" +} +,{ + "testCaseDescription": "ruby-method-declaration-param-default-delete-rest-test", + "expectedResult": { + "changes": { + "method-declaration-param-default.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name: nil)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-param-default.rb" + ], + "patch": [ + "diff --git a/method-declaration-param-default.rb b/method-declaration-param-default.rb", + "index ec9b373..e69de29 100644", + "--- a/method-declaration-param-default.rb", + "+++ b/method-declaration-param-default.rb", + "@@ -1,2 +0,0 @@", + "-def foo(name = nil)", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7ab9fff9193afe31545386ae7b303e16dc3a0fa4..cc1ce974aca21c76aeb99eaf6e834a35453d7d68" +}] diff --git a/test/corpus/diff-summaries/ruby/method-declaration-params.json b/test/corpus/diff-summaries/ruby/method-declaration-params.json new file mode 100644 index 000000000..f27bbee2e --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-declaration-params.json @@ -0,0 +1,268 @@ +[{ + "testCaseDescription": "ruby-method-declaration-params-setup-test", + "expectedResult": { + "changes": { + "method-declaration-params.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-params.rb" + ], + "patch": [ + "diff --git a/method-declaration-params.rb b/method-declaration-params.rb", + "index e69de29..ff7bbbe 100644", + "--- a/method-declaration-params.rb", + "+++ b/method-declaration-params.rb", + "@@ -0,0 +1,2 @@", + "+def foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4c7e74e0e3b6057ae87e1d79fbe2a42782e1fac5..cd93653bcdce3f9cbd94dbfc97274325eb986496" +} +,{ + "testCaseDescription": "ruby-method-declaration-params-insert-test", + "expectedResult": { + "changes": { + "method-declaration-params.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'a' identifier in the 'foo(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-params.rb" + ], + "patch": [ + "diff --git a/method-declaration-params.rb b/method-declaration-params.rb", + "index ff7bbbe..47fdd58 100644", + "--- a/method-declaration-params.rb", + "+++ b/method-declaration-params.rb", + "@@ -1,2 +1,2 @@", + "-def foo", + "+def foo(a)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cd93653bcdce3f9cbd94dbfc97274325eb986496..5340b8aab442949dd69d9b2f46a212ef2b3a4990" +} +,{ + "testCaseDescription": "ruby-method-declaration-params-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-params.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'b' identifier in the 'foo(a, b, c)' method" + }, + { + "span": { + "insert": { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 16 + ] + } + }, + "summary": "Added the 'c' identifier in the 'foo(a, b, c)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-params.rb" + ], + "patch": [ + "diff --git a/method-declaration-params.rb b/method-declaration-params.rb", + "index 47fdd58..b9f1ab5 100644", + "--- a/method-declaration-params.rb", + "+++ b/method-declaration-params.rb", + "@@ -1,2 +1,2 @@", + "-def foo(a)", + "+def foo(a, b, c)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5340b8aab442949dd69d9b2f46a212ef2b3a4990..dd8490463ad615c53ebe1c9890d03e570bbc84d0" +} +,{ + "testCaseDescription": "ruby-method-declaration-params-delete-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-params.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 12 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'b' identifier in the 'foo(a)' method" + }, + { + "span": { + "delete": { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 16 + ] + } + }, + "summary": "Deleted the 'c' identifier in the 'foo(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-params.rb" + ], + "patch": [ + "diff --git a/method-declaration-params.rb b/method-declaration-params.rb", + "index b9f1ab5..47fdd58 100644", + "--- a/method-declaration-params.rb", + "+++ b/method-declaration-params.rb", + "@@ -1,2 +1,2 @@", + "-def foo(a, b, c)", + "+def foo(a)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "dd8490463ad615c53ebe1c9890d03e570bbc84d0..5828f299d5da302e1c47919559e2acc1f4cfb63e" +} +,{ + "testCaseDescription": "ruby-method-declaration-params-delete-insert-test", + "expectedResult": { + "changes": { + "method-declaration-params.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'a' identifier in the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-params.rb" + ], + "patch": [ + "diff --git a/method-declaration-params.rb b/method-declaration-params.rb", + "index 47fdd58..ff7bbbe 100644", + "--- a/method-declaration-params.rb", + "+++ b/method-declaration-params.rb", + "@@ -1,2 +1,2 @@", + "-def foo(a)", + "+def foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5828f299d5da302e1c47919559e2acc1f4cfb63e..e4b60e166759fa958acd2e1028643a207da24231" +} +,{ + "testCaseDescription": "ruby-method-declaration-params-teardown-test", + "expectedResult": { + "changes": { + "method-declaration-params.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-params.rb" + ], + "patch": [ + "diff --git a/method-declaration-params.rb b/method-declaration-params.rb", + "index ff7bbbe..e69de29 100644", + "--- a/method-declaration-params.rb", + "+++ b/method-declaration-params.rb", + "@@ -1,2 +0,0 @@", + "-def foo", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e4b60e166759fa958acd2e1028643a207da24231..980ea856c1bac9ba15ee84733b51821229105ba7" +}] diff --git a/test/corpus/diff-summaries/ruby/method-declaration-required-keyword-param.json b/test/corpus/diff-summaries/ruby/method-declaration-required-keyword-param.json new file mode 100644 index 000000000..643841cba --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-declaration-required-keyword-param.json @@ -0,0 +1,335 @@ +[{ + "testCaseDescription": "ruby-method-declaration-required-keyword-param-insert-test", + "expectedResult": { + "changes": { + "method-declaration-required-keyword-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-required-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-required-keyword-param.rb b/method-declaration-required-keyword-param.rb", + "index e69de29..439647e 100644", + "--- a/method-declaration-required-keyword-param.rb", + "+++ b/method-declaration-required-keyword-param.rb", + "@@ -0,0 +1,2 @@", + "+def foo()", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "980ea856c1bac9ba15ee84733b51821229105ba7..d0fb53dc518d253bcce258b72c666330c8c8ea2f" +} +,{ + "testCaseDescription": "ruby-method-declaration-required-keyword-param-replacement-insert-test", + "expectedResult": { + "changes": { + "method-declaration-required-keyword-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo(…)' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-required-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-required-keyword-param.rb b/method-declaration-required-keyword-param.rb", + "index 439647e..27f533a 100644", + "--- a/method-declaration-required-keyword-param.rb", + "+++ b/method-declaration-required-keyword-param.rb", + "@@ -1,2 +1,6 @@", + "+def foo(name:)", + "+end", + "+def foo()", + "+end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d0fb53dc518d253bcce258b72c666330c8c8ea2f..aa7247746e9f0a58d87acb00f87305ed3379c0c2" +} +,{ + "testCaseDescription": "ruby-method-declaration-required-keyword-param-delete-insert-test", + "expectedResult": { + "changes": { + "method-declaration-required-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the 'name' identifier in the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-required-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-required-keyword-param.rb b/method-declaration-required-keyword-param.rb", + "index 27f533a..e856a7a 100644", + "--- a/method-declaration-required-keyword-param.rb", + "+++ b/method-declaration-required-keyword-param.rb", + "@@ -1,4 +1,4 @@", + "-def foo(name:)", + "+def foo()", + " end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "aa7247746e9f0a58d87acb00f87305ed3379c0c2..6e3ca4b1f7254a9ca3117378ba687e97d3995c4c" +} +,{ + "testCaseDescription": "ruby-method-declaration-required-keyword-param-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-required-keyword-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the 'name' identifier in the 'foo(…)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-required-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-required-keyword-param.rb b/method-declaration-required-keyword-param.rb", + "index e856a7a..27f533a 100644", + "--- a/method-declaration-required-keyword-param.rb", + "+++ b/method-declaration-required-keyword-param.rb", + "@@ -1,4 +1,4 @@", + "-def foo()", + "+def foo(name:)", + " end", + " def foo()", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6e3ca4b1f7254a9ca3117378ba687e97d3995c4c..e27d1caf1aa51551a8a957cf1dc497ac9234adc7" +} +,{ + "testCaseDescription": "ruby-method-declaration-required-keyword-param-delete-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-required-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(…)' method" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo(…)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-required-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-required-keyword-param.rb b/method-declaration-required-keyword-param.rb", + "index 27f533a..1cbc12f 100644", + "--- a/method-declaration-required-keyword-param.rb", + "+++ b/method-declaration-required-keyword-param.rb", + "@@ -1,6 +1,4 @@", + "-def foo(name:)", + "-end", + " def foo()", + " end", + "-def foo()", + "+def foo(name:)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e27d1caf1aa51551a8a957cf1dc497ac9234adc7..8704c73aaa72d1a49af29ec021d9877cf70c0dcb" +} +,{ + "testCaseDescription": "ruby-method-declaration-required-keyword-param-delete-test", + "expectedResult": { + "changes": { + "method-declaration-required-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-required-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-required-keyword-param.rb b/method-declaration-required-keyword-param.rb", + "index 1cbc12f..1cbe40e 100644", + "--- a/method-declaration-required-keyword-param.rb", + "+++ b/method-declaration-required-keyword-param.rb", + "@@ -1,4 +1,2 @@", + "-def foo()", + "-end", + " def foo(name:)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8704c73aaa72d1a49af29ec021d9877cf70c0dcb..f0ede17f71781672e1aaa9a486d5682e175f461e" +} +,{ + "testCaseDescription": "ruby-method-declaration-required-keyword-param-delete-rest-test", + "expectedResult": { + "changes": { + "method-declaration-required-keyword-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(…)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-required-keyword-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-required-keyword-param.rb b/method-declaration-required-keyword-param.rb", + "index 1cbe40e..e69de29 100644", + "--- a/method-declaration-required-keyword-param.rb", + "+++ b/method-declaration-required-keyword-param.rb", + "@@ -1,2 +0,0 @@", + "-def foo(name:)", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f0ede17f71781672e1aaa9a486d5682e175f461e..f3e88d78204efa57ab931973735fdd5123e7f8bb" +}] diff --git a/test/corpus/diff-summaries/ruby/method-declaration-unnamed-param.json b/test/corpus/diff-summaries/ruby/method-declaration-unnamed-param.json new file mode 100644 index 000000000..c4a179797 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-declaration-unnamed-param.json @@ -0,0 +1,335 @@ +[{ + "testCaseDescription": "ruby-method-declaration-unnamed-param-insert-test", + "expectedResult": { + "changes": { + "method-declaration-unnamed-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo(name)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-unnamed-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-unnamed-param.rb b/method-declaration-unnamed-param.rb", + "index e69de29..57ad017 100644", + "--- a/method-declaration-unnamed-param.rb", + "+++ b/method-declaration-unnamed-param.rb", + "@@ -0,0 +1,2 @@", + "+def foo(name)", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cc1ce974aca21c76aeb99eaf6e834a35453d7d68..2711ed7ca34262066e80b7cd4ebcbbf3509a227a" +} +,{ + "testCaseDescription": "ruby-method-declaration-unnamed-param-replacement-insert-test", + "expectedResult": { + "changes": { + "method-declaration-unnamed-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo(name, **)' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo(name)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-unnamed-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-unnamed-param.rb b/method-declaration-unnamed-param.rb", + "index 57ad017..72a69f5 100644", + "--- a/method-declaration-unnamed-param.rb", + "+++ b/method-declaration-unnamed-param.rb", + "@@ -1,2 +1,6 @@", + "+def foo(name, **)", + "+end", + "+def foo(name)", + "+end", + " def foo(name)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2711ed7ca34262066e80b7cd4ebcbbf3509a227a..180f8f6834dcc0d0241a539df8c3d94625f64b2c" +} +,{ + "testCaseDescription": "ruby-method-declaration-unnamed-param-delete-insert-test", + "expectedResult": { + "changes": { + "method-declaration-unnamed-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the '**' parameter in the 'foo(name)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-unnamed-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-unnamed-param.rb b/method-declaration-unnamed-param.rb", + "index 72a69f5..e797dda 100644", + "--- a/method-declaration-unnamed-param.rb", + "+++ b/method-declaration-unnamed-param.rb", + "@@ -1,4 +1,4 @@", + "-def foo(name, **)", + "+def foo(name)", + " end", + " def foo(name)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "180f8f6834dcc0d0241a539df8c3d94625f64b2c..792a8e6a0b28f4dcf01e04bf7c215f4f993bb893" +} +,{ + "testCaseDescription": "ruby-method-declaration-unnamed-param-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-unnamed-param.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Added the '**' parameter in the 'foo(name, **)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-unnamed-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-unnamed-param.rb b/method-declaration-unnamed-param.rb", + "index e797dda..72a69f5 100644", + "--- a/method-declaration-unnamed-param.rb", + "+++ b/method-declaration-unnamed-param.rb", + "@@ -1,4 +1,4 @@", + "-def foo(name)", + "+def foo(name, **)", + " end", + " def foo(name)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "792a8e6a0b28f4dcf01e04bf7c215f4f993bb893..e42095e2c908542085f2175fced0691c3903b5ec" +} +,{ + "testCaseDescription": "ruby-method-declaration-unnamed-param-delete-replacement-test", + "expectedResult": { + "changes": { + "method-declaration-unnamed-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name, **)' method" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name)' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo(name, **)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-unnamed-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-unnamed-param.rb b/method-declaration-unnamed-param.rb", + "index 72a69f5..4bd7804 100644", + "--- a/method-declaration-unnamed-param.rb", + "+++ b/method-declaration-unnamed-param.rb", + "@@ -1,6 +1,4 @@", + "-def foo(name, **)", + "-end", + " def foo(name)", + " end", + "-def foo(name)", + "+def foo(name, **)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e42095e2c908542085f2175fced0691c3903b5ec..573ee504e3c4b6d54380fc96939784acf92de706" +} +,{ + "testCaseDescription": "ruby-method-declaration-unnamed-param-delete-test", + "expectedResult": { + "changes": { + "method-declaration-unnamed-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-unnamed-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-unnamed-param.rb b/method-declaration-unnamed-param.rb", + "index 4bd7804..b790bfb 100644", + "--- a/method-declaration-unnamed-param.rb", + "+++ b/method-declaration-unnamed-param.rb", + "@@ -1,4 +1,2 @@", + "-def foo(name)", + "-end", + " def foo(name, **)", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "573ee504e3c4b6d54380fc96939784acf92de706..f515972982d4bf3441c214444a7a5dbec3101e85" +} +,{ + "testCaseDescription": "ruby-method-declaration-unnamed-param-delete-rest-test", + "expectedResult": { + "changes": { + "method-declaration-unnamed-param.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo(name, **)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration-unnamed-param.rb" + ], + "patch": [ + "diff --git a/method-declaration-unnamed-param.rb b/method-declaration-unnamed-param.rb", + "index b790bfb..e69de29 100644", + "--- a/method-declaration-unnamed-param.rb", + "+++ b/method-declaration-unnamed-param.rb", + "@@ -1,2 +0,0 @@", + "-def foo(name, **)", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f515972982d4bf3441c214444a7a5dbec3101e85..fdb8b87a7e43058c4b8d5a6d7d5bc4d9444be629" +}] diff --git a/test/corpus/diff-summaries/ruby/method-declaration.json b/test/corpus/diff-summaries/ruby/method-declaration.json new file mode 100644 index 000000000..11b19fdbe --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-declaration.json @@ -0,0 +1,426 @@ +[{ + "testCaseDescription": "ruby-method-declaration-insert-test", + "expectedResult": { + "changes": { + "method-declaration.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration.rb" + ], + "patch": [ + "diff --git a/method-declaration.rb b/method-declaration.rb", + "index e69de29..ff7bbbe 100644", + "--- a/method-declaration.rb", + "+++ b/method-declaration.rb", + "@@ -0,0 +1,2 @@", + "+def foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c77901de054ed5c45b40b241fc96524cc738a471..c686750aa55fc5dee3912ee854adf3a7ab381b51" +} +,{ + "testCaseDescription": "ruby-method-declaration-replacement-insert-test", + "expectedResult": { + "changes": { + "method-declaration.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'bar(a)' method" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration.rb" + ], + "patch": [ + "diff --git a/method-declaration.rb b/method-declaration.rb", + "index ff7bbbe..fcc5a9b 100644", + "--- a/method-declaration.rb", + "+++ b/method-declaration.rb", + "@@ -1,2 +1,7 @@", + "+def bar(a)", + "+ baz", + "+end", + "+def foo", + "+end", + " def foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c686750aa55fc5dee3912ee854adf3a7ab381b51..d35e46ed430e79f1e5e1365f1eb1f19bdaa0cdeb" +} +,{ + "testCaseDescription": "ruby-method-declaration-delete-insert-test", + "expectedResult": { + "changes": { + "method-declaration.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier in the 'foo()' method" + }, + { + "span": { + "delete": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'a' identifier in the 'foo()' method" + }, + { + "span": { + "delete": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'baz' identifier in the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration.rb" + ], + "patch": [ + "diff --git a/method-declaration.rb b/method-declaration.rb", + "index fcc5a9b..a09a49a 100644", + "--- a/method-declaration.rb", + "+++ b/method-declaration.rb", + "@@ -1,5 +1,4 @@", + "-def bar(a)", + "- baz", + "+def foo", + " end", + " def foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d35e46ed430e79f1e5e1365f1eb1f19bdaa0cdeb..19fca25ffca22fdcac7d219a8d1308b7d72d9dd8" +} +,{ + "testCaseDescription": "ruby-method-declaration-replacement-test", + "expectedResult": { + "changes": { + "method-declaration.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in the 'bar(a)' method" + }, + { + "span": { + "insert": { + "start": [ + 1, + 9 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'a' identifier in the 'bar(a)' method" + }, + { + "span": { + "insert": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'baz' identifier in the 'bar(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration.rb" + ], + "patch": [ + "diff --git a/method-declaration.rb b/method-declaration.rb", + "index a09a49a..fcc5a9b 100644", + "--- a/method-declaration.rb", + "+++ b/method-declaration.rb", + "@@ -1,4 +1,5 @@", + "-def foo", + "+def bar(a)", + "+ baz", + " end", + " def foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "19fca25ffca22fdcac7d219a8d1308b7d72d9dd8..05e77829953ad2c70f65359c88b4054fee3f2d62" +} +,{ + "testCaseDescription": "ruby-method-declaration-delete-replacement-test", + "expectedResult": { + "changes": { + "method-declaration.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'bar(a)' method" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'bar(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration.rb" + ], + "patch": [ + "diff --git a/method-declaration.rb b/method-declaration.rb", + "index fcc5a9b..14b3fc2 100644", + "--- a/method-declaration.rb", + "+++ b/method-declaration.rb", + "@@ -1,7 +1,5 @@", + "-def bar(a)", + "- baz", + "-end", + " def foo", + " end", + "-def foo", + "+def bar(a)", + "+ baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "05e77829953ad2c70f65359c88b4054fee3f2d62..c5859f51292c90a9d03b3de89babbd4e2572566a" +} +,{ + "testCaseDescription": "ruby-method-declaration-delete-test", + "expectedResult": { + "changes": { + "method-declaration.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration.rb" + ], + "patch": [ + "diff --git a/method-declaration.rb b/method-declaration.rb", + "index 14b3fc2..d90f5cf 100644", + "--- a/method-declaration.rb", + "+++ b/method-declaration.rb", + "@@ -1,5 +1,3 @@", + "-def foo", + "-end", + " def bar(a)", + " baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c5859f51292c90a9d03b3de89babbd4e2572566a..675b9f655202f3d2aa6d06e868c7f0e321e32767" +} +,{ + "testCaseDescription": "ruby-method-declaration-delete-rest-test", + "expectedResult": { + "changes": { + "method-declaration.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'bar(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-declaration.rb" + ], + "patch": [ + "diff --git a/method-declaration.rb b/method-declaration.rb", + "index d90f5cf..e69de29 100644", + "--- a/method-declaration.rb", + "+++ b/method-declaration.rb", + "@@ -1,3 +0,0 @@", + "-def bar(a)", + "- baz", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "675b9f655202f3d2aa6d06e868c7f0e321e32767..4c7e74e0e3b6057ae87e1d79fbe2a42782e1fac5" +}] diff --git a/test/corpus/diff-summaries/ruby/method-invocation.json b/test/corpus/diff-summaries/ruby/method-invocation.json new file mode 100644 index 000000000..7e3bc813e --- /dev/null +++ b/test/corpus/diff-summaries/ruby/method-invocation.json @@ -0,0 +1,807 @@ +[{ + "testCaseDescription": "ruby-method-invocation-insert-test", + "expectedResult": { + "changes": { + "method-invocation.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'print' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'foo.bar' member access" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-invocation.rb" + ], + "patch": [ + "diff --git a/method-invocation.rb b/method-invocation.rb", + "index e69de29..fbe3bdc 100644", + "--- a/method-invocation.rb", + "+++ b/method-invocation.rb", + "@@ -0,0 +1,3 @@", + "+print", + "+foo.bar", + "+bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fdb8b87a7e43058c4b8d5a6d7d5bc4d9444be629..61dcd36b60ec91cef146dd631a04732de5be2f28" +} +,{ + "testCaseDescription": "ruby-method-invocation-replacement-insert-test", + "expectedResult": { + "changes": { + "method-invocation.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the 'print(\"hello world\")' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the 'foo.bar()' method call" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 9 + ] + } + }, + "summary": "Added the 'bar(2, 3)' method call" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Added the 'bar(2, 3)' method call" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 6 + ] + } + }, + "summary": "Added the 'print' identifier" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Added the 'foo.bar' member access" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 4 + ] + } + }, + "summary": "Added the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-invocation.rb" + ], + "patch": [ + "diff --git a/method-invocation.rb b/method-invocation.rb", + "index fbe3bdc..c34b65a 100644", + "--- a/method-invocation.rb", + "+++ b/method-invocation.rb", + "@@ -1,3 +1,10 @@", + "+print(\"hello world\")", + "+foo.bar()", + "+bar 2, 3", + "+bar(2, 3)", + "+print", + "+foo.bar", + "+bar", + " print", + " foo.bar", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "61dcd36b60ec91cef146dd631a04732de5be2f28..94f8da8db336220ed877a4024476b5bcc6b81e02" +} +,{ + "testCaseDescription": "ruby-method-invocation-delete-insert-test", + "expectedResult": { + "changes": { + "method-invocation.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'print' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'foo.bar' member access" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'bar' identifier" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'print(\"hello world\")' method call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the 'foo.bar()' method call" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 9 + ] + } + }, + "summary": "Deleted the 'bar(2, 3)' method call" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Deleted the 'bar(2, 3)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-invocation.rb" + ], + "patch": [ + "diff --git a/method-invocation.rb b/method-invocation.rb", + "index c34b65a..02ba81a 100644", + "--- a/method-invocation.rb", + "+++ b/method-invocation.rb", + "@@ -1,7 +1,6 @@", + "-print(\"hello world\")", + "-foo.bar()", + "-bar 2, 3", + "-bar(2, 3)", + "+print", + "+foo.bar", + "+bar", + " print", + " foo.bar", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "94f8da8db336220ed877a4024476b5bcc6b81e02..c56b2e714fe9ace31677ef910bf5c38b31af67a2" +} +,{ + "testCaseDescription": "ruby-method-invocation-replacement-test", + "expectedResult": { + "changes": { + "method-invocation.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the 'print(\"hello world\")' method call" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the 'foo.bar()' method call" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 9 + ] + } + }, + "summary": "Added the 'bar(2, 3)' method call" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Added the 'bar(2, 3)' method call" + }, + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'print' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Deleted the 'foo.bar' member access" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-invocation.rb" + ], + "patch": [ + "diff --git a/method-invocation.rb b/method-invocation.rb", + "index 02ba81a..c34b65a 100644", + "--- a/method-invocation.rb", + "+++ b/method-invocation.rb", + "@@ -1,6 +1,7 @@", + "-print", + "-foo.bar", + "-bar", + "+print(\"hello world\")", + "+foo.bar()", + "+bar 2, 3", + "+bar(2, 3)", + " print", + " foo.bar", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c56b2e714fe9ace31677ef910bf5c38b31af67a2..cb7900c613f85909900da39d5142e9df45775191" +} +,{ + "testCaseDescription": "ruby-method-invocation-delete-replacement-test", + "expectedResult": { + "changes": { + "method-invocation.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'print' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Added the 'foo.bar' member access" + }, + { + "span": { + "replace": [ + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 6 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 4 + ] + } + ] + }, + "summary": "Replaced the 'print' identifier with the 'bar' identifier" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Deleted the 'foo.bar' member access" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 4 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + }, + { + "span": { + "delete": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 6 + ] + } + }, + "summary": "Deleted the 'print' identifier" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 8 + ] + } + }, + "summary": "Deleted the 'foo.bar' member access" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 4 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-invocation.rb" + ], + "patch": [ + "diff --git a/method-invocation.rb b/method-invocation.rb", + "index c34b65a..4e17a42 100644", + "--- a/method-invocation.rb", + "+++ b/method-invocation.rb", + "@@ -1,10 +1,7 @@", + "+print", + "+foo.bar", + "+bar", + " print(\"hello world\")", + " foo.bar()", + " bar 2, 3", + " bar(2, 3)", + "-print", + "-foo.bar", + "-bar", + "-print", + "-foo.bar", + "-bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cb7900c613f85909900da39d5142e9df45775191..3b9faa2205cef451a88c2537728c206f6f361393" +} +,{ + "testCaseDescription": "ruby-method-invocation-delete-test", + "expectedResult": { + "changes": { + "method-invocation.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'print' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 8 + ] + } + }, + "summary": "Deleted the 'foo.bar' member access" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-invocation.rb" + ], + "patch": [ + "diff --git a/method-invocation.rb b/method-invocation.rb", + "index 4e17a42..2db15c7 100644", + "--- a/method-invocation.rb", + "+++ b/method-invocation.rb", + "@@ -1,6 +1,3 @@", + "-print", + "-foo.bar", + "-bar", + " print(\"hello world\")", + " foo.bar()", + " bar 2, 3" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3b9faa2205cef451a88c2537728c206f6f361393..7498f136e368ad492ef82f5017fbfc598701cfee" +} +,{ + "testCaseDescription": "ruby-method-invocation-delete-rest-test", + "expectedResult": { + "changes": { + "method-invocation.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'print(\"hello world\")' method call" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the 'foo.bar()' method call" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 9 + ] + } + }, + "summary": "Deleted the 'bar(2, 3)' method call" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 10 + ] + } + }, + "summary": "Deleted the 'bar(2, 3)' method call" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "method-invocation.rb" + ], + "patch": [ + "diff --git a/method-invocation.rb b/method-invocation.rb", + "index 2db15c7..e69de29 100644", + "--- a/method-invocation.rb", + "+++ b/method-invocation.rb", + "@@ -1,4 +0,0 @@", + "-print(\"hello world\")", + "-foo.bar()", + "-bar 2, 3", + "-bar(2, 3)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7498f136e368ad492ef82f5017fbfc598701cfee..0480734c620a35b17db09731da0fd90f7e8a8633" +}] diff --git a/test/corpus/diff-summaries/ruby/module.json b/test/corpus/diff-summaries/ruby/module.json new file mode 100644 index 000000000..87ed48035 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/module.json @@ -0,0 +1,346 @@ +[{ + "testCaseDescription": "ruby-module-insert-test", + "expectedResult": { + "changes": { + "module.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'Foo' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "module.rb" + ], + "patch": [ + "diff --git a/module.rb b/module.rb", + "index e69de29..85026ed 100644", + "--- a/module.rb", + "+++ b/module.rb", + "@@ -0,0 +1,2 @@", + "+module Foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "df1a78de0a4748fd622579937f1b94b6af7a7a22..ec5481357ecc29b12d456ba8892d9b39e0fce1fa" +} +,{ + "testCaseDescription": "ruby-module-replacement-insert-test", + "expectedResult": { + "changes": { + "module.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'Foo' module" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'Foo' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "module.rb" + ], + "patch": [ + "diff --git a/module.rb b/module.rb", + "index 85026ed..351dcd2 100644", + "--- a/module.rb", + "+++ b/module.rb", + "@@ -1,2 +1,8 @@", + " module Foo", + "+ def bar", + "+ end", + "+end", + "+module Foo", + "+end", + "+module Foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ec5481357ecc29b12d456ba8892d9b39e0fce1fa..354390805ccb1c89a8213a05ebe399f2dddd6879" +} +,{ + "testCaseDescription": "ruby-module-delete-insert-test", + "expectedResult": { + "changes": { + "module.rb": [ + { + "span": { + "delete": { + "start": [ + 2, + 3 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Deleted the 'bar()' method in the Foo module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "module.rb" + ], + "patch": [ + "diff --git a/module.rb b/module.rb", + "index 351dcd2..5900129 100644", + "--- a/module.rb", + "+++ b/module.rb", + "@@ -1,6 +1,4 @@", + " module Foo", + "- def bar", + "- end", + " end", + " module Foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "354390805ccb1c89a8213a05ebe399f2dddd6879..229c6b75a24a81bdc4b3450f1afeaa0fc28e7c0f" +} +,{ + "testCaseDescription": "ruby-module-replacement-test", + "expectedResult": { + "changes": { + "module.rb": [ + { + "span": { + "insert": { + "start": [ + 2, + 3 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added the 'bar()' method in the Foo module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "module.rb" + ], + "patch": [ + "diff --git a/module.rb b/module.rb", + "index 5900129..351dcd2 100644", + "--- a/module.rb", + "+++ b/module.rb", + "@@ -1,4 +1,6 @@", + " module Foo", + "+ def bar", + "+ end", + " end", + " module Foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "229c6b75a24a81bdc4b3450f1afeaa0fc28e7c0f..9e42c9f69147f3433a9e21da018b55360ca962c4" +} +,{ + "testCaseDescription": "ruby-module-delete-replacement-test", + "expectedResult": { + "changes": { + "module.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' module" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' module" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'Foo' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "module.rb" + ], + "patch": [ + "diff --git a/module.rb b/module.rb", + "index 351dcd2..66871d0 100644", + "--- a/module.rb", + "+++ b/module.rb", + "@@ -1,8 +1,6 @@", + " module Foo", + "- def bar", + "- end", + "-end", + "-module Foo", + " end", + " module Foo", + "+ def bar", + "+ end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9e42c9f69147f3433a9e21da018b55360ca962c4..2e010b8298517ef7b74cfda78566e10a89fca5be" +} +,{ + "testCaseDescription": "ruby-module-delete-test", + "expectedResult": { + "changes": { + "module.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "module.rb" + ], + "patch": [ + "diff --git a/module.rb b/module.rb", + "index 66871d0..56f77bb 100644", + "--- a/module.rb", + "+++ b/module.rb", + "@@ -1,6 +1,4 @@", + " module Foo", + "-end", + "-module Foo", + " def bar", + " end", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2e010b8298517ef7b74cfda78566e10a89fca5be..9d65a1206954104bc1dec550589864e6c9106eda" +} +,{ + "testCaseDescription": "ruby-module-delete-rest-test", + "expectedResult": { + "changes": { + "module.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' module" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "module.rb" + ], + "patch": [ + "diff --git a/module.rb b/module.rb", + "index 56f77bb..e69de29 100644", + "--- a/module.rb", + "+++ b/module.rb", + "@@ -1,4 +0,0 @@", + "-module Foo", + "- def bar", + "- end", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9d65a1206954104bc1dec550589864e6c9106eda..8eea35a3e05ea4b7a30d4998298c7b1a6b87698c" +}] diff --git a/test/corpus/diff-summaries/ruby/multiple-assignments.json b/test/corpus/diff-summaries/ruby/multiple-assignments.json new file mode 100644 index 000000000..0b059f426 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/multiple-assignments.json @@ -0,0 +1,383 @@ +[{ + "testCaseDescription": "ruby-multiple-assignments-insert-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Added the 'x, y, z' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index e69de29..348cf74 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -0,0 +1 @@", + "+x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9ee3b98240d86d88fb36b4434854030701b21d2d..a4994a2af5f07a90b873e0307a1f03b7b9025e31" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-replacement-insert-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Added the 'x, y' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 23 + ] + } + }, + "summary": "Added the 'x, y, z' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 348cf74..242315a 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1 +1,3 @@", + "+x, *y = [10, 20, 30]", + "+x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a4994a2af5f07a90b873e0307a1f03b7b9025e31..98cf6818b6e7288b049c92f2b53c35a05984dc49" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-insert-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'y' identifier in an assignment to x, y, z" + }, + { + "span": { + "insert": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'z' identifier in an assignment to x, y, z" + }, + { + "span": { + "delete": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'y' identifier in an assignment to x, y, z" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 242315a..274faf2 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,3 +1,3 @@", + "-x, *y = [10, 20, 30]", + "+x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "98cf6818b6e7288b049c92f2b53c35a05984dc49..738b58bf9eec99486a03ba977091b9a6079a14d3" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-replacement-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 5 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'y' identifier in an assignment to x, y" + }, + { + "span": { + "delete": { + "start": [ + 1, + 4 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'y' identifier in an assignment to x, y" + }, + { + "span": { + "delete": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'z' identifier in an assignment to x, y" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 274faf2..242315a 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,3 +1,3 @@", + "-x, y, z = [10, 20, 30]", + "+x, *y = [10, 20, 30]", + " x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "738b58bf9eec99486a03ba977091b9a6079a14d3..c7221ce35db39d3ee0b2de84877ff20b9a5babc6" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-replacement-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'x, y' assignment" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 23 + ] + } + }, + "summary": "Deleted the 'x, y, z' assignment" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 21 + ] + } + }, + "summary": "Added the 'x, y' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 242315a..7ba9487 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,3 +1,2 @@", + "-x, *y = [10, 20, 30]", + "-x, y, z = [10, 20, 30]", + " x, y, z = [10, 20, 30]", + "+x, *y = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c7221ce35db39d3ee0b2de84877ff20b9a5babc6..846ef6ffb5861a8c10f295d878b91bd404a521e5" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 23 + ] + } + }, + "summary": "Deleted the 'x, y, z' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 7ba9487..32cf6a2 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1,2 +1 @@", + "-x, y, z = [10, 20, 30]", + " x, *y = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "846ef6ffb5861a8c10f295d878b91bd404a521e5..2f0f6bc2cb2a147a70111e3f9c13c6ff3c59cf8a" +} +,{ + "testCaseDescription": "ruby-multiple-assignments-delete-rest-test", + "expectedResult": { + "changes": { + "multiple-assignments.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 21 + ] + } + }, + "summary": "Deleted the 'x, y' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "multiple-assignments.rb" + ], + "patch": [ + "diff --git a/multiple-assignments.rb b/multiple-assignments.rb", + "index 32cf6a2..e69de29 100644", + "--- a/multiple-assignments.rb", + "+++ b/multiple-assignments.rb", + "@@ -1 +0,0 @@", + "-x, *y = [10, 20, 30]" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2f0f6bc2cb2a147a70111e3f9c13c6ff3c59cf8a..68f54d0bb0adf1b15930162ebbc91f3145873b48" +}] diff --git a/test/corpus/diff-summaries/ruby/number.json b/test/corpus/diff-summaries/ruby/number.json new file mode 100644 index 000000000..614d2f1e7 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/number.json @@ -0,0 +1,1515 @@ +[{ + "testCaseDescription": "ruby-number-insert-test", + "expectedResult": { + "changes": { + "number.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added '1234'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added '1_234'" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Added '0d1_234'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Added '0xa_bcd_ef0_123_456_789'" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Added '0o1234567'" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Added '0b1_0'" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Added '1.234_5e678_90'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.rb" + ], + "patch": [ + "diff --git a/number.rb b/number.rb", + "index e69de29..1a73a0e 100644", + "--- a/number.rb", + "+++ b/number.rb", + "@@ -0,0 +1,8 @@", + "+1234", + "+1_234", + "+0d1_234", + "+0xa_bcd_ef0_123_456_789", + "+0o1234567", + "+0b1_0", + "+1.234_5e678_90", + "+" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0a572cb338bc566ebf42126063cd97d903560bec..16007467a399e377bac5bb6b6a3608406ea8aae5" +} +,{ + "testCaseDescription": "ruby-number-replacement-insert-test", + "expectedResult": { + "changes": { + "number.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added '1235'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added '1_235'" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Added '0d1_235'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Added '0xa_bcd_ef0_123_456_788'" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Added '0o1234576'" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Added '0b1_1'" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Added '1.234_5e678_91'" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Added '1234'" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Added '1_234'" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 8 + ] + } + }, + "summary": "Added '0d1_234'" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 24 + ] + } + }, + "summary": "Added '0xa_bcd_ef0_123_456_789'" + }, + { + "span": { + "insert": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 10 + ] + } + }, + "summary": "Added '0o1234567'" + }, + { + "span": { + "insert": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 6 + ] + } + }, + "summary": "Added '0b1_0'" + }, + { + "span": { + "insert": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 15 + ] + } + }, + "summary": "Added '1.234_5e678_90'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.rb" + ], + "patch": [ + "diff --git a/number.rb b/number.rb", + "index 1a73a0e..ed36c77 100644", + "--- a/number.rb", + "+++ b/number.rb", + "@@ -1,3 +1,19 @@", + "+1235", + "+1_235", + "+0d1_235", + "+0xa_bcd_ef0_123_456_788", + "+0o1234576", + "+0b1_1", + "+1.234_5e678_91", + "+", + "+1234", + "+1_234", + "+0d1_234", + "+0xa_bcd_ef0_123_456_789", + "+0o1234567", + "+0b1_0", + "+1.234_5e678_90", + "+", + " 1234", + " 1_234", + " 0d1_234" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "16007467a399e377bac5bb6b6a3608406ea8aae5..f48a1d65a1224fdadd905104da8a1c55db638228" +} +,{ + "testCaseDescription": "ruby-number-delete-insert-test", + "expectedResult": { + "changes": { + "number.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added '1234'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added '1_234'" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Added '0d1_234'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Added '0xa_bcd_ef0_123_456_789'" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + ] + }, + "summary": "Replaced '1235' with '0o1234567'" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + }, + { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + ] + }, + "summary": "Replaced '1_235' with '0b1_0'" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Added '1.234_5e678_90'" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Deleted '0d1_235'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Deleted '0xa_bcd_ef0_123_456_788'" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Deleted '0o1234576'" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Deleted '0b1_1'" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Deleted '1.234_5e678_91'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.rb" + ], + "patch": [ + "diff --git a/number.rb b/number.rb", + "index ed36c77..ad686c2 100644", + "--- a/number.rb", + "+++ b/number.rb", + "@@ -1,10 +1,10 @@", + "-1235", + "-1_235", + "-0d1_235", + "-0xa_bcd_ef0_123_456_788", + "-0o1234576", + "-0b1_1", + "-1.234_5e678_91", + "+1234", + "+1_234", + "+0d1_234", + "+0xa_bcd_ef0_123_456_789", + "+0o1234567", + "+0b1_0", + "+1.234_5e678_90", + " ", + " 1234", + " 1_234" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f48a1d65a1224fdadd905104da8a1c55db638228..57c06ba2036c9de0bdc01ae5e96bf68bff99ef56" +} +,{ + "testCaseDescription": "ruby-number-replacement-test", + "expectedResult": { + "changes": { + "number.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added '1235'" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added '1_235'" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Added '0d1_235'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Added '0xa_bcd_ef0_123_456_788'" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + }, + { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + ] + }, + "summary": "Replaced '1234' with '0o1234576'" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Added '0b1_1'" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Added '1.234_5e678_91'" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted '1_234'" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Deleted '0d1_234'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Deleted '0xa_bcd_ef0_123_456_789'" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Deleted '0o1234567'" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Deleted '0b1_0'" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Deleted '1.234_5e678_90'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.rb" + ], + "patch": [ + "diff --git a/number.rb b/number.rb", + "index ad686c2..ed36c77 100644", + "--- a/number.rb", + "+++ b/number.rb", + "@@ -1,10 +1,10 @@", + "-1234", + "-1_234", + "-0d1_234", + "-0xa_bcd_ef0_123_456_789", + "-0o1234567", + "-0b1_0", + "-1.234_5e678_90", + "+1235", + "+1_235", + "+0d1_235", + "+0xa_bcd_ef0_123_456_788", + "+0o1234576", + "+0b1_1", + "+1.234_5e678_91", + " ", + " 1234", + " 1_234" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "57c06ba2036c9de0bdc01ae5e96bf68bff99ef56..e2a32ba0512202da9f70870fbe5783664b917e39" +} +,{ + "testCaseDescription": "ruby-number-delete-replacement-test", + "expectedResult": { + "changes": { + "number.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted '1235'" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted '1_235'" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Deleted '0d1_235'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Deleted '0xa_bcd_ef0_123_456_788'" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Deleted '0o1234576'" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Deleted '0b1_1'" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Deleted '1.234_5e678_91'" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Deleted '1234'" + }, + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Deleted '1_234'" + }, + { + "span": { + "delete": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 8 + ] + } + }, + "summary": "Deleted '0d1_234'" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 24 + ] + } + }, + "summary": "Deleted '0xa_bcd_ef0_123_456_789'" + }, + { + "span": { + "delete": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 10 + ] + } + }, + "summary": "Deleted '0o1234567'" + }, + { + "span": { + "delete": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 6 + ] + } + }, + "summary": "Deleted '0b1_0'" + }, + { + "span": { + "delete": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 15 + ] + } + }, + "summary": "Deleted '1.234_5e678_90'" + }, + { + "span": { + "insert": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 5 + ] + } + }, + "summary": "Added '1235'" + }, + { + "span": { + "insert": { + "start": [ + 10, + 1 + ], + "end": [ + 10, + 6 + ] + } + }, + "summary": "Added '1_235'" + }, + { + "span": { + "insert": { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 8 + ] + } + }, + "summary": "Added '0d1_235'" + }, + { + "span": { + "insert": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 24 + ] + } + }, + "summary": "Added '0xa_bcd_ef0_123_456_788'" + }, + { + "span": { + "insert": { + "start": [ + 13, + 1 + ], + "end": [ + 13, + 10 + ] + } + }, + "summary": "Added '0o1234576'" + }, + { + "span": { + "insert": { + "start": [ + 14, + 1 + ], + "end": [ + 14, + 6 + ] + } + }, + "summary": "Added '0b1_1'" + }, + { + "span": { + "insert": { + "start": [ + 15, + 1 + ], + "end": [ + 15, + 15 + ] + } + }, + "summary": "Added '1.234_5e678_91'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.rb" + ], + "patch": [ + "diff --git a/number.rb b/number.rb", + "index ed36c77..033221c 100644", + "--- a/number.rb", + "+++ b/number.rb", + "@@ -1,11 +1,3 @@", + "-1235", + "-1_235", + "-0d1_235", + "-0xa_bcd_ef0_123_456_788", + "-0o1234576", + "-0b1_1", + "-1.234_5e678_91", + "-", + " 1234", + " 1_234", + " 0d1_234", + "@@ -14,11 +6,11 @@", + " 0b1_0", + " 1.234_5e678_90", + " ", + "-1234", + "-1_234", + "-0d1_234", + "-0xa_bcd_ef0_123_456_789", + "-0o1234567", + "-0b1_0", + "-1.234_5e678_90", + "+1235", + "+1_235", + "+0d1_235", + "+0xa_bcd_ef0_123_456_788", + "+0o1234576", + "+0b1_1", + "+1.234_5e678_91", + " " + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e2a32ba0512202da9f70870fbe5783664b917e39..aa543b3384da5ba032fe24037fd37ad7160124d6" +} +,{ + "testCaseDescription": "ruby-number-delete-test", + "expectedResult": { + "changes": { + "number.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted '1234'" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted '1_234'" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Deleted '0d1_234'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Deleted '0xa_bcd_ef0_123_456_789'" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Deleted '0o1234567'" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Deleted '0b1_0'" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Deleted '1.234_5e678_90'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.rb" + ], + "patch": [ + "diff --git a/number.rb b/number.rb", + "index 033221c..344510e 100644", + "--- a/number.rb", + "+++ b/number.rb", + "@@ -1,11 +1,3 @@", + "-1234", + "-1_234", + "-0d1_234", + "-0xa_bcd_ef0_123_456_789", + "-0o1234567", + "-0b1_0", + "-1.234_5e678_90", + "-", + " 1235", + " 1_235", + " 0d1_235" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "aa543b3384da5ba032fe24037fd37ad7160124d6..b797466344466b9cff18e819dca20b96f7e625e3" +} +,{ + "testCaseDescription": "ruby-number-delete-rest-test", + "expectedResult": { + "changes": { + "number.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted '1235'" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted '1_235'" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Deleted '0d1_235'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 24 + ] + } + }, + "summary": "Deleted '0xa_bcd_ef0_123_456_788'" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 10 + ] + } + }, + "summary": "Deleted '0o1234576'" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 6 + ] + } + }, + "summary": "Deleted '0b1_1'" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 15 + ] + } + }, + "summary": "Deleted '1.234_5e678_91'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "number.rb" + ], + "patch": [ + "diff --git a/number.rb b/number.rb", + "index 344510e..e69de29 100644", + "--- a/number.rb", + "+++ b/number.rb", + "@@ -1,8 +0,0 @@", + "-1235", + "-1_235", + "-0d1_235", + "-0xa_bcd_ef0_123_456_788", + "-0o1234576", + "-0b1_1", + "-1.234_5e678_91", + "-" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b797466344466b9cff18e819dca20b96f7e625e3..06e0c82cc4de92677af4b24443f616a6b3ddf682" +}] diff --git a/test/corpus/diff-summaries/ruby/percent-array.json b/test/corpus/diff-summaries/ruby/percent-array.json new file mode 100644 index 000000000..7da7ded4d --- /dev/null +++ b/test/corpus/diff-summaries/ruby/percent-array.json @@ -0,0 +1,323 @@ +[{ + "testCaseDescription": "ruby-percent-array-insert-test", + "expectedResult": { + "changes": { + "percent-array.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Added the '%w(one two)' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "percent-array.rb" + ], + "patch": [ + "diff --git a/percent-array.rb b/percent-array.rb", + "index e69de29..f2bc7a3 100644", + "--- a/percent-array.rb", + "+++ b/percent-array.rb", + "@@ -0,0 +1 @@", + "+%w(one two)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "55f10a51d28326bd851c2aee8b82fc4ec818357b..361be19dc7f6a6432483013f36c5d07af1532b44" +} +,{ + "testCaseDescription": "ruby-percent-array-replacement-insert-test", + "expectedResult": { + "changes": { + "percent-array.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the '%W(one #{b} three)' array" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 12 + ] + } + }, + "summary": "Added the '%w(one two)' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "percent-array.rb" + ], + "patch": [ + "diff --git a/percent-array.rb b/percent-array.rb", + "index f2bc7a3..a706392 100644", + "--- a/percent-array.rb", + "+++ b/percent-array.rb", + "@@ -1 +1,3 @@", + "+%W(one #{b} three)", + "+%w(one two)", + " %w(one two)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "361be19dc7f6a6432483013f36c5d07af1532b44..df8a458af8004412c8c947cc89fcfed3b4af5122" +} +,{ + "testCaseDescription": "ruby-percent-array-delete-insert-test", + "expectedResult": { + "changes": { + "percent-array.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the 'b' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "percent-array.rb" + ], + "patch": [ + "diff --git a/percent-array.rb b/percent-array.rb", + "index a706392..339b21e 100644", + "--- a/percent-array.rb", + "+++ b/percent-array.rb", + "@@ -1,3 +1,3 @@", + "-%W(one #{b} three)", + "+%w(one two)", + " %w(one two)", + " %w(one two)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "df8a458af8004412c8c947cc89fcfed3b4af5122..81e24b17b20d0a132c6abe23bdf9a6fdd16a3dc9" +} +,{ + "testCaseDescription": "ruby-percent-array-replacement-test", + "expectedResult": { + "changes": { + "percent-array.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the 'b' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "percent-array.rb" + ], + "patch": [ + "diff --git a/percent-array.rb b/percent-array.rb", + "index 339b21e..a706392 100644", + "--- a/percent-array.rb", + "+++ b/percent-array.rb", + "@@ -1,3 +1,3 @@", + "-%w(one two)", + "+%W(one #{b} three)", + " %w(one two)", + " %w(one two)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "81e24b17b20d0a132c6abe23bdf9a6fdd16a3dc9..3a2358dfa663b461d38a798fcc10de9a2efcd1fe" +} +,{ + "testCaseDescription": "ruby-percent-array-delete-replacement-test", + "expectedResult": { + "changes": { + "percent-array.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the '%W(one #{b} three)' array" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 12 + ] + } + }, + "summary": "Deleted the '%w(one two)' array" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 19 + ] + } + }, + "summary": "Added the '%W(one #{b} three)' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "percent-array.rb" + ], + "patch": [ + "diff --git a/percent-array.rb b/percent-array.rb", + "index a706392..1e3e29b 100644", + "--- a/percent-array.rb", + "+++ b/percent-array.rb", + "@@ -1,3 +1,2 @@", + "-%W(one #{b} three)", + "-%w(one two)", + " %w(one two)", + "+%W(one #{b} three)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3a2358dfa663b461d38a798fcc10de9a2efcd1fe..561fcbc4442ad82a99216fc0c4c30ae7ce49ec7a" +} +,{ + "testCaseDescription": "ruby-percent-array-delete-test", + "expectedResult": { + "changes": { + "percent-array.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the '%w(one two)' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "percent-array.rb" + ], + "patch": [ + "diff --git a/percent-array.rb b/percent-array.rb", + "index 1e3e29b..54153c4 100644", + "--- a/percent-array.rb", + "+++ b/percent-array.rb", + "@@ -1,2 +1 @@", + "-%w(one two)", + " %W(one #{b} three)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "561fcbc4442ad82a99216fc0c4c30ae7ce49ec7a..f8e7763b8192e337718c7b850b52de0fe02af897" +} +,{ + "testCaseDescription": "ruby-percent-array-delete-rest-test", + "expectedResult": { + "changes": { + "percent-array.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the '%W(one #{b} three)' array" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "percent-array.rb" + ], + "patch": [ + "diff --git a/percent-array.rb b/percent-array.rb", + "index 54153c4..e69de29 100644", + "--- a/percent-array.rb", + "+++ b/percent-array.rb", + "@@ -1 +0,0 @@", + "-%W(one #{b} three)" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f8e7763b8192e337718c7b850b52de0fe02af897..f1330cd221cc5290eff93e43fae52bea85ae512b" +}] diff --git a/test/corpus/diff-summaries/ruby/pseudo-variables.json b/test/corpus/diff-summaries/ruby/pseudo-variables.json new file mode 100644 index 000000000..2fc91bf9f --- /dev/null +++ b/test/corpus/diff-summaries/ruby/pseudo-variables.json @@ -0,0 +1,839 @@ +[{ + "testCaseDescription": "ruby-pseudo-variables-insert-test", + "expectedResult": { + "changes": { + "pseudo-variables.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added the 'nil' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Added the 'self' identifier" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added 'false'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pseudo-variables.rb" + ], + "patch": [ + "diff --git a/pseudo-variables.rb b/pseudo-variables.rb", + "index e69de29..2be92bc 100644", + "--- a/pseudo-variables.rb", + "+++ b/pseudo-variables.rb", + "@@ -0,0 +1,4 @@", + "+nil", + "+self", + "+false", + "+true" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "68f54d0bb0adf1b15930162ebbc91f3145873b48..c680e3e8833a065e20b0aa45e7dc81337ebaa087" +} +,{ + "testCaseDescription": "ruby-pseudo-variables-replacement-insert-test", + "expectedResult": { + "changes": { + "pseudo-variables.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'self' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'NIL' identifier" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Added 'TRUE'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added 'FALSE'" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'nil' identifier" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 5 + ] + } + }, + "summary": "Added the 'self' identifier" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 6 + ] + } + }, + "summary": "Added 'false'" + }, + { + "span": { + "insert": { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 5 + ] + } + }, + "summary": "Added 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pseudo-variables.rb" + ], + "patch": [ + "diff --git a/pseudo-variables.rb b/pseudo-variables.rb", + "index 2be92bc..e5837f2 100644", + "--- a/pseudo-variables.rb", + "+++ b/pseudo-variables.rb", + "@@ -1,3 +1,11 @@", + "+self", + "+NIL", + "+TRUE", + "+FALSE", + "+nil", + "+self", + "+false", + "+true", + " nil", + " self", + " false" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "c680e3e8833a065e20b0aa45e7dc81337ebaa087..4c30d33221b873d565f1eab152e1b32fcd9ec98f" +} +,{ + "testCaseDescription": "ruby-pseudo-variables-delete-insert-test", + "expectedResult": { + "changes": { + "pseudo-variables.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Added the 'nil' identifier" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added 'false'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added 'true'" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'NIL' identifier" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted 'TRUE'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted 'FALSE'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pseudo-variables.rb" + ], + "patch": [ + "diff --git a/pseudo-variables.rb b/pseudo-variables.rb", + "index e5837f2..e3f5814 100644", + "--- a/pseudo-variables.rb", + "+++ b/pseudo-variables.rb", + "@@ -1,7 +1,7 @@", + "+nil", + " self", + "-NIL", + "-TRUE", + "-FALSE", + "+false", + "+true", + " nil", + " self", + " false" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4c30d33221b873d565f1eab152e1b32fcd9ec98f..6d79f0dbb9e3d1f9f9f56e7764d39f01bf286a02" +} +,{ + "testCaseDescription": "ruby-pseudo-variables-replacement-test", + "expectedResult": { + "changes": { + "pseudo-variables.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted the 'nil' identifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'NIL' identifier" + }, + { + "span": { + "replace": [ + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + ] + }, + "summary": "Replaced 'false' with 'TRUE'" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added 'FALSE'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Deleted 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pseudo-variables.rb" + ], + "patch": [ + "diff --git a/pseudo-variables.rb b/pseudo-variables.rb", + "index e3f5814..e5837f2 100644", + "--- a/pseudo-variables.rb", + "+++ b/pseudo-variables.rb", + "@@ -1,7 +1,7 @@", + "-nil", + " self", + "-false", + "-true", + "+NIL", + "+TRUE", + "+FALSE", + " nil", + " self", + " false" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6d79f0dbb9e3d1f9f9f56e7764d39f01bf286a02..ddf5a4e1c13cf400a447e6f8c44bd08f456ca4ad" +} +,{ + "testCaseDescription": "ruby-pseudo-variables-delete-replacement-test", + "expectedResult": { + "changes": { + "pseudo-variables.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'self' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'NIL' identifier" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted 'TRUE'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted 'FALSE'" + }, + { + "span": { + "delete": { + "start": [ + 9, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Deleted the 'nil' identifier" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'NIL' identifier" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 7, + 5 + ] + } + }, + "summary": "Added 'TRUE'" + }, + { + "span": { + "replace": [ + { + "start": [ + 11, + 1 + ], + "end": [ + 11, + 6 + ] + }, + { + "start": [ + 8, + 1 + ], + "end": [ + 8, + 6 + ] + } + ] + }, + "summary": "Replaced 'false' with 'FALSE'" + }, + { + "span": { + "delete": { + "start": [ + 12, + 1 + ], + "end": [ + 12, + 5 + ] + } + }, + "summary": "Deleted 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pseudo-variables.rb" + ], + "patch": [ + "diff --git a/pseudo-variables.rb b/pseudo-variables.rb", + "index e5837f2..8873ea5 100644", + "--- a/pseudo-variables.rb", + "+++ b/pseudo-variables.rb", + "@@ -1,12 +1,8 @@", + "-self", + "-NIL", + "-TRUE", + "-FALSE", + " nil", + " self", + " false", + " true", + "-nil", + " self", + "-false", + "-true", + "+NIL", + "+TRUE", + "+FALSE" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ddf5a4e1c13cf400a447e6f8c44bd08f456ca4ad..ba34dce419ccf4b8cb9d792b356e0574fbbd70b7" +} +,{ + "testCaseDescription": "ruby-pseudo-variables-delete-test", + "expectedResult": { + "changes": { + "pseudo-variables.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + }, + "summary": "Deleted the 'nil' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Deleted the 'self' identifier" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Deleted 'false'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Deleted 'true'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pseudo-variables.rb" + ], + "patch": [ + "diff --git a/pseudo-variables.rb b/pseudo-variables.rb", + "index 8873ea5..30bb4d2 100644", + "--- a/pseudo-variables.rb", + "+++ b/pseudo-variables.rb", + "@@ -1,7 +1,3 @@", + "-nil", + "-self", + "-false", + "-true", + " self", + " NIL", + " TRUE" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ba34dce419ccf4b8cb9d792b356e0574fbbd70b7..7ecd69c8f3d0df733db6bbbc6d6a9296163bed38" +} +,{ + "testCaseDescription": "ruby-pseudo-variables-delete-rest-test", + "expectedResult": { + "changes": { + "pseudo-variables.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'self' identifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'NIL' identifier" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 5 + ] + } + }, + "summary": "Deleted 'TRUE'" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted 'FALSE'" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "pseudo-variables.rb" + ], + "patch": [ + "diff --git a/pseudo-variables.rb b/pseudo-variables.rb", + "index 30bb4d2..e69de29 100644", + "--- a/pseudo-variables.rb", + "+++ b/pseudo-variables.rb", + "@@ -1,4 +0,0 @@", + "-self", + "-NIL", + "-TRUE", + "-FALSE" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7ecd69c8f3d0df733db6bbbc6d6a9296163bed38..547ae1f08f791cd22ce19d39ca7f69371d9dbfab" +}] diff --git a/test/corpus/diff-summaries/ruby/range.json b/test/corpus/diff-summaries/ruby/range.json new file mode 100644 index 000000000..6adcab826 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/range.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-range-insert-test", + "expectedResult": { + "changes": { + "range.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the 'a..b' range" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "range.rb" + ], + "patch": [ + "diff --git a/range.rb b/range.rb", + "index e69de29..82219db 100644", + "--- a/range.rb", + "+++ b/range.rb", + "@@ -0,0 +1 @@", + "+a..b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3b08aca782ea8046a155639d7c198174c1b8f8cc..91fef0f5132018b874c903b9368194ca4c5ef146" +} +,{ + "testCaseDescription": "ruby-range-replacement-insert-test", + "expectedResult": { + "changes": { + "range.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the 'x...y' range" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Added the 'a..b' range" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "range.rb" + ], + "patch": [ + "diff --git a/range.rb b/range.rb", + "index 82219db..173f43e 100644", + "--- a/range.rb", + "+++ b/range.rb", + "@@ -1 +1,3 @@", + "+x...y", + "+a..b", + " a..b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "91fef0f5132018b874c903b9368194ca4c5ef146..dc048976b989b903db3c71b971ae0b512f46ac93" +} +,{ + "testCaseDescription": "ruby-range-delete-insert-test", + "expectedResult": { + "changes": { + "range.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + ] + }, + "summary": "Replaced the 'x...y' range with the 'a..b' range" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "range.rb" + ], + "patch": [ + "diff --git a/range.rb b/range.rb", + "index 173f43e..6e4c63b 100644", + "--- a/range.rb", + "+++ b/range.rb", + "@@ -1,3 +1,3 @@", + "-x...y", + "+a..b", + " a..b", + " a..b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "dc048976b989b903db3c71b971ae0b512f46ac93..1a2d867c7c34e6772349703a19c761822dfc1fa6" +} +,{ + "testCaseDescription": "ruby-range-replacement-test", + "expectedResult": { + "changes": { + "range.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'a..b' range with the 'x...y' range" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "range.rb" + ], + "patch": [ + "diff --git a/range.rb b/range.rb", + "index 6e4c63b..173f43e 100644", + "--- a/range.rb", + "+++ b/range.rb", + "@@ -1,3 +1,3 @@", + "-a..b", + "+x...y", + " a..b", + " a..b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1a2d867c7c34e6772349703a19c761822dfc1fa6..cc157ed0c0f7d569a92e11a0cfdc994d88b846c5" +} +,{ + "testCaseDescription": "ruby-range-delete-replacement-test", + "expectedResult": { + "changes": { + "range.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x...y' range" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 5 + ] + } + }, + "summary": "Deleted the 'a..b' range" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'x...y' range" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "range.rb" + ], + "patch": [ + "diff --git a/range.rb b/range.rb", + "index 173f43e..e4282a4 100644", + "--- a/range.rb", + "+++ b/range.rb", + "@@ -1,3 +1,2 @@", + "-x...y", + "-a..b", + " a..b", + "+x...y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cc157ed0c0f7d569a92e11a0cfdc994d88b846c5..31f592ffc839bbd435c2a4f524fbcadb3a02a061" +} +,{ + "testCaseDescription": "ruby-range-delete-test", + "expectedResult": { + "changes": { + "range.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the 'a..b' range" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "range.rb" + ], + "patch": [ + "diff --git a/range.rb b/range.rb", + "index e4282a4..b06b198 100644", + "--- a/range.rb", + "+++ b/range.rb", + "@@ -1,2 +1 @@", + "-a..b", + " x...y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "31f592ffc839bbd435c2a4f524fbcadb3a02a061..13ea3266404ef3d9fc016b5070c30031a2966143" +} +,{ + "testCaseDescription": "ruby-range-delete-rest-test", + "expectedResult": { + "changes": { + "range.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the 'x...y' range" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "range.rb" + ], + "patch": [ + "diff --git a/range.rb b/range.rb", + "index b06b198..e69de29 100644", + "--- a/range.rb", + "+++ b/range.rb", + "@@ -1 +0,0 @@", + "-x...y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "13ea3266404ef3d9fc016b5070c30031a2966143..c15e25e8bbbb6675bbd50cef198ecd45fa1e79d6" +}] diff --git a/test/corpus/diff-summaries/ruby/regex.json b/test/corpus/diff-summaries/ruby/regex.json new file mode 100644 index 000000000..b0f80eb16 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/regex.json @@ -0,0 +1,383 @@ +[{ + "testCaseDescription": "ruby-regex-insert-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Added the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index e69de29..02dce9d 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -0,0 +1 @@", + "+/^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2ff905a98a2dc39fc75453b6c88896e443c79021..a66e772e4bdb4ed550e5e2cfaa3643a0fccff994" +} +,{ + "testCaseDescription": "ruby-regex-replacement-insert-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the '%r/a/' regex" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the '%rc>' regex" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 19 + ] + } + }, + "summary": "Added the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index 02dce9d..c801d61 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1 +1,4 @@", + "+%r/a/", + "+%rc>", + "+/^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a66e772e4bdb4ed550e5e2cfaa3643a0fccff994..b3bf620c673130bef288d8be442fa28464a964bc" +} +,{ + "testCaseDescription": "ruby-regex-delete-insert-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + ] + }, + "summary": "Replaced the '%r/a/' regex with the '/^(foo|bar[^_])$/i' regex" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the '%rc>' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index c801d61..42d4984 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,4 +1,3 @@", + "-%r/a/", + "-%rc>", + "+/^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b3bf620c673130bef288d8be442fa28464a964bc..ee3e86d44c9ff236d67c502a69741d1e3a780f5a" +} +,{ + "testCaseDescription": "ruby-regex-replacement-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the '/^(foo|bar[^_])$/i' regex with the '%r/a/' regex" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the '%rc>' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index 42d4984..c801d61 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,3 +1,4 @@", + "-/^(foo|bar[^_])$/i", + "+%r/a/", + "+%rc>", + " /^(foo|bar[^_])$/i", + " /^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ee3e86d44c9ff236d67c502a69741d1e3a780f5a..e16ec55d4ea68802668226ffe4dddb1a454fb0d5" +} +,{ + "testCaseDescription": "ruby-regex-delete-replacement-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 19 + ] + } + }, + "summary": "Deleted the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index c801d61..48e43a9 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,4 +1,3 @@", + "+/^(foo|bar[^_])$/i", + " %r/a/", + " %rc>", + "-/^(foo|bar[^_])$/i", + "-/^(foo|bar[^_])$/i" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e16ec55d4ea68802668226ffe4dddb1a454fb0d5..6911beadc5634a1c7406cdb318b941ff7fdf7e23" +} +,{ + "testCaseDescription": "ruby-regex-delete-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 19 + ] + } + }, + "summary": "Deleted the '/^(foo|bar[^_])$/i' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index 48e43a9..b23927a 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,3 +1,2 @@", + "-/^(foo|bar[^_])$/i", + " %r/a/", + " %rc>" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6911beadc5634a1c7406cdb318b941ff7fdf7e23..0ed42a67d2a302cebc57a513f2f5549c231b15b2" +} +,{ + "testCaseDescription": "ruby-regex-delete-rest-test", + "expectedResult": { + "changes": { + "regex.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the '%r/a/' regex" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the '%rc>' regex" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "regex.rb" + ], + "patch": [ + "diff --git a/regex.rb b/regex.rb", + "index b23927a..e69de29 100644", + "--- a/regex.rb", + "+++ b/regex.rb", + "@@ -1,2 +0,0 @@", + "-%r/a/", + "-%rc>" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0ed42a67d2a302cebc57a513f2f5549c231b15b2..9fae8330e922eddbf4df2dbc2d15f8106defa0d6" +}] diff --git a/test/corpus/diff-summaries/ruby/relational-operator.json b/test/corpus/diff-summaries/ruby/relational-operator.json new file mode 100644 index 000000000..47c7945c3 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/relational-operator.json @@ -0,0 +1,733 @@ +[{ + "testCaseDescription": "ruby-relational-operator-insert-test", + "expectedResult": { + "changes": { + "relational-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added the 'x == y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'x != y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Added the 'x === y' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.rb" + ], + "patch": [ + "diff --git a/relational-operator.rb b/relational-operator.rb", + "index e69de29..e2290b2 100644", + "--- a/relational-operator.rb", + "+++ b/relational-operator.rb", + "@@ -0,0 +1,3 @@", + "+x == y", + "+x != y", + "+x === y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "546a8ae29d4964d2d9e5fc7e22788161d4a41040..6d1a956314d61dfef3164462a8b1d10eac037f44" +} +,{ + "testCaseDescription": "ruby-relational-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "relational-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Added the 'x <=> y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the 'x =~ y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added the 'x' assignment" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Added the 'x == y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Added the 'x != y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Added the 'x === y' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.rb" + ], + "patch": [ + "diff --git a/relational-operator.rb b/relational-operator.rb", + "index e2290b2..d547ce5 100644", + "--- a/relational-operator.rb", + "+++ b/relational-operator.rb", + "@@ -1,3 +1,9 @@", + "+x <=> y", + "+x =~ y", + "+x =! y", + "+x == y", + "+x != y", + "+x === y", + " x == y", + " x != y", + " x === y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6d1a956314d61dfef3164462a8b1d10eac037f44..7256be43ac2f9e0c6705959925ba6f0f395f17f7" +} +,{ + "testCaseDescription": "ruby-relational-operator-delete-insert-test", + "expectedResult": { + "changes": { + "relational-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x <=> y' binary statement with the 'x == y' binary statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x =~ y' binary statement with the 'x != y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Added the 'x === y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.rb" + ], + "patch": [ + "diff --git a/relational-operator.rb b/relational-operator.rb", + "index d547ce5..5849f29 100644", + "--- a/relational-operator.rb", + "+++ b/relational-operator.rb", + "@@ -1,6 +1,6 @@", + "-x <=> y", + "-x =~ y", + "-x =! y", + "+x == y", + "+x != y", + "+x === y", + " x == y", + " x != y", + " x === y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7256be43ac2f9e0c6705959925ba6f0f395f17f7..fca757242c65d9e9dca28cc5cd135bff4de1057e" +} +,{ + "testCaseDescription": "ruby-relational-operator-replacement-test", + "expectedResult": { + "changes": { + "relational-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced the 'x == y' binary statement with the 'x <=> y' binary statement" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the 'x != y' binary statement with the 'x =~ y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added the 'x' assignment" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Deleted the 'x === y' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.rb" + ], + "patch": [ + "diff --git a/relational-operator.rb b/relational-operator.rb", + "index 5849f29..d547ce5 100644", + "--- a/relational-operator.rb", + "+++ b/relational-operator.rb", + "@@ -1,6 +1,6 @@", + "-x == y", + "-x != y", + "-x === y", + "+x <=> y", + "+x =~ y", + "+x =! y", + " x == y", + " x != y", + " x === y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fca757242c65d9e9dca28cc5cd135bff4de1057e..54de4f4a977f330f23f05091b9056d7d3518ea53" +} +,{ + "testCaseDescription": "ruby-relational-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "relational-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'x <=> y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'x =~ y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the 'x' assignment" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 7 + ] + } + }, + "summary": "Deleted the 'x == y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Deleted the 'x != y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 8 + ] + } + }, + "summary": "Deleted the 'x === y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 8 + ] + } + }, + "summary": "Added the 'x <=> y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Added the 'x =~ y' binary statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.rb" + ], + "patch": [ + "diff --git a/relational-operator.rb b/relational-operator.rb", + "index d547ce5..ac1eb5d 100644", + "--- a/relational-operator.rb", + "+++ b/relational-operator.rb", + "@@ -1,9 +1,6 @@", + "-x <=> y", + "-x =~ y", + "-x =! y", + "-x == y", + "-x != y", + "-x === y", + " x == y", + " x != y", + " x === y", + "+x <=> y", + "+x =~ y", + "+x =! y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "54de4f4a977f330f23f05091b9056d7d3518ea53..4e3bb08535cb9130465f27dee1d65ccaefca2bb0" +} +,{ + "testCaseDescription": "ruby-relational-operator-delete-test", + "expectedResult": { + "changes": { + "relational-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted the 'x == y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'x != y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 8 + ] + } + }, + "summary": "Deleted the 'x === y' binary statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.rb" + ], + "patch": [ + "diff --git a/relational-operator.rb b/relational-operator.rb", + "index ac1eb5d..8180103 100644", + "--- a/relational-operator.rb", + "+++ b/relational-operator.rb", + "@@ -1,6 +1,3 @@", + "-x == y", + "-x != y", + "-x === y", + " x <=> y", + " x =~ y", + " x =! y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4e3bb08535cb9130465f27dee1d65ccaefca2bb0..4d80456dea201180a54994f8210223aef501cde9" +} +,{ + "testCaseDescription": "ruby-relational-operator-delete-rest-test", + "expectedResult": { + "changes": { + "relational-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 8 + ] + } + }, + "summary": "Deleted the 'x <=> y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the 'x =~ y' binary statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the 'x' assignment" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "relational-operator.rb" + ], + "patch": [ + "diff --git a/relational-operator.rb b/relational-operator.rb", + "index 8180103..e69de29 100644", + "--- a/relational-operator.rb", + "+++ b/relational-operator.rb", + "@@ -1,3 +0,0 @@", + "-x <=> y", + "-x =~ y", + "-x =! y" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4d80456dea201180a54994f8210223aef501cde9..cef9371cb4d1a05f91067637d7e9256fdc8b846c" +}] diff --git a/test/corpus/diff-summaries/ruby/rescue-empty.json b/test/corpus/diff-summaries/ruby/rescue-empty.json new file mode 100644 index 000000000..f0a42205a --- /dev/null +++ b/test/corpus/diff-summaries/ruby/rescue-empty.json @@ -0,0 +1,363 @@ +[{ + "testCaseDescription": "ruby-rescue-empty-insert-test", + "expectedResult": { + "changes": { + "rescue-empty.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-empty.rb" + ], + "patch": [ + "diff --git a/rescue-empty.rb b/rescue-empty.rb", + "index e69de29..5b4fe96 100644", + "--- a/rescue-empty.rb", + "+++ b/rescue-empty.rb", + "@@ -0,0 +1,4 @@", + "+begin", + "+ foo", + "+rescue", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9bdc443bb96ee6977eaaa39b6329f334c5a9db48..6da3684f76a2007479f377d4c79cef4521803b58" +} +,{ + "testCaseDescription": "ruby-rescue-empty-replacement-insert-test", + "expectedResult": { + "changes": { + "rescue-empty.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added a begin statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-empty.rb" + ], + "patch": [ + "diff --git a/rescue-empty.rb b/rescue-empty.rb", + "index 5b4fe96..d74e034 100644", + "--- a/rescue-empty.rb", + "+++ b/rescue-empty.rb", + "@@ -1,4 +1,13 @@", + " begin", + " foo", + " rescue", + "+ bar", + "+end", + "+begin", + "+ foo", + "+rescue", + "+end", + "+begin", + "+ foo", + "+rescue", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "6da3684f76a2007479f377d4c79cef4521803b58..71968b3d5351636aa647b9600f1ddd9ccd22ab67" +} +,{ + "testCaseDescription": "ruby-rescue-empty-delete-insert-test", + "expectedResult": { + "changes": { + "rescue-empty.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the 'bar' identifier in a rescue block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-empty.rb" + ], + "patch": [ + "diff --git a/rescue-empty.rb b/rescue-empty.rb", + "index d74e034..afdc934 100644", + "--- a/rescue-empty.rb", + "+++ b/rescue-empty.rb", + "@@ -1,7 +1,6 @@", + " begin", + " foo", + " rescue", + "- bar", + " end", + " begin", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "71968b3d5351636aa647b9600f1ddd9ccd22ab67..e7f252589596cedefd11f71c6b466530746c334d" +} +,{ + "testCaseDescription": "ruby-rescue-empty-replacement-test", + "expectedResult": { + "changes": { + "rescue-empty.rb": [ + { + "span": { + "insert": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'bar' identifier in a rescue block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-empty.rb" + ], + "patch": [ + "diff --git a/rescue-empty.rb b/rescue-empty.rb", + "index afdc934..d74e034 100644", + "--- a/rescue-empty.rb", + "+++ b/rescue-empty.rb", + "@@ -1,6 +1,7 @@", + " begin", + " foo", + " rescue", + "+ bar", + " end", + " begin", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e7f252589596cedefd11f71c6b466530746c334d..66d3909b37271ec30200b51be63cb339ff8d0133" +} +,{ + "testCaseDescription": "ruby-rescue-empty-delete-replacement-test", + "expectedResult": { + "changes": { + "rescue-empty.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-empty.rb" + ], + "patch": [ + "diff --git a/rescue-empty.rb b/rescue-empty.rb", + "index d74e034..f8a72a7 100644", + "--- a/rescue-empty.rb", + "+++ b/rescue-empty.rb", + "@@ -1,13 +1,9 @@", + " begin", + " foo", + " rescue", + "- bar", + "-end", + "-begin", + "- foo", + "-rescue", + " end", + " begin", + " foo", + " rescue", + "+ bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "66d3909b37271ec30200b51be63cb339ff8d0133..d14f1280b2da935d376edc78e38c5c0766cad688" +} +,{ + "testCaseDescription": "ruby-rescue-empty-delete-test", + "expectedResult": { + "changes": { + "rescue-empty.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-empty.rb" + ], + "patch": [ + "diff --git a/rescue-empty.rb b/rescue-empty.rb", + "index f8a72a7..17dffb3 100644", + "--- a/rescue-empty.rb", + "+++ b/rescue-empty.rb", + "@@ -1,9 +1,5 @@", + " begin", + " foo", + " rescue", + "-end", + "-begin", + "- foo", + "-rescue", + " bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d14f1280b2da935d376edc78e38c5c0766cad688..742166d0e7309f54788c3478fbf1451e36729c37" +} +,{ + "testCaseDescription": "ruby-rescue-empty-delete-rest-test", + "expectedResult": { + "changes": { + "rescue-empty.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-empty.rb" + ], + "patch": [ + "diff --git a/rescue-empty.rb b/rescue-empty.rb", + "index 17dffb3..e69de29 100644", + "--- a/rescue-empty.rb", + "+++ b/rescue-empty.rb", + "@@ -1,5 +0,0 @@", + "-begin", + "- foo", + "-rescue", + "- bar", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "742166d0e7309f54788c3478fbf1451e36729c37..4e341502c58d4f3337b20901f290e05d92ff81ce" +}] diff --git a/test/corpus/diff-summaries/ruby/rescue-last-ex.json b/test/corpus/diff-summaries/ruby/rescue-last-ex.json new file mode 100644 index 000000000..864473003 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/rescue-last-ex.json @@ -0,0 +1,363 @@ +[{ + "testCaseDescription": "ruby-rescue-last-ex-insert-test", + "expectedResult": { + "changes": { + "rescue-last-ex.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-last-ex.rb" + ], + "patch": [ + "diff --git a/rescue-last-ex.rb b/rescue-last-ex.rb", + "index e69de29..a5dbb28 100644", + "--- a/rescue-last-ex.rb", + "+++ b/rescue-last-ex.rb", + "@@ -0,0 +1,4 @@", + "+begin", + "+ foo", + "+rescue Error => x", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4e341502c58d4f3337b20901f290e05d92ff81ce..8425ede26eeaef42f67276f46eb0bebd3e2e1d2d" +} +,{ + "testCaseDescription": "ruby-rescue-last-ex-replacement-insert-test", + "expectedResult": { + "changes": { + "rescue-last-ex.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added a begin statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-last-ex.rb" + ], + "patch": [ + "diff --git a/rescue-last-ex.rb b/rescue-last-ex.rb", + "index a5dbb28..9c0bf85 100644", + "--- a/rescue-last-ex.rb", + "+++ b/rescue-last-ex.rb", + "@@ -1,4 +1,13 @@", + " begin", + " foo", + " rescue Error => x", + "+ bar", + "+end", + "+begin", + "+ foo", + "+rescue Error => x", + "+end", + "+begin", + "+ foo", + "+rescue Error => x", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8425ede26eeaef42f67276f46eb0bebd3e2e1d2d..b32a3debb1fa4d3d06b4c975ad004014b6af94f4" +} +,{ + "testCaseDescription": "ruby-rescue-last-ex-delete-insert-test", + "expectedResult": { + "changes": { + "rescue-last-ex.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the 'bar' identifier in the 'Error, x' rescue block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-last-ex.rb" + ], + "patch": [ + "diff --git a/rescue-last-ex.rb b/rescue-last-ex.rb", + "index 9c0bf85..e6fe0ab 100644", + "--- a/rescue-last-ex.rb", + "+++ b/rescue-last-ex.rb", + "@@ -1,7 +1,6 @@", + " begin", + " foo", + " rescue Error => x", + "- bar", + " end", + " begin", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b32a3debb1fa4d3d06b4c975ad004014b6af94f4..7f6fd4e0ad7c55c7a92763774022a270b8093671" +} +,{ + "testCaseDescription": "ruby-rescue-last-ex-replacement-test", + "expectedResult": { + "changes": { + "rescue-last-ex.rb": [ + { + "span": { + "insert": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'bar' identifier in the 'Error, x' rescue block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-last-ex.rb" + ], + "patch": [ + "diff --git a/rescue-last-ex.rb b/rescue-last-ex.rb", + "index e6fe0ab..9c0bf85 100644", + "--- a/rescue-last-ex.rb", + "+++ b/rescue-last-ex.rb", + "@@ -1,6 +1,7 @@", + " begin", + " foo", + " rescue Error => x", + "+ bar", + " end", + " begin", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7f6fd4e0ad7c55c7a92763774022a270b8093671..7e421057ad4b36d1328d7bf7916b69127f7ff7be" +} +,{ + "testCaseDescription": "ruby-rescue-last-ex-delete-replacement-test", + "expectedResult": { + "changes": { + "rescue-last-ex.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-last-ex.rb" + ], + "patch": [ + "diff --git a/rescue-last-ex.rb b/rescue-last-ex.rb", + "index 9c0bf85..23c7c1b 100644", + "--- a/rescue-last-ex.rb", + "+++ b/rescue-last-ex.rb", + "@@ -1,13 +1,9 @@", + " begin", + " foo", + " rescue Error => x", + "- bar", + "-end", + "-begin", + "- foo", + "-rescue Error => x", + " end", + " begin", + " foo", + " rescue Error => x", + "+ bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7e421057ad4b36d1328d7bf7916b69127f7ff7be..b4dae7c86ae31eda9e8d70dd2c8ae6b138afd77f" +} +,{ + "testCaseDescription": "ruby-rescue-last-ex-delete-test", + "expectedResult": { + "changes": { + "rescue-last-ex.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-last-ex.rb" + ], + "patch": [ + "diff --git a/rescue-last-ex.rb b/rescue-last-ex.rb", + "index 23c7c1b..c247b6d 100644", + "--- a/rescue-last-ex.rb", + "+++ b/rescue-last-ex.rb", + "@@ -1,9 +1,5 @@", + " begin", + " foo", + " rescue Error => x", + "-end", + "-begin", + "- foo", + "-rescue Error => x", + " bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b4dae7c86ae31eda9e8d70dd2c8ae6b138afd77f..2bc8f78a20e5da47d0d7e34713ea718397fd6c81" +} +,{ + "testCaseDescription": "ruby-rescue-last-ex-delete-rest-test", + "expectedResult": { + "changes": { + "rescue-last-ex.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-last-ex.rb" + ], + "patch": [ + "diff --git a/rescue-last-ex.rb b/rescue-last-ex.rb", + "index c247b6d..e69de29 100644", + "--- a/rescue-last-ex.rb", + "+++ b/rescue-last-ex.rb", + "@@ -1,5 +0,0 @@", + "-begin", + "- foo", + "-rescue Error => x", + "- bar", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2bc8f78a20e5da47d0d7e34713ea718397fd6c81..9fe68f110d2411ffc055710d7554ba3470e4e931" +}] diff --git a/test/corpus/diff-summaries/ruby/rescue-modifier.json b/test/corpus/diff-summaries/ruby/rescue-modifier.json new file mode 100644 index 000000000..4926bb688 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/rescue-modifier.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-rescue-modifier-insert-test", + "expectedResult": { + "changes": { + "rescue-modifier.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier.rb" + ], + "patch": [ + "diff --git a/rescue-modifier.rb b/rescue-modifier.rb", + "index e69de29..b0cea1a 100644", + "--- a/rescue-modifier.rb", + "+++ b/rescue-modifier.rb", + "@@ -0,0 +1 @@", + "+foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9fe68f110d2411ffc055710d7554ba3470e4e931..07a776b4136ecb396ee5f429ea30d9bf71e5e8ef" +} +,{ + "testCaseDescription": "ruby-rescue-modifier-replacement-insert-test", + "expectedResult": { + "changes": { + "rescue-modifier.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Added the 'foo' rescue modifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Added the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier.rb" + ], + "patch": [ + "diff --git a/rescue-modifier.rb b/rescue-modifier.rb", + "index b0cea1a..79b1f6a 100644", + "--- a/rescue-modifier.rb", + "+++ b/rescue-modifier.rb", + "@@ -1 +1,3 @@", + "+foo rescue false", + "+foo rescue nil", + " foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "07a776b4136ecb396ee5f429ea30d9bf71e5e8ef..3d325cacec0bfc91158b9d95fd9ad53957bcdc4e" +} +,{ + "testCaseDescription": "ruby-rescue-modifier-delete-insert-test", + "expectedResult": { + "changes": { + "rescue-modifier.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + ] + }, + "summary": "Replaced the 'foo' rescue modifier with the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier.rb" + ], + "patch": [ + "diff --git a/rescue-modifier.rb b/rescue-modifier.rb", + "index 79b1f6a..f59c8c2 100644", + "--- a/rescue-modifier.rb", + "+++ b/rescue-modifier.rb", + "@@ -1,3 +1,3 @@", + "-foo rescue false", + "+foo rescue nil", + " foo rescue nil", + " foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3d325cacec0bfc91158b9d95fd9ad53957bcdc4e..569493eefd6a1ca59b657143013feb16c0d70e1e" +} +,{ + "testCaseDescription": "ruby-rescue-modifier-replacement-test", + "expectedResult": { + "changes": { + "rescue-modifier.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + ] + }, + "summary": "Replaced the 'foo' rescue modifier with the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier.rb" + ], + "patch": [ + "diff --git a/rescue-modifier.rb b/rescue-modifier.rb", + "index f59c8c2..79b1f6a 100644", + "--- a/rescue-modifier.rb", + "+++ b/rescue-modifier.rb", + "@@ -1,3 +1,3 @@", + "-foo rescue nil", + "+foo rescue false", + " foo rescue nil", + " foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "569493eefd6a1ca59b657143013feb16c0d70e1e..87de11c084bf31878b741472fefe44d5b8a148d6" +} +,{ + "testCaseDescription": "ruby-rescue-modifier-delete-replacement-test", + "expectedResult": { + "changes": { + "rescue-modifier.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'foo' rescue modifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Deleted the 'foo' rescue modifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Added the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier.rb" + ], + "patch": [ + "diff --git a/rescue-modifier.rb b/rescue-modifier.rb", + "index 79b1f6a..509bcea 100644", + "--- a/rescue-modifier.rb", + "+++ b/rescue-modifier.rb", + "@@ -1,3 +1,2 @@", + "-foo rescue false", + "-foo rescue nil", + " foo rescue nil", + "+foo rescue false" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "87de11c084bf31878b741472fefe44d5b8a148d6..4aca2618f3d65e470d6bf72ac4bb994a7c42e77f" +} +,{ + "testCaseDescription": "ruby-rescue-modifier-delete-test", + "expectedResult": { + "changes": { + "rescue-modifier.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier.rb" + ], + "patch": [ + "diff --git a/rescue-modifier.rb b/rescue-modifier.rb", + "index 509bcea..c36274a 100644", + "--- a/rescue-modifier.rb", + "+++ b/rescue-modifier.rb", + "@@ -1,2 +1 @@", + "-foo rescue nil", + " foo rescue false" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4aca2618f3d65e470d6bf72ac4bb994a7c42e77f..7ed3763df5fc2e5f6ad0f1e67be983587d44256f" +} +,{ + "testCaseDescription": "ruby-rescue-modifier-delete-rest-test", + "expectedResult": { + "changes": { + "rescue-modifier.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 17 + ] + } + }, + "summary": "Deleted the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier.rb" + ], + "patch": [ + "diff --git a/rescue-modifier.rb b/rescue-modifier.rb", + "index c36274a..e69de29 100644", + "--- a/rescue-modifier.rb", + "+++ b/rescue-modifier.rb", + "@@ -1 +0,0 @@", + "-foo rescue false" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7ed3763df5fc2e5f6ad0f1e67be983587d44256f..cd21edaf265df41611fbf13a0800f4e4115c15e1" +}] diff --git a/test/corpus/diff-summaries/ruby/rescue-modifier2.json b/test/corpus/diff-summaries/ruby/rescue-modifier2.json new file mode 100644 index 000000000..02426e4f0 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/rescue-modifier2.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-rescue-modifier2-insert-test", + "expectedResult": { + "changes": { + "rescue-modifier2.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier2.rb" + ], + "patch": [ + "diff --git a/rescue-modifier2.rb b/rescue-modifier2.rb", + "index e69de29..b0cea1a 100644", + "--- a/rescue-modifier2.rb", + "+++ b/rescue-modifier2.rb", + "@@ -0,0 +1 @@", + "+foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cd21edaf265df41611fbf13a0800f4e4115c15e1..ee82fb48f85e32423edfa0a919526c91bfbeeaa8" +} +,{ + "testCaseDescription": "ruby-rescue-modifier2-replacement-insert-test", + "expectedResult": { + "changes": { + "rescue-modifier2.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the 'bar' rescue modifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Added the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier2.rb" + ], + "patch": [ + "diff --git a/rescue-modifier2.rb b/rescue-modifier2.rb", + "index b0cea1a..595bf2e 100644", + "--- a/rescue-modifier2.rb", + "+++ b/rescue-modifier2.rb", + "@@ -1 +1,3 @@", + "+bar rescue nil", + "+foo rescue nil", + " foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ee82fb48f85e32423edfa0a919526c91bfbeeaa8..5fc770fcd3afd4e9e05dd73b4c22a126a9d2611c" +} +,{ + "testCaseDescription": "ruby-rescue-modifier2-delete-insert-test", + "expectedResult": { + "changes": { + "rescue-modifier2.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier in the 'rescue foo' modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier2.rb" + ], + "patch": [ + "diff --git a/rescue-modifier2.rb b/rescue-modifier2.rb", + "index 595bf2e..f59c8c2 100644", + "--- a/rescue-modifier2.rb", + "+++ b/rescue-modifier2.rb", + "@@ -1,3 +1,3 @@", + "-bar rescue nil", + "+foo rescue nil", + " foo rescue nil", + " foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5fc770fcd3afd4e9e05dd73b4c22a126a9d2611c..eb5e2ef6db48590b8048c005249ad24a0feea927" +} +,{ + "testCaseDescription": "ruby-rescue-modifier2-replacement-test", + "expectedResult": { + "changes": { + "rescue-modifier2.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in the 'rescue bar' modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier2.rb" + ], + "patch": [ + "diff --git a/rescue-modifier2.rb b/rescue-modifier2.rb", + "index f59c8c2..595bf2e 100644", + "--- a/rescue-modifier2.rb", + "+++ b/rescue-modifier2.rb", + "@@ -1,3 +1,3 @@", + "-foo rescue nil", + "+bar rescue nil", + " foo rescue nil", + " foo rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "eb5e2ef6db48590b8048c005249ad24a0feea927..628b24dadd23550504d8fcaa40bf5ef96ce13a42" +} +,{ + "testCaseDescription": "ruby-rescue-modifier2-delete-replacement-test", + "expectedResult": { + "changes": { + "rescue-modifier2.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'bar' rescue modifier" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Deleted the 'foo' rescue modifier" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 15 + ] + } + }, + "summary": "Added the 'bar' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier2.rb" + ], + "patch": [ + "diff --git a/rescue-modifier2.rb b/rescue-modifier2.rb", + "index 595bf2e..0d0f274 100644", + "--- a/rescue-modifier2.rb", + "+++ b/rescue-modifier2.rb", + "@@ -1,3 +1,2 @@", + "-bar rescue nil", + "-foo rescue nil", + " foo rescue nil", + "+bar rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "628b24dadd23550504d8fcaa40bf5ef96ce13a42..0dacf0b04c9289b166ec82719cc3471d783dfd84" +} +,{ + "testCaseDescription": "ruby-rescue-modifier2-delete-test", + "expectedResult": { + "changes": { + "rescue-modifier2.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'foo' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier2.rb" + ], + "patch": [ + "diff --git a/rescue-modifier2.rb b/rescue-modifier2.rb", + "index 0d0f274..f7b54a5 100644", + "--- a/rescue-modifier2.rb", + "+++ b/rescue-modifier2.rb", + "@@ -1,2 +1 @@", + "-foo rescue nil", + " bar rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0dacf0b04c9289b166ec82719cc3471d783dfd84..91834e2d3d2b453d304ec632da59c78c90284d01" +} +,{ + "testCaseDescription": "ruby-rescue-modifier2-delete-rest-test", + "expectedResult": { + "changes": { + "rescue-modifier2.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'bar' rescue modifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue-modifier2.rb" + ], + "patch": [ + "diff --git a/rescue-modifier2.rb b/rescue-modifier2.rb", + "index f7b54a5..e69de29 100644", + "--- a/rescue-modifier2.rb", + "+++ b/rescue-modifier2.rb", + "@@ -1 +0,0 @@", + "-bar rescue nil" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "91834e2d3d2b453d304ec632da59c78c90284d01..b616a75a1894341c88be0147f3d99ca16d223394" +}] diff --git a/test/corpus/diff-summaries/ruby/rescue.json b/test/corpus/diff-summaries/ruby/rescue.json new file mode 100644 index 000000000..bfc46b91a --- /dev/null +++ b/test/corpus/diff-summaries/ruby/rescue.json @@ -0,0 +1,246 @@ +[{ + "testCaseDescription": "ruby-rescue-setup-test", + "expectedResult": { + "changes": { + "rescue.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue.rb" + ], + "patch": [ + "diff --git a/rescue.rb b/rescue.rb", + "index e69de29..dbcd28c 100644", + "--- a/rescue.rb", + "+++ b/rescue.rb", + "@@ -0,0 +1,3 @@", + "+begin", + "+ foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "71e169c7a4f73c1796a93e0301458608ca7a8740..2fafd3decdd6810c860a906aac195c6eda4925ff" +} +,{ + "testCaseDescription": "ruby-rescue-insert-test", + "expectedResult": { + "changes": { + "rescue.rb": [ + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + } + }, + "summary": "Added the 'x' rescue block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue.rb" + ], + "patch": [ + "diff --git a/rescue.rb b/rescue.rb", + "index dbcd28c..fd1f6b9 100644", + "--- a/rescue.rb", + "+++ b/rescue.rb", + "@@ -1,3 +1,4 @@", + " begin", + " foo", + "+rescue x", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2fafd3decdd6810c860a906aac195c6eda4925ff..634539f058d588cb52ed208c6de612b9f1b1fe65" +} +,{ + "testCaseDescription": "ruby-rescue-replacement-test", + "expectedResult": { + "changes": { + "rescue.rb": [ + { + "span": { + "insert": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'bar' identifier in the 'x' rescue block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue.rb" + ], + "patch": [ + "diff --git a/rescue.rb b/rescue.rb", + "index fd1f6b9..e83ea4c 100644", + "--- a/rescue.rb", + "+++ b/rescue.rb", + "@@ -1,4 +1,5 @@", + " begin", + " foo", + " rescue x", + "+ bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "634539f058d588cb52ed208c6de612b9f1b1fe65..8c732514cd6ef0580bcd6bdfa2c2215b9221710e" +} +,{ + "testCaseDescription": "ruby-rescue-delete-replacement-test", + "expectedResult": { + "changes": { + "rescue.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the 'bar' identifier in the 'x' rescue block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue.rb" + ], + "patch": [ + "diff --git a/rescue.rb b/rescue.rb", + "index e83ea4c..fd1f6b9 100644", + "--- a/rescue.rb", + "+++ b/rescue.rb", + "@@ -1,5 +1,4 @@", + " begin", + " foo", + " rescue x", + "- bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8c732514cd6ef0580bcd6bdfa2c2215b9221710e..78e95be32431f82afae4cf23c545a55b8a5ae26c" +} +,{ + "testCaseDescription": "ruby-rescue-delete-insert-test", + "expectedResult": { + "changes": { + "rescue.rb": [ + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 1 + ] + } + }, + "summary": "Deleted the 'x' rescue block in a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue.rb" + ], + "patch": [ + "diff --git a/rescue.rb b/rescue.rb", + "index fd1f6b9..dbcd28c 100644", + "--- a/rescue.rb", + "+++ b/rescue.rb", + "@@ -1,4 +1,3 @@", + " begin", + " foo", + "-rescue x", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "78e95be32431f82afae4cf23c545a55b8a5ae26c..b4f2194009217999c1306089d05fb6d15d5c2b8f" +} +,{ + "testCaseDescription": "ruby-rescue-teardown-test", + "expectedResult": { + "changes": { + "rescue.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted a begin statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "rescue.rb" + ], + "patch": [ + "diff --git a/rescue.rb b/rescue.rb", + "index dbcd28c..e69de29 100644", + "--- a/rescue.rb", + "+++ b/rescue.rb", + "@@ -1,3 +0,0 @@", + "-begin", + "- foo", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b4f2194009217999c1306089d05fb6d15d5c2b8f..9bdc443bb96ee6977eaaa39b6329f334c5a9db48" +}] diff --git a/test/corpus/diff-summaries/ruby/return.json b/test/corpus/diff-summaries/ruby/return.json new file mode 100644 index 000000000..5e4bd8bda --- /dev/null +++ b/test/corpus/diff-summaries/ruby/return.json @@ -0,0 +1,323 @@ +[{ + "testCaseDescription": "ruby-return-insert-test", + "expectedResult": { + "changes": { + "return.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the 'foo' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return.rb" + ], + "patch": [ + "diff --git a/return.rb b/return.rb", + "index e69de29..c09b956 100644", + "--- a/return.rb", + "+++ b/return.rb", + "@@ -0,0 +1 @@", + "+return foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8eea35a3e05ea4b7a30d4998298c7b1a6b87698c..b9339c105ae303f7b45050664e73aa94d9745272" +} +,{ + "testCaseDescription": "ruby-return-replacement-insert-test", + "expectedResult": { + "changes": { + "return.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Added a return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Added the 'foo' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return.rb" + ], + "patch": [ + "diff --git a/return.rb b/return.rb", + "index c09b956..03af74c 100644", + "--- a/return.rb", + "+++ b/return.rb", + "@@ -1 +1,3 @@", + "+return", + "+return foo", + " return foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b9339c105ae303f7b45050664e73aa94d9745272..934abd9b623a902049dc864d654a5b9f42761b7b" +} +,{ + "testCaseDescription": "ruby-return-delete-insert-test", + "expectedResult": { + "changes": { + "return.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Added the 'foo' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return.rb" + ], + "patch": [ + "diff --git a/return.rb b/return.rb", + "index 03af74c..199a182 100644", + "--- a/return.rb", + "+++ b/return.rb", + "@@ -1,3 +1,3 @@", + "-return", + "+return foo", + " return foo", + " return foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "934abd9b623a902049dc864d654a5b9f42761b7b..b091ba211883792ced43e5fd4ee896c69a86b874" +} +,{ + "testCaseDescription": "ruby-return-replacement-test", + "expectedResult": { + "changes": { + "return.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return.rb" + ], + "patch": [ + "diff --git a/return.rb b/return.rb", + "index 199a182..03af74c 100644", + "--- a/return.rb", + "+++ b/return.rb", + "@@ -1,3 +1,3 @@", + "-return foo", + "+return", + " return foo", + " return foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b091ba211883792ced43e5fd4ee896c69a86b874..738efdc285d76855454d6a0416476d445d040c70" +} +,{ + "testCaseDescription": "ruby-return-delete-replacement-test", + "expectedResult": { + "changes": { + "return.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted a return statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 11 + ] + } + }, + "summary": "Deleted the 'foo' return statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added a return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return.rb" + ], + "patch": [ + "diff --git a/return.rb b/return.rb", + "index 03af74c..09606e9 100644", + "--- a/return.rb", + "+++ b/return.rb", + "@@ -1,3 +1,2 @@", + "-return", + "-return foo", + " return foo", + "+return" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "738efdc285d76855454d6a0416476d445d040c70..faa516566cc5156092d3ee9b79203dff2b16ff2d" +} +,{ + "testCaseDescription": "ruby-return-delete-test", + "expectedResult": { + "changes": { + "return.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 11 + ] + } + }, + "summary": "Deleted the 'foo' return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return.rb" + ], + "patch": [ + "diff --git a/return.rb b/return.rb", + "index 09606e9..a09c863 100644", + "--- a/return.rb", + "+++ b/return.rb", + "@@ -1,2 +1 @@", + "-return foo", + " return" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "faa516566cc5156092d3ee9b79203dff2b16ff2d..46d4e347f70b24699912859b2edb8179bc446aca" +} +,{ + "testCaseDescription": "ruby-return-delete-rest-test", + "expectedResult": { + "changes": { + "return.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 7 + ] + } + }, + "summary": "Deleted a return statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "return.rb" + ], + "patch": [ + "diff --git a/return.rb b/return.rb", + "index a09c863..e69de29 100644", + "--- a/return.rb", + "+++ b/return.rb", + "@@ -1 +0,0 @@", + "-return" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "46d4e347f70b24699912859b2edb8179bc446aca..841266de890d1219eaa5215b2aca4c745cedf11a" +}] diff --git a/test/corpus/diff-summaries/ruby/scope-operator.json b/test/corpus/diff-summaries/ruby/scope-operator.json new file mode 100644 index 000000000..22c086844 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/scope-operator.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-scope-operator-insert-test", + "expectedResult": { + "changes": { + "scope-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Added the 'Foo::bar' scope operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "scope-operator.rb" + ], + "patch": [ + "diff --git a/scope-operator.rb b/scope-operator.rb", + "index e69de29..4e91ae2 100644", + "--- a/scope-operator.rb", + "+++ b/scope-operator.rb", + "@@ -0,0 +1 @@", + "+Foo::bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "726c5239209936067e3f6dffc02450605d2658b4..d090b4ff26e85348c9f78dff449410f6a09f33b1" +} +,{ + "testCaseDescription": "ruby-scope-operator-replacement-insert-test", + "expectedResult": { + "changes": { + "scope-operator.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added the '::Bar' scope operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Added the 'Foo::bar' scope operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "scope-operator.rb" + ], + "patch": [ + "diff --git a/scope-operator.rb b/scope-operator.rb", + "index 4e91ae2..2b0b854 100644", + "--- a/scope-operator.rb", + "+++ b/scope-operator.rb", + "@@ -1 +1,3 @@", + "+::Bar", + "+Foo::bar", + " Foo::bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d090b4ff26e85348c9f78dff449410f6a09f33b1..ba0ac82e58709ff07d2644ba9a303fb8081554b0" +} +,{ + "testCaseDescription": "ruby-scope-operator-delete-insert-test", + "expectedResult": { + "changes": { + "scope-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the '::Bar' scope operator with the 'Foo::bar' scope operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "scope-operator.rb" + ], + "patch": [ + "diff --git a/scope-operator.rb b/scope-operator.rb", + "index 2b0b854..1370e7e 100644", + "--- a/scope-operator.rb", + "+++ b/scope-operator.rb", + "@@ -1,3 +1,3 @@", + "-::Bar", + "+Foo::bar", + " Foo::bar", + " Foo::bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ba0ac82e58709ff07d2644ba9a303fb8081554b0..3f5ce37d91641be96445be63e12cf533327beb08" +} +,{ + "testCaseDescription": "ruby-scope-operator-replacement-test", + "expectedResult": { + "changes": { + "scope-operator.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + ] + }, + "summary": "Replaced the 'Foo::bar' scope operator with the '::Bar' scope operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "scope-operator.rb" + ], + "patch": [ + "diff --git a/scope-operator.rb b/scope-operator.rb", + "index 1370e7e..2b0b854 100644", + "--- a/scope-operator.rb", + "+++ b/scope-operator.rb", + "@@ -1,3 +1,3 @@", + "-Foo::bar", + "+::Bar", + " Foo::bar", + " Foo::bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3f5ce37d91641be96445be63e12cf533327beb08..d435ce09f97187b196c19d0dc0c2528175dc2725" +} +,{ + "testCaseDescription": "ruby-scope-operator-delete-replacement-test", + "expectedResult": { + "changes": { + "scope-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the '::Bar' scope operator" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Deleted the 'Foo::bar' scope operator" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the '::Bar' scope operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "scope-operator.rb" + ], + "patch": [ + "diff --git a/scope-operator.rb b/scope-operator.rb", + "index 2b0b854..4c887f9 100644", + "--- a/scope-operator.rb", + "+++ b/scope-operator.rb", + "@@ -1,3 +1,2 @@", + "-::Bar", + "-Foo::bar", + " Foo::bar", + "+::Bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d435ce09f97187b196c19d0dc0c2528175dc2725..acce985a4a297612cc03d615ddbc94e108859643" +} +,{ + "testCaseDescription": "ruby-scope-operator-delete-test", + "expectedResult": { + "changes": { + "scope-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted the 'Foo::bar' scope operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "scope-operator.rb" + ], + "patch": [ + "diff --git a/scope-operator.rb b/scope-operator.rb", + "index 4c887f9..2618c39 100644", + "--- a/scope-operator.rb", + "+++ b/scope-operator.rb", + "@@ -1,2 +1 @@", + "-Foo::bar", + " ::Bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "acce985a4a297612cc03d615ddbc94e108859643..79ace4201fdcef36b901d38b19348c9b9c623bbd" +} +,{ + "testCaseDescription": "ruby-scope-operator-delete-rest-test", + "expectedResult": { + "changes": { + "scope-operator.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted the '::Bar' scope operator" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "scope-operator.rb" + ], + "patch": [ + "diff --git a/scope-operator.rb b/scope-operator.rb", + "index 2618c39..e69de29 100644", + "--- a/scope-operator.rb", + "+++ b/scope-operator.rb", + "@@ -1 +0,0 @@", + "-::Bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "79ace4201fdcef36b901d38b19348c9b9c623bbd..4be31ef5a0e1e38b38065b07de4afb42010387e1" +}] diff --git a/test/corpus/diff-summaries/ruby/singleton-class.json b/test/corpus/diff-summaries/ruby/singleton-class.json new file mode 100644 index 000000000..43de060c6 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/singleton-class.json @@ -0,0 +1,428 @@ +[{ + "testCaseDescription": "ruby-singleton-class-insert-test", + "expectedResult": { + "changes": { + "singleton-class.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'self' singleton class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-class.rb" + ], + "patch": [ + "diff --git a/singleton-class.rb b/singleton-class.rb", + "index e69de29..590cb5d 100644", + "--- a/singleton-class.rb", + "+++ b/singleton-class.rb", + "@@ -0,0 +1,3 @@", + "+class << self", + "+ foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5a0c5f74c27f2622ddce9d3c8b936ca4f8465bc3..f2f61d73782ecfc1e56390af63e2ccc73a3fa920" +} +,{ + "testCaseDescription": "ruby-singleton-class-replacement-insert-test", + "expectedResult": { + "changes": { + "singleton-class.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'Foo' singleton class" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'self' singleton class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-class.rb" + ], + "patch": [ + "diff --git a/singleton-class.rb b/singleton-class.rb", + "index 590cb5d..0e4dd17 100644", + "--- a/singleton-class.rb", + "+++ b/singleton-class.rb", + "@@ -1,3 +1,9 @@", + "+class << Foo", + "+ bar", + "+end", + "+class << self", + "+ foo", + "+end", + " class << self", + " foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f2f61d73782ecfc1e56390af63e2ccc73a3fa920..0f833bc1b36270e4d8aed6e34d7dfb229417faa4" +} +,{ + "testCaseDescription": "ruby-singleton-class-delete-insert-test", + "expectedResult": { + "changes": { + "singleton-class.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 14 + ] + } + ] + }, + "summary": "Replaced the 'Foo' identifier with the 'self' identifier in the self singleton class" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + }, + { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier in the self singleton class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-class.rb" + ], + "patch": [ + "diff --git a/singleton-class.rb b/singleton-class.rb", + "index 0e4dd17..ad3e3cd 100644", + "--- a/singleton-class.rb", + "+++ b/singleton-class.rb", + "@@ -1,5 +1,5 @@", + "-class << Foo", + "- bar", + "+class << self", + "+ foo", + " end", + " class << self", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0f833bc1b36270e4d8aed6e34d7dfb229417faa4..62b6faea97c969484d00d50d4bc8503c149f9aee" +} +,{ + "testCaseDescription": "ruby-singleton-class-replacement-test", + "expectedResult": { + "changes": { + "singleton-class.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 14 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced the 'self' identifier with the 'Foo' identifier in the Foo singleton class" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + }, + { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in the Foo singleton class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-class.rb" + ], + "patch": [ + "diff --git a/singleton-class.rb b/singleton-class.rb", + "index ad3e3cd..0e4dd17 100644", + "--- a/singleton-class.rb", + "+++ b/singleton-class.rb", + "@@ -1,5 +1,5 @@", + "-class << self", + "- foo", + "+class << Foo", + "+ bar", + " end", + " class << self", + " foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "62b6faea97c969484d00d50d4bc8503c149f9aee..5dfaa997376c8d6e8ef956bd8debd0f9a13c1805" +} +,{ + "testCaseDescription": "ruby-singleton-class-delete-replacement-test", + "expectedResult": { + "changes": { + "singleton-class.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' singleton class" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'self' singleton class" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'Foo' singleton class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-class.rb" + ], + "patch": [ + "diff --git a/singleton-class.rb b/singleton-class.rb", + "index 0e4dd17..487331f 100644", + "--- a/singleton-class.rb", + "+++ b/singleton-class.rb", + "@@ -1,9 +1,6 @@", + "-class << Foo", + "- bar", + "-end", + " class << self", + " foo", + " end", + "-class << self", + "- foo", + "+class << Foo", + "+ bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5dfaa997376c8d6e8ef956bd8debd0f9a13c1805..fb92710b032e59059fa07921b85351dbefdc47ca" +} +,{ + "testCaseDescription": "ruby-singleton-class-delete-test", + "expectedResult": { + "changes": { + "singleton-class.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'self' singleton class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-class.rb" + ], + "patch": [ + "diff --git a/singleton-class.rb b/singleton-class.rb", + "index 487331f..a3937d3 100644", + "--- a/singleton-class.rb", + "+++ b/singleton-class.rb", + "@@ -1,6 +1,3 @@", + "-class << self", + "- foo", + "-end", + " class << Foo", + " bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fb92710b032e59059fa07921b85351dbefdc47ca..f2e68b6768a7f2f7ae78d09eda20b276492045b9" +} +,{ + "testCaseDescription": "ruby-singleton-class-delete-rest-test", + "expectedResult": { + "changes": { + "singleton-class.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'Foo' singleton class" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-class.rb" + ], + "patch": [ + "diff --git a/singleton-class.rb b/singleton-class.rb", + "index a3937d3..e69de29 100644", + "--- a/singleton-class.rb", + "+++ b/singleton-class.rb", + "@@ -1,3 +0,0 @@", + "-class << Foo", + "- bar", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f2e68b6768a7f2f7ae78d09eda20b276492045b9..bc06c5994d9bcf120ff71c6dd145f5341d84cec3" +}] diff --git a/test/corpus/diff-summaries/ruby/singleton-method-declaration.json b/test/corpus/diff-summaries/ruby/singleton-method-declaration.json new file mode 100644 index 000000000..ce5b908fa --- /dev/null +++ b/test/corpus/diff-summaries/ruby/singleton-method-declaration.json @@ -0,0 +1,426 @@ +[{ + "testCaseDescription": "ruby-singleton-method-declaration-insert-test", + "expectedResult": { + "changes": { + "singleton-method-declaration.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'self.foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-method-declaration.rb" + ], + "patch": [ + "diff --git a/singleton-method-declaration.rb b/singleton-method-declaration.rb", + "index e69de29..caaf49d 100644", + "--- a/singleton-method-declaration.rb", + "+++ b/singleton-method-declaration.rb", + "@@ -0,0 +1,2 @@", + "+def self.foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "dc8f828fb183ed9f9c1e6bc2225fc072ba04d16b..7ec5ddaad7ca5c2617b47286e6dd01154f0864ea" +} +,{ + "testCaseDescription": "ruby-singleton-method-declaration-replacement-insert-test", + "expectedResult": { + "changes": { + "singleton-method-declaration.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'self.bar(a)' method" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'self.foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-method-declaration.rb" + ], + "patch": [ + "diff --git a/singleton-method-declaration.rb b/singleton-method-declaration.rb", + "index caaf49d..2393b4c 100644", + "--- a/singleton-method-declaration.rb", + "+++ b/singleton-method-declaration.rb", + "@@ -1,2 +1,7 @@", + "+def self.bar(a)", + "+ baz", + "+end", + "+def self.foo", + "+end", + " def self.foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7ec5ddaad7ca5c2617b47286e6dd01154f0864ea..d5dd261daf5f486d25bfdc4be255aad96bcff349" +} +,{ + "testCaseDescription": "ruby-singleton-method-declaration-delete-insert-test", + "expectedResult": { + "changes": { + "singleton-method-declaration.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier in the 'self.foo()' method" + }, + { + "span": { + "delete": { + "start": [ + 1, + 14 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Deleted the 'a' identifier in the 'self.foo()' method" + }, + { + "span": { + "delete": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'baz' identifier in the 'self.foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-method-declaration.rb" + ], + "patch": [ + "diff --git a/singleton-method-declaration.rb b/singleton-method-declaration.rb", + "index 2393b4c..44b0e0c 100644", + "--- a/singleton-method-declaration.rb", + "+++ b/singleton-method-declaration.rb", + "@@ -1,5 +1,4 @@", + "-def self.bar(a)", + "- baz", + "+def self.foo", + " end", + " def self.foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d5dd261daf5f486d25bfdc4be255aad96bcff349..9be301df5bd043c27ece14f9ea370518be524a3b" +} +,{ + "testCaseDescription": "ruby-singleton-method-declaration-replacement-test", + "expectedResult": { + "changes": { + "singleton-method-declaration.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 10 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in the 'self.bar(a)' method" + }, + { + "span": { + "insert": { + "start": [ + 1, + 14 + ], + "end": [ + 1, + 15 + ] + } + }, + "summary": "Added the 'a' identifier in the 'self.bar(a)' method" + }, + { + "span": { + "insert": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'baz' identifier in the 'self.bar(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-method-declaration.rb" + ], + "patch": [ + "diff --git a/singleton-method-declaration.rb b/singleton-method-declaration.rb", + "index 44b0e0c..2393b4c 100644", + "--- a/singleton-method-declaration.rb", + "+++ b/singleton-method-declaration.rb", + "@@ -1,4 +1,5 @@", + "-def self.foo", + "+def self.bar(a)", + "+ baz", + " end", + " def self.foo", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9be301df5bd043c27ece14f9ea370518be524a3b..ec0380330945735057c42d735389cd3e3e19645c" +} +,{ + "testCaseDescription": "ruby-singleton-method-declaration-delete-replacement-test", + "expectedResult": { + "changes": { + "singleton-method-declaration.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'self.bar(a)' method" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'self.foo()' method" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'self.bar(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-method-declaration.rb" + ], + "patch": [ + "diff --git a/singleton-method-declaration.rb b/singleton-method-declaration.rb", + "index 2393b4c..84f3a03 100644", + "--- a/singleton-method-declaration.rb", + "+++ b/singleton-method-declaration.rb", + "@@ -1,7 +1,5 @@", + "-def self.bar(a)", + "- baz", + "-end", + " def self.foo", + " end", + "-def self.foo", + "+def self.bar(a)", + "+ baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ec0380330945735057c42d735389cd3e3e19645c..9caba032307eb93717d1c08d5e01ddb3571efcf0" +} +,{ + "testCaseDescription": "ruby-singleton-method-declaration-delete-test", + "expectedResult": { + "changes": { + "singleton-method-declaration.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'self.foo()' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-method-declaration.rb" + ], + "patch": [ + "diff --git a/singleton-method-declaration.rb b/singleton-method-declaration.rb", + "index 84f3a03..8649965 100644", + "--- a/singleton-method-declaration.rb", + "+++ b/singleton-method-declaration.rb", + "@@ -1,5 +1,3 @@", + "-def self.foo", + "-end", + " def self.bar(a)", + " baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9caba032307eb93717d1c08d5e01ddb3571efcf0..0e43ebdc7453b47a1114fb4c95038938ab9fb544" +} +,{ + "testCaseDescription": "ruby-singleton-method-declaration-delete-rest-test", + "expectedResult": { + "changes": { + "singleton-method-declaration.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'self.bar(a)' method" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "singleton-method-declaration.rb" + ], + "patch": [ + "diff --git a/singleton-method-declaration.rb b/singleton-method-declaration.rb", + "index 8649965..e69de29 100644", + "--- a/singleton-method-declaration.rb", + "+++ b/singleton-method-declaration.rb", + "@@ -1,3 +0,0 @@", + "-def self.bar(a)", + "- baz", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0e43ebdc7453b47a1114fb4c95038938ab9fb544..bdea1962c3afcde91a03aede5401db0e943ab608" +}] diff --git a/test/corpus/diff-summaries/ruby/string.json b/test/corpus/diff-summaries/ruby/string.json new file mode 100644 index 000000000..08e4a19c6 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/string.json @@ -0,0 +1,538 @@ +[{ + "testCaseDescription": "ruby-string-insert-test", + "expectedResult": { + "changes": { + "string.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + } + }, + "summary": "Added the '' string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Added the 'foo with \"bar\"' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.rb" + ], + "patch": [ + "diff --git a/string.rb b/string.rb", + "index e69de29..8d1b50a 100644", + "--- a/string.rb", + "+++ b/string.rb", + "@@ -0,0 +1,2 @@", + "+''", + "+'foo with \"bar\"'" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a95a833cbc8cde4e219dbcc1ea4abfcbe688c968..8f91d5567669a1496009ce04e2d208c9837f75de" +} +,{ + "testCaseDescription": "ruby-string-replacement-insert-test", + "expectedResult": { + "changes": { + "string.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + } + }, + "summary": "Added the \"\" string" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Added the \"bar with 'foo'\" string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 3 + ] + } + }, + "summary": "Added the '' string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 17 + ] + } + }, + "summary": "Added the 'foo with \"bar\"' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.rb" + ], + "patch": [ + "diff --git a/string.rb b/string.rb", + "index 8d1b50a..f1597ee 100644", + "--- a/string.rb", + "+++ b/string.rb", + "@@ -1,2 +1,6 @@", + "+\"\"", + "+\"bar with 'foo'\"", + "+''", + "+'foo with \"bar\"'", + " ''", + " 'foo with \"bar\"'" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8f91d5567669a1496009ce04e2d208c9837f75de..afea84a635159c367546ef8a8e843dcce109960f" +} +,{ + "testCaseDescription": "ruby-string-delete-insert-test", + "expectedResult": { + "changes": { + "string.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + } + ] + }, + "summary": "Replaced the \"\" string with the '' string" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + ] + }, + "summary": "Replaced the \"bar with 'foo'\" string with the 'foo with \"bar\"' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.rb" + ], + "patch": [ + "diff --git a/string.rb b/string.rb", + "index f1597ee..6158c1a 100644", + "--- a/string.rb", + "+++ b/string.rb", + "@@ -1,5 +1,5 @@", + "-\"\"", + "-\"bar with 'foo'\"", + "+''", + "+'foo with \"bar\"'", + " ''", + " 'foo with \"bar\"'", + " ''" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "afea84a635159c367546ef8a8e843dcce109960f..8cf59aba7325b2a254992f185aecdfbe5040ac42" +} +,{ + "testCaseDescription": "ruby-string-replacement-test", + "expectedResult": { + "changes": { + "string.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + } + ] + }, + "summary": "Replaced the '' string with the \"\" string" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + ] + }, + "summary": "Replaced the 'foo with \"bar\"' string with the \"bar with 'foo'\" string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.rb" + ], + "patch": [ + "diff --git a/string.rb b/string.rb", + "index 6158c1a..f1597ee 100644", + "--- a/string.rb", + "+++ b/string.rb", + "@@ -1,5 +1,5 @@", + "-''", + "-'foo with \"bar\"'", + "+\"\"", + "+\"bar with 'foo'\"", + " ''", + " 'foo with \"bar\"'", + " ''" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8cf59aba7325b2a254992f185aecdfbe5040ac42..432d2eb041cf711646cc0b608d34697253e3b489" +} +,{ + "testCaseDescription": "ruby-string-delete-replacement-test", + "expectedResult": { + "changes": { + "string.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + } + }, + "summary": "Deleted the \"\" string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Deleted the \"bar with 'foo'\" string" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 3 + ] + } + }, + "summary": "Deleted the '' string" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 17 + ] + } + }, + "summary": "Deleted the 'foo with \"bar\"' string" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 3 + ] + } + }, + "summary": "Added the \"\" string" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 17 + ] + } + }, + "summary": "Added the \"bar with 'foo'\" string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.rb" + ], + "patch": [ + "diff --git a/string.rb b/string.rb", + "index f1597ee..b8be05c 100644", + "--- a/string.rb", + "+++ b/string.rb", + "@@ -1,6 +1,4 @@", + "-\"\"", + "-\"bar with 'foo'\"", + "-''", + "-'foo with \"bar\"'", + " ''", + " 'foo with \"bar\"'", + "+\"\"", + "+\"bar with 'foo'\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "432d2eb041cf711646cc0b608d34697253e3b489..306d99d7ead57910c112638c22ee883354bfdb05" +} +,{ + "testCaseDescription": "ruby-string-delete-test", + "expectedResult": { + "changes": { + "string.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + } + }, + "summary": "Deleted the '' string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Deleted the 'foo with \"bar\"' string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.rb" + ], + "patch": [ + "diff --git a/string.rb b/string.rb", + "index b8be05c..83e4a68 100644", + "--- a/string.rb", + "+++ b/string.rb", + "@@ -1,4 +1,2 @@", + "-''", + "-'foo with \"bar\"'", + " \"\"", + " \"bar with 'foo'\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "306d99d7ead57910c112638c22ee883354bfdb05..ede03311df3c28996a9dc06c17724ecd9ce5f6ab" +} +,{ + "testCaseDescription": "ruby-string-delete-rest-test", + "expectedResult": { + "changes": { + "string.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 3 + ] + } + }, + "summary": "Deleted the \"\" string" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 17 + ] + } + }, + "summary": "Deleted the \"bar with 'foo'\" string" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "string.rb" + ], + "patch": [ + "diff --git a/string.rb b/string.rb", + "index 83e4a68..e69de29 100644", + "--- a/string.rb", + "+++ b/string.rb", + "@@ -1,2 +0,0 @@", + "-\"\"", + "-\"bar with 'foo'\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "ede03311df3c28996a9dc06c17724ecd9ce5f6ab..57121851289086218aea914888bd04b3ab064716" +}] diff --git a/test/corpus/diff-summaries/ruby/subshell.json b/test/corpus/diff-summaries/ruby/subshell.json new file mode 100644 index 000000000..196d5f53c --- /dev/null +++ b/test/corpus/diff-summaries/ruby/subshell.json @@ -0,0 +1,347 @@ +[{ + "testCaseDescription": "ruby-subshell-insert-test", + "expectedResult": { + "changes": { + "subshell.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Added the `ls -la` subshell command" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subshell.rb" + ], + "patch": [ + "diff --git a/subshell.rb b/subshell.rb", + "index e69de29..169f84d 100644", + "--- a/subshell.rb", + "+++ b/subshell.rb", + "@@ -0,0 +1 @@", + "+`ls -la`" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "547ae1f08f791cd22ce19d39ca7f69371d9dbfab..3cb647ddbb95a1117188655bf9c4b83bdc252598" +} +,{ + "testCaseDescription": "ruby-subshell-replacement-insert-test", + "expectedResult": { + "changes": { + "subshell.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Added the `git status` subshell command" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Added the `ls -la` subshell command" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subshell.rb" + ], + "patch": [ + "diff --git a/subshell.rb b/subshell.rb", + "index 169f84d..4b279f6 100644", + "--- a/subshell.rb", + "+++ b/subshell.rb", + "@@ -1 +1,3 @@", + "+`git status`", + "+`ls -la`", + " `ls -la`" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3cb647ddbb95a1117188655bf9c4b83bdc252598..bda54f3c5cc6fd078213a9e06a7bfee20c03b85e" +} +,{ + "testCaseDescription": "ruby-subshell-delete-insert-test", + "expectedResult": { + "changes": { + "subshell.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the `git status` subshell command with the `ls -la` subshell command" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subshell.rb" + ], + "patch": [ + "diff --git a/subshell.rb b/subshell.rb", + "index 4b279f6..6781ff3 100644", + "--- a/subshell.rb", + "+++ b/subshell.rb", + "@@ -1,3 +1,3 @@", + "-`git status`", + "+`ls -la`", + " `ls -la`", + " `ls -la`" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "bda54f3c5cc6fd078213a9e06a7bfee20c03b85e..a320d5e5933860ad03eaca153132804fd4b136f5" +} +,{ + "testCaseDescription": "ruby-subshell-replacement-test", + "expectedResult": { + "changes": { + "subshell.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + ] + }, + "summary": "Replaced the `ls -la` subshell command with the `git status` subshell command" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subshell.rb" + ], + "patch": [ + "diff --git a/subshell.rb b/subshell.rb", + "index 6781ff3..4b279f6 100644", + "--- a/subshell.rb", + "+++ b/subshell.rb", + "@@ -1,3 +1,3 @@", + "-`ls -la`", + "+`git status`", + " `ls -la`", + " `ls -la`" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a320d5e5933860ad03eaca153132804fd4b136f5..841fc8b8073cff011610bb5eaab52627a2e6ef5b" +} +,{ + "testCaseDescription": "ruby-subshell-delete-replacement-test", + "expectedResult": { + "changes": { + "subshell.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the `git status` subshell command" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 9 + ] + } + }, + "summary": "Deleted the `ls -la` subshell command" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 13 + ] + } + }, + "summary": "Added the `git status` subshell command" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subshell.rb" + ], + "patch": [ + "diff --git a/subshell.rb b/subshell.rb", + "index 4b279f6..c695b4c 100644", + "--- a/subshell.rb", + "+++ b/subshell.rb", + "@@ -1,3 +1,2 @@", + "-`git status`", + "-`ls -la`", + " `ls -la`", + "+`git status`" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "841fc8b8073cff011610bb5eaab52627a2e6ef5b..8ac24778057cfed23a8b241014029ad76cb4a532" +} +,{ + "testCaseDescription": "ruby-subshell-delete-test", + "expectedResult": { + "changes": { + "subshell.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 9 + ] + } + }, + "summary": "Deleted the `ls -la` subshell command" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subshell.rb" + ], + "patch": [ + "diff --git a/subshell.rb b/subshell.rb", + "index c695b4c..acb0008 100644", + "--- a/subshell.rb", + "+++ b/subshell.rb", + "@@ -1,2 +1 @@", + "-`ls -la`", + " `git status`" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8ac24778057cfed23a8b241014029ad76cb4a532..5d80be3b90e06741b5acd6c407e0e37b04d72769" +} +,{ + "testCaseDescription": "ruby-subshell-delete-rest-test", + "expectedResult": { + "changes": { + "subshell.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 13 + ] + } + }, + "summary": "Deleted the `git status` subshell command" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "subshell.rb" + ], + "patch": [ + "diff --git a/subshell.rb b/subshell.rb", + "index acb0008..e69de29 100644", + "--- a/subshell.rb", + "+++ b/subshell.rb", + "@@ -1 +0,0 @@", + "-`git status`" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5d80be3b90e06741b5acd6c407e0e37b04d72769..254bef3dc300da92915a826e73d24917af88cf5d" +}] diff --git a/test/corpus/diff-summaries/ruby/symbol.json b/test/corpus/diff-summaries/ruby/symbol.json new file mode 100644 index 000000000..792e4537c --- /dev/null +++ b/test/corpus/diff-summaries/ruby/symbol.json @@ -0,0 +1,733 @@ +[{ + "testCaseDescription": "ruby-symbol-insert-test", + "expectedResult": { + "changes": { + "symbol.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the ':foo' symbol" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the ':'foo'' symbol" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added the ':\"foo\"' symbol" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "symbol.rb" + ], + "patch": [ + "diff --git a/symbol.rb b/symbol.rb", + "index e69de29..faa7b3e 100644", + "--- a/symbol.rb", + "+++ b/symbol.rb", + "@@ -0,0 +1,3 @@", + "+:foo", + "+:'foo'", + "+:\"foo\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "06e0c82cc4de92677af4b24443f616a6b3ddf682..4cddc55a2cfa1451ea4b9f3299687fb6f2d17b57" +} +,{ + "testCaseDescription": "ruby-symbol-replacement-insert-test", + "expectedResult": { + "changes": { + "symbol.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the ':bar' symbol" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Added the ':'bar'' symbol" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Added the ':\"bar\"' symbol" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added the ':foo' symbol" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Added the ':'foo'' symbol" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the ':\"foo\"' symbol" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "symbol.rb" + ], + "patch": [ + "diff --git a/symbol.rb b/symbol.rb", + "index faa7b3e..c4e6184 100644", + "--- a/symbol.rb", + "+++ b/symbol.rb", + "@@ -1,3 +1,9 @@", + "+:bar", + "+:'bar'", + "+:\"bar\"", + "+:foo", + "+:'foo'", + "+:\"foo\"", + " :foo", + " :'foo'", + " :\"foo\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4cddc55a2cfa1451ea4b9f3299687fb6f2d17b57..625405ef92bc13ff70876edc14fe7746e685d52c" +} +,{ + "testCaseDescription": "ruby-symbol-delete-insert-test", + "expectedResult": { + "changes": { + "symbol.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the ':foo' symbol" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the ':bar' symbol with the ':'foo'' symbol" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + ] + }, + "summary": "Replaced the ':'bar'' symbol with the ':\"foo\"' symbol" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the ':\"bar\"' symbol" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "symbol.rb" + ], + "patch": [ + "diff --git a/symbol.rb b/symbol.rb", + "index c4e6184..04cec42 100644", + "--- a/symbol.rb", + "+++ b/symbol.rb", + "@@ -1,6 +1,6 @@", + "-:bar", + "-:'bar'", + "-:\"bar\"", + "+:foo", + "+:'foo'", + "+:\"foo\"", + " :foo", + " :'foo'", + " :\"foo\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "625405ef92bc13ff70876edc14fe7746e685d52c..561a21dfe82a3f3e8fe6bd0b9ef5ec4d34b330bf" +} +,{ + "testCaseDescription": "ruby-symbol-replacement-test", + "expectedResult": { + "changes": { + "symbol.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Added the ':bar' symbol" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + }, + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + ] + }, + "summary": "Replaced the ':foo' symbol with the ':'bar'' symbol" + }, + { + "span": { + "replace": [ + { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + }, + { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + ] + }, + "summary": "Replaced the ':'foo'' symbol with the ':\"bar\"' symbol" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the ':\"foo\"' symbol" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "symbol.rb" + ], + "patch": [ + "diff --git a/symbol.rb b/symbol.rb", + "index 04cec42..c4e6184 100644", + "--- a/symbol.rb", + "+++ b/symbol.rb", + "@@ -1,6 +1,6 @@", + "-:foo", + "-:'foo'", + "-:\"foo\"", + "+:bar", + "+:'bar'", + "+:\"bar\"", + " :foo", + " :'foo'", + " :\"foo\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "561a21dfe82a3f3e8fe6bd0b9ef5ec4d34b330bf..7fd1800d1245cf683b63e6f929bdbf5ee774bfcc" +} +,{ + "testCaseDescription": "ruby-symbol-delete-replacement-test", + "expectedResult": { + "changes": { + "symbol.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the ':bar' symbol" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the ':'bar'' symbol" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the ':\"bar\"' symbol" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Deleted the ':foo' symbol" + }, + { + "span": { + "delete": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Deleted the ':'foo'' symbol" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Deleted the ':\"foo\"' symbol" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 4, + 5 + ] + } + }, + "summary": "Added the ':bar' symbol" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 5, + 7 + ] + } + }, + "summary": "Added the ':'bar'' symbol" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 7 + ] + } + }, + "summary": "Added the ':\"bar\"' symbol" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "symbol.rb" + ], + "patch": [ + "diff --git a/symbol.rb b/symbol.rb", + "index c4e6184..977ce1c 100644", + "--- a/symbol.rb", + "+++ b/symbol.rb", + "@@ -1,9 +1,6 @@", + "-:bar", + "-:'bar'", + "-:\"bar\"", + "-:foo", + "-:'foo'", + "-:\"foo\"", + " :foo", + " :'foo'", + " :\"foo\"", + "+:bar", + "+:'bar'", + "+:\"bar\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "7fd1800d1245cf683b63e6f929bdbf5ee774bfcc..e3c79211bca97f8397bc1e2bac9cb90ba883c614" +} +,{ + "testCaseDescription": "ruby-symbol-delete-test", + "expectedResult": { + "changes": { + "symbol.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the ':foo' symbol" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the ':'foo'' symbol" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the ':\"foo\"' symbol" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "symbol.rb" + ], + "patch": [ + "diff --git a/symbol.rb b/symbol.rb", + "index 977ce1c..2109e60 100644", + "--- a/symbol.rb", + "+++ b/symbol.rb", + "@@ -1,6 +1,3 @@", + "-:foo", + "-:'foo'", + "-:\"foo\"", + " :bar", + " :'bar'", + " :\"bar\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e3c79211bca97f8397bc1e2bac9cb90ba883c614..4b9ccaf76a8124b962bdff28dd27c92245936873" +} +,{ + "testCaseDescription": "ruby-symbol-delete-rest-test", + "expectedResult": { + "changes": { + "symbol.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 5 + ] + } + }, + "summary": "Deleted the ':bar' symbol" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 7 + ] + } + }, + "summary": "Deleted the ':'bar'' symbol" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 7 + ] + } + }, + "summary": "Deleted the ':\"bar\"' symbol" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "symbol.rb" + ], + "patch": [ + "diff --git a/symbol.rb b/symbol.rb", + "index 2109e60..e69de29 100644", + "--- a/symbol.rb", + "+++ b/symbol.rb", + "@@ -1,3 +0,0 @@", + "-:bar", + "-:'bar'", + "-:\"bar\"" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "4b9ccaf76a8124b962bdff28dd27c92245936873..a95a833cbc8cde4e219dbcc1ea4abfcbe688c968" +}] diff --git a/test/corpus/diff-summaries/ruby/ternary.json b/test/corpus/diff-summaries/ruby/ternary.json new file mode 100644 index 000000000..387d417f1 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/ternary.json @@ -0,0 +1,455 @@ +[{ + "testCaseDescription": "ruby-ternary-insert-test", + "expectedResult": { + "changes": { + "ternary.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Added the 'foo' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.rb" + ], + "patch": [ + "diff --git a/ternary.rb b/ternary.rb", + "index e69de29..cc46e6d 100644", + "--- a/ternary.rb", + "+++ b/ternary.rb", + "@@ -0,0 +1 @@", + "+foo ? case1 : case2" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "61d726641b460d2461b15149863a3c17583ca600..442884cd090a0d529cd409e905d3b7193921ab4f" +} +,{ + "testCaseDescription": "ruby-ternary-replacement-insert-test", + "expectedResult": { + "changes": { + "ternary.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Added the 'bar' ternary expression" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 20 + ] + } + }, + "summary": "Added the 'foo' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.rb" + ], + "patch": [ + "diff --git a/ternary.rb b/ternary.rb", + "index cc46e6d..44ee69e 100644", + "--- a/ternary.rb", + "+++ b/ternary.rb", + "@@ -1 +1,3 @@", + "+bar ? a : b", + "+foo ? case1 : case2", + " foo ? case1 : case2" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "442884cd090a0d529cd409e905d3b7193921ab4f..e2ee2433f89ef81a05b6bc88f5842c622dd345d9" +} +,{ + "testCaseDescription": "ruby-ternary-delete-insert-test", + "expectedResult": { + "changes": { + "ternary.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + ] + }, + "summary": "Replaced the 'bar' identifier with the 'foo' identifier in the 'foo' ternary expression" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + }, + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 12 + ] + } + ] + }, + "summary": "Replaced the 'a' identifier with the 'case1' identifier in the 'foo' ternary expression" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 11 + ], + "end": [ + 1, + 12 + ] + }, + { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 20 + ] + } + ] + }, + "summary": "Replaced the 'b' identifier with the 'case2' identifier in the 'foo' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.rb" + ], + "patch": [ + "diff --git a/ternary.rb b/ternary.rb", + "index 44ee69e..86614c8 100644", + "--- a/ternary.rb", + "+++ b/ternary.rb", + "@@ -1,3 +1,3 @@", + "-bar ? a : b", + "+foo ? case1 : case2", + " foo ? case1 : case2", + " foo ? case1 : case2" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e2ee2433f89ef81a05b6bc88f5842c622dd345d9..263afe3ce7c242e15454c99c5ef210cf1a5b3a3d" +} +,{ + "testCaseDescription": "ruby-ternary-replacement-test", + "expectedResult": { + "changes": { + "ternary.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + }, + { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 4 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'bar' identifier in the 'bar' ternary expression" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 12 + ] + }, + { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 8 + ] + } + ] + }, + "summary": "Replaced the 'case1' identifier with the 'a' identifier in the 'bar' ternary expression" + }, + { + "span": { + "replace": [ + { + "start": [ + 1, + 15 + ], + "end": [ + 1, + 20 + ] + }, + { + "start": [ + 1, + 11 + ], + "end": [ + 1, + 12 + ] + } + ] + }, + "summary": "Replaced the 'case2' identifier with the 'b' identifier in the 'bar' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.rb" + ], + "patch": [ + "diff --git a/ternary.rb b/ternary.rb", + "index 86614c8..44ee69e 100644", + "--- a/ternary.rb", + "+++ b/ternary.rb", + "@@ -1,3 +1,3 @@", + "-foo ? case1 : case2", + "+bar ? a : b", + " foo ? case1 : case2", + " foo ? case1 : case2" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "263afe3ce7c242e15454c99c5ef210cf1a5b3a3d..b6f8541f45333a924f4cfa88141afa8c6ef7acfe" +} +,{ + "testCaseDescription": "ruby-ternary-delete-replacement-test", + "expectedResult": { + "changes": { + "ternary.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the 'bar' ternary expression" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 20 + ] + } + }, + "summary": "Deleted the 'foo' ternary expression" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 12 + ] + } + }, + "summary": "Added the 'bar' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.rb" + ], + "patch": [ + "diff --git a/ternary.rb b/ternary.rb", + "index 44ee69e..1ce4e51 100644", + "--- a/ternary.rb", + "+++ b/ternary.rb", + "@@ -1,3 +1,2 @@", + "-bar ? a : b", + "-foo ? case1 : case2", + " foo ? case1 : case2", + "+bar ? a : b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b6f8541f45333a924f4cfa88141afa8c6ef7acfe..fb79871ad23f8531bb98c961c1c8389d462ab1ee" +} +,{ + "testCaseDescription": "ruby-ternary-delete-test", + "expectedResult": { + "changes": { + "ternary.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 20 + ] + } + }, + "summary": "Deleted the 'foo' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.rb" + ], + "patch": [ + "diff --git a/ternary.rb b/ternary.rb", + "index 1ce4e51..7f42328 100644", + "--- a/ternary.rb", + "+++ b/ternary.rb", + "@@ -1,2 +1 @@", + "-foo ? case1 : case2", + " bar ? a : b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fb79871ad23f8531bb98c961c1c8389d462ab1ee..b91b7da512d2f66ec043106a4c83d77b209b51f5" +} +,{ + "testCaseDescription": "ruby-ternary-delete-rest-test", + "expectedResult": { + "changes": { + "ternary.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 12 + ] + } + }, + "summary": "Deleted the 'bar' ternary expression" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "ternary.rb" + ], + "patch": [ + "diff --git a/ternary.rb b/ternary.rb", + "index 7f42328..e69de29 100644", + "--- a/ternary.rb", + "+++ b/ternary.rb", + "@@ -1 +0,0 @@", + "-bar ? a : b" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b91b7da512d2f66ec043106a4c83d77b209b51f5..c77901de054ed5c45b40b241fc96524cc738a471" +}] diff --git a/test/corpus/diff-summaries/ruby/unless.json b/test/corpus/diff-summaries/ruby/unless.json new file mode 100644 index 000000000..ab48bbc37 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/unless.json @@ -0,0 +1,484 @@ +[{ + "testCaseDescription": "ruby-unless-insert-test", + "expectedResult": { + "changes": { + "unless.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unless.rb" + ], + "patch": [ + "diff --git a/unless.rb b/unless.rb", + "index e69de29..dd4d758 100644", + "--- a/unless.rb", + "+++ b/unless.rb", + "@@ -0,0 +1,5 @@", + "+unless foo", + "+ bar", + "+else", + "+ bat", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "357b28a188fc8984427a1ae219edd194329ebebc..f6596cf98d549a1e3e2ac25a77362d482b476458" +} +,{ + "testCaseDescription": "ruby-unless-replacement-insert-test", + "expectedResult": { + "changes": { + "unless.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'x' unless statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'y' unless statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 9, + 4 + ] + } + }, + "summary": "Added the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unless.rb" + ], + "patch": [ + "diff --git a/unless.rb b/unless.rb", + "index dd4d758..6e36f98 100644", + "--- a/unless.rb", + "+++ b/unless.rb", + "@@ -1,3 +1,12 @@", + "+unless x", + "+end", + "+unless y then", + "+end", + "+unless foo", + "+ bar", + "+else", + "+ bat", + "+end", + " unless foo", + " bar", + " else" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f6596cf98d549a1e3e2ac25a77362d482b476458..0796c4db9a02c9d509fba5bb5578579c26ca208e" +} +,{ + "testCaseDescription": "ruby-unless-delete-insert-test", + "expectedResult": { + "changes": { + "unless.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + }, + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 11 + ] + } + ] + }, + "summary": "Replaced the 'x' identifier with the 'foo' identifier in the foo unless statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'bar' identifier in the foo unless statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Added the 'bat' identifier in the foo unless statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'y' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unless.rb" + ], + "patch": [ + "diff --git a/unless.rb b/unless.rb", + "index 6e36f98..39ae1f8 100644", + "--- a/unless.rb", + "+++ b/unless.rb", + "@@ -1,6 +1,7 @@", + "-unless x", + "-end", + "-unless y then", + "+unless foo", + "+ bar", + "+else", + "+ bat", + " end", + " unless foo", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "0796c4db9a02c9d509fba5bb5578579c26ca208e..8d26795e47a5c15f2ee58d7c538bab796e665cc0" +} +,{ + "testCaseDescription": "ruby-unless-replacement-test", + "expectedResult": { + "changes": { + "unless.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 11 + ] + }, + { + "start": [ + 1, + 8 + ], + "end": [ + 1, + 9 + ] + } + ] + }, + "summary": "Replaced the 'foo' identifier with the 'x' identifier in the x unless statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'bar' identifier in the x unless statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 3 + ], + "end": [ + 4, + 6 + ] + } + }, + "summary": "Deleted the 'bat' identifier in the x unless statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'y' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unless.rb" + ], + "patch": [ + "diff --git a/unless.rb b/unless.rb", + "index 39ae1f8..6e36f98 100644", + "--- a/unless.rb", + "+++ b/unless.rb", + "@@ -1,7 +1,6 @@", + "-unless foo", + "- bar", + "-else", + "- bat", + "+unless x", + "+end", + "+unless y then", + " end", + " unless foo", + " bar" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8d26795e47a5c15f2ee58d7c538bab796e665cc0..e01bba435089dd562c2d4d2c1df933bbf9dca394" +} +,{ + "testCaseDescription": "ruby-unless-delete-replacement-test", + "expectedResult": { + "changes": { + "unless.rb": [ + { + "span": { + "delete": { + "start": [ + 10, + 1 + ], + "end": [ + 14, + 4 + ] + } + }, + "summary": "Deleted the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unless.rb" + ], + "patch": [ + "diff --git a/unless.rb b/unless.rb", + "index 6e36f98..5efe10d 100644", + "--- a/unless.rb", + "+++ b/unless.rb", + "@@ -1,14 +1,9 @@", + "-unless x", + "-end", + "-unless y then", + "-end", + " unless foo", + " bar", + " else", + " bat", + " end", + "-unless foo", + "- bar", + "-else", + "- bat", + "+unless x", + "+end", + "+unless y then", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e01bba435089dd562c2d4d2c1df933bbf9dca394..a58cb96220ee18dec530a7fef4e48770f71fb7ad" +} +,{ + "testCaseDescription": "ruby-unless-delete-test", + "expectedResult": { + "changes": { + "unless.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'foo' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unless.rb" + ], + "patch": [ + "diff --git a/unless.rb b/unless.rb", + "index 5efe10d..a38714d 100644", + "--- a/unless.rb", + "+++ b/unless.rb", + "@@ -1,8 +1,3 @@", + "-unless foo", + "- bar", + "-else", + "- bat", + "-end", + " unless x", + " end", + " unless y then" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a58cb96220ee18dec530a7fef4e48770f71fb7ad..1400142fb553734a8696c28d12c1bb119942d82d" +} +,{ + "testCaseDescription": "ruby-unless-delete-rest-test", + "expectedResult": { + "changes": { + "unless.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'x' unless statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'y' unless statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "unless.rb" + ], + "patch": [ + "diff --git a/unless.rb b/unless.rb", + "index a38714d..e69de29 100644", + "--- a/unless.rb", + "+++ b/unless.rb", + "@@ -1,4 +0,0 @@", + "-unless x", + "-end", + "-unless y then", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1400142fb553734a8696c28d12c1bb119942d82d..83f860d780243e3aae7889d9d0c3d7452d096ea9" +}] diff --git a/test/corpus/diff-summaries/ruby/until.json b/test/corpus/diff-summaries/ruby/until.json new file mode 100644 index 000000000..cb94119ac --- /dev/null +++ b/test/corpus/diff-summaries/ruby/until.json @@ -0,0 +1,442 @@ +[{ + "testCaseDescription": "ruby-until-insert-test", + "expectedResult": { + "changes": { + "until.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo' until statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 15 + ] + } + }, + "summary": "Added the 'done' until statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "until.rb" + ], + "patch": [ + "diff --git a/until.rb b/until.rb", + "index e69de29..2785b0d 100644", + "--- a/until.rb", + "+++ b/until.rb", + "@@ -0,0 +1,3 @@", + "+until foo do", + "+end", + "+foo until done" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a0c4cf7b826995415501949766d0401aa940c1a2..8ed4d535ed1791490a38e8eed846254264c82cb5" +} +,{ + "testCaseDescription": "ruby-until-replacement-insert-test", + "expectedResult": { + "changes": { + "until.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'foo' until statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'foo' until statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 15 + ] + } + }, + "summary": "Added the 'done' until statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "until.rb" + ], + "patch": [ + "diff --git a/until.rb b/until.rb", + "index 2785b0d..7c5868e 100644", + "--- a/until.rb", + "+++ b/until.rb", + "@@ -1,3 +1,9 @@", + "+until foo", + "+ bar", + "+end", + "+until foo do", + "+end", + "+foo until done", + " until foo do", + " end", + " foo until done" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8ed4d535ed1791490a38e8eed846254264c82cb5..13ce3160d52238b6157d0e71bf2579f5f5e61a7c" +} +,{ + "testCaseDescription": "ruby-until-delete-insert-test", + "expectedResult": { + "changes": { + "until.rb": [ + { + "span": { + "delete": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 15 + ] + } + }, + "summary": "Added the 'done' until statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "until.rb" + ], + "patch": [ + "diff --git a/until.rb b/until.rb", + "index 7c5868e..c51b0d0 100644", + "--- a/until.rb", + "+++ b/until.rb", + "@@ -1,6 +1,6 @@", + "-until foo", + "- bar", + "+until foo do", + " end", + "+foo until done", + " until foo do", + " end", + " foo until done" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "13ce3160d52238b6157d0e71bf2579f5f5e61a7c..bb0403985aaa6ffc0b21398a54f3aac6d662f5e9" +} +,{ + "testCaseDescription": "ruby-until-replacement-test", + "expectedResult": { + "changes": { + "until.rb": [ + { + "span": { + "insert": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'bar' identifier" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 15 + ] + } + }, + "summary": "Deleted the 'done' until statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "until.rb" + ], + "patch": [ + "diff --git a/until.rb b/until.rb", + "index c51b0d0..7c5868e 100644", + "--- a/until.rb", + "+++ b/until.rb", + "@@ -1,6 +1,6 @@", + "-until foo do", + "+until foo", + "+ bar", + " end", + "-foo until done", + " until foo do", + " end", + " foo until done" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "bb0403985aaa6ffc0b21398a54f3aac6d662f5e9..39c3955fab176eccca3f9ddb8bf25a43b306fefb" +} +,{ + "testCaseDescription": "ruby-until-delete-replacement-test", + "expectedResult": { + "changes": { + "until.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'foo' until statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'foo' until statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 15 + ] + } + }, + "summary": "Deleted the 'done' until statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'foo' until statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "until.rb" + ], + "patch": [ + "diff --git a/until.rb b/until.rb", + "index 7c5868e..c543483 100644", + "--- a/until.rb", + "+++ b/until.rb", + "@@ -1,9 +1,6 @@", + "-until foo", + "- bar", + "-end", + " until foo do", + " end", + " foo until done", + "-until foo do", + "+until foo", + "+ bar", + " end", + "-foo until done" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "39c3955fab176eccca3f9ddb8bf25a43b306fefb..5e1d5265ce16b57c2dac61edb2be131fd3643bd8" +} +,{ + "testCaseDescription": "ruby-until-delete-test", + "expectedResult": { + "changes": { + "until.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo' until statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 15 + ] + } + }, + "summary": "Deleted the 'done' until statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "until.rb" + ], + "patch": [ + "diff --git a/until.rb b/until.rb", + "index c543483..347b5ff 100644", + "--- a/until.rb", + "+++ b/until.rb", + "@@ -1,6 +1,3 @@", + "-until foo do", + "-end", + "-foo until done", + " until foo", + " bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "5e1d5265ce16b57c2dac61edb2be131fd3643bd8..8a5767c57adb0b2062f68c0e1a6a6fecccb2730d" +} +,{ + "testCaseDescription": "ruby-until-delete-rest-test", + "expectedResult": { + "changes": { + "until.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'foo' until statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "until.rb" + ], + "patch": [ + "diff --git a/until.rb b/until.rb", + "index 347b5ff..e69de29 100644", + "--- a/until.rb", + "+++ b/until.rb", + "@@ -1,3 +0,0 @@", + "-until foo", + "- bar", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "8a5767c57adb0b2062f68c0e1a6a6fecccb2730d..895ec09c6b1830368e488d03e9bdef18e730e946" +}] diff --git a/test/corpus/diff-summaries/ruby/when-else.json b/test/corpus/diff-summaries/ruby/when-else.json new file mode 100644 index 000000000..a8f7562b3 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/when-else.json @@ -0,0 +1,274 @@ +[{ + "testCaseDescription": "ruby-when-else-setup-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "patch": [ + "diff --git a/when-else.rb b/when-else.rb", + "index e69de29..3c8eff2 100644", + "--- a/when-else.rb", + "+++ b/when-else.rb", + "@@ -0,0 +1,4 @@", + "+case foo", + "+when bar", + "+ baz", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "cf6833ca26f4455afe60e15692ddae7fd4ff5e0c..da33ffa25ccabeae85270041fcc5b4fc6a995bba" +} +,{ + "testCaseDescription": "ruby-when-else-insert-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 1 + ] + } + }, + "summary": "Added an else block in the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "patch": [ + "diff --git a/when-else.rb b/when-else.rb", + "index 3c8eff2..fb2be92 100644", + "--- a/when-else.rb", + "+++ b/when-else.rb", + "@@ -1,4 +1,5 @@", + " case foo", + " when bar", + " baz", + "+else", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "da33ffa25ccabeae85270041fcc5b4fc6a995bba..54dbbb50ec36d384e2b7a56553eb2de63ca51fc7" +} +,{ + "testCaseDescription": "ruby-when-else-replacement-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 1 + ] + }, + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 6 + ] + } + ] + }, + "summary": "Replaced an else block with the 'qoz' identifier in the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "patch": [ + "diff --git a/when-else.rb b/when-else.rb", + "index fb2be92..028bb59 100644", + "--- a/when-else.rb", + "+++ b/when-else.rb", + "@@ -2,4 +2,5 @@ case foo", + " when bar", + " baz", + " else", + "+ qoz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "54dbbb50ec36d384e2b7a56553eb2de63ca51fc7..fe2530c37ccc44a2e20aad7a5ade675bc71eff5e" +} +,{ + "testCaseDescription": "ruby-when-else-delete-replacement-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "replace": [ + { + "start": [ + 5, + 3 + ], + "end": [ + 5, + 6 + ] + }, + { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 1 + ] + } + ] + }, + "summary": "Replaced the 'qoz' identifier with an else block in the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "patch": [ + "diff --git a/when-else.rb b/when-else.rb", + "index 028bb59..fb2be92 100644", + "--- a/when-else.rb", + "+++ b/when-else.rb", + "@@ -2,5 +2,4 @@ case foo", + " when bar", + " baz", + " else", + "- qoz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "fe2530c37ccc44a2e20aad7a5ade675bc71eff5e..1e98f00ead1893edd7a2d8de1780c55f36c3a30e" +} +,{ + "testCaseDescription": "ruby-when-else-delete-insert-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 1 + ] + } + }, + "summary": "Deleted an else block in the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "patch": [ + "diff --git a/when-else.rb b/when-else.rb", + "index fb2be92..3c8eff2 100644", + "--- a/when-else.rb", + "+++ b/when-else.rb", + "@@ -1,5 +1,4 @@", + " case foo", + " when bar", + " baz", + "-else", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "1e98f00ead1893edd7a2d8de1780c55f36c3a30e..010837029e2d69ca5f6b2cc7f814cf276ce76880" +} +,{ + "testCaseDescription": "ruby-when-else-teardown-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "patch": [ + "diff --git a/when-else.rb b/when-else.rb", + "index 3c8eff2..e69de29 100644", + "--- a/when-else.rb", + "+++ b/when-else.rb", + "@@ -1,4 +0,0 @@", + "-case foo", + "-when bar", + "- baz", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "010837029e2d69ca5f6b2cc7f814cf276ce76880..03a751d043f1bc44ab9eae085bfde59af2495a68" +}] diff --git a/test/corpus/diff-summaries/ruby/when.json b/test/corpus/diff-summaries/ruby/when.json new file mode 100644 index 000000000..14cdba64e --- /dev/null +++ b/test/corpus/diff-summaries/ruby/when.json @@ -0,0 +1,276 @@ +[{ + "testCaseDescription": "ruby-when-setup-test", + "expectedResult": { + "changes": {}, + "errors": { + "when.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Added 'case foo\nend\n' at line 1, column 1 - line 3, column 1" + } + ] + } + }, + "filePaths": [ + "when.rb" + ], + "patch": [ + "diff --git a/when.rb b/when.rb", + "index e69de29..ee23477 100644", + "--- a/when.rb", + "+++ b/when.rb", + "@@ -0,0 +1,2 @@", + "+case foo", + "+end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b616a75a1894341c88be0147f3d99ca16d223394..f9bea87667a8ec91e3c34de65d5b65ba5c63a57e" +} +,{ + "testCaseDescription": "ruby-when-insert-test", + "expectedResult": { + "changes": { + "when.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": { + "when.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Deleted 'case foo\nend\n' at line 1, column 1 - line 3, column 1" + } + ] + } + }, + "filePaths": [ + "when.rb" + ], + "patch": [ + "diff --git a/when.rb b/when.rb", + "index ee23477..92a40ca 100644", + "--- a/when.rb", + "+++ b/when.rb", + "@@ -1,2 +1,3 @@", + " case foo", + "+when bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f9bea87667a8ec91e3c34de65d5b65ba5c63a57e..23fe86c51ddffc6f48e6466ff80bf55cfa7f9950" +} +,{ + "testCaseDescription": "ruby-when-replacement-test", + "expectedResult": { + "changes": { + "when.rb": [ + { + "span": { + "insert": { + "start": [ + 3, + 3 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Added the 'baz' identifier in the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when.rb" + ], + "patch": [ + "diff --git a/when.rb b/when.rb", + "index 92a40ca..3c8eff2 100644", + "--- a/when.rb", + "+++ b/when.rb", + "@@ -1,3 +1,4 @@", + " case foo", + " when bar", + "+ baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "23fe86c51ddffc6f48e6466ff80bf55cfa7f9950..a7e74f5bb4d08cc500503009907944d048013aa1" +} +,{ + "testCaseDescription": "ruby-when-delete-replacement-test", + "expectedResult": { + "changes": { + "when.rb": [ + { + "span": { + "delete": { + "start": [ + 3, + 3 + ], + "end": [ + 3, + 6 + ] + } + }, + "summary": "Deleted the 'baz' identifier in the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when.rb" + ], + "patch": [ + "diff --git a/when.rb b/when.rb", + "index 3c8eff2..92a40ca 100644", + "--- a/when.rb", + "+++ b/when.rb", + "@@ -1,4 +1,3 @@", + " case foo", + " when bar", + "- baz", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "a7e74f5bb4d08cc500503009907944d048013aa1..3a7ae1a603a12a75857442cfe9f57f07830b260a" +} +,{ + "testCaseDescription": "ruby-when-delete-insert-test", + "expectedResult": { + "changes": { + "when.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + } + ] + }, + "errors": { + "when.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Added 'case foo\nend\n' at line 1, column 1 - line 3, column 1" + } + ] + } + }, + "filePaths": [ + "when.rb" + ], + "patch": [ + "diff --git a/when.rb b/when.rb", + "index 92a40ca..ee23477 100644", + "--- a/when.rb", + "+++ b/when.rb", + "@@ -1,3 +1,2 @@", + " case foo", + "-when bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3a7ae1a603a12a75857442cfe9f57f07830b260a..253f6a600cd1e4a83701e6d776d937f562eb867c" +} +,{ + "testCaseDescription": "ruby-when-teardown-test", + "expectedResult": { + "changes": {}, + "errors": { + "when.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 1 + ] + } + }, + "summary": "Deleted 'case foo\nend\n' at line 1, column 1 - line 3, column 1" + } + ] + } + }, + "filePaths": [ + "when.rb" + ], + "patch": [ + "diff --git a/when.rb b/when.rb", + "index ee23477..e69de29 100644", + "--- a/when.rb", + "+++ b/when.rb", + "@@ -1,2 +0,0 @@", + "-case foo", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "253f6a600cd1e4a83701e6d776d937f562eb867c..cf6833ca26f4455afe60e15692ddae7fd4ff5e0c" +}] diff --git a/test/corpus/diff-summaries/ruby/while.json b/test/corpus/diff-summaries/ruby/while.json new file mode 100644 index 000000000..b908fc84e --- /dev/null +++ b/test/corpus/diff-summaries/ruby/while.json @@ -0,0 +1,442 @@ +[{ + "testCaseDescription": "ruby-while-insert-test", + "expectedResult": { + "changes": { + "while.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Added the 'foo' while statement" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 14 + ] + } + }, + "summary": "Added the 'run' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while.rb" + ], + "patch": [ + "diff --git a/while.rb b/while.rb", + "index e69de29..9990bdf 100644", + "--- a/while.rb", + "+++ b/while.rb", + "@@ -0,0 +1,3 @@", + "+while foo do", + "+end", + "+foo while run" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "200e3134bd9ce6dc71cbcece1a66fbfe3d3268de..f2ce21f4f708084c77a14e167d1f95d65f1a6252" +} +,{ + "testCaseDescription": "ruby-while-replacement-insert-test", + "expectedResult": { + "changes": { + "while.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Added the 'foo' while statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'foo' while statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 14 + ] + } + }, + "summary": "Added the 'run' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while.rb" + ], + "patch": [ + "diff --git a/while.rb b/while.rb", + "index 9990bdf..5a24260 100644", + "--- a/while.rb", + "+++ b/while.rb", + "@@ -1,3 +1,9 @@", + "+while foo", + "+ bar", + "+end", + "+while foo do", + "+end", + "+foo while run", + " while foo do", + " end", + " foo while run" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f2ce21f4f708084c77a14e167d1f95d65f1a6252..191c663e18128d184dd98db1619206b02c8e4d18" +} +,{ + "testCaseDescription": "ruby-while-delete-insert-test", + "expectedResult": { + "changes": { + "while.rb": [ + { + "span": { + "delete": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Deleted the 'bar' identifier" + }, + { + "span": { + "insert": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 14 + ] + } + }, + "summary": "Added the 'run' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while.rb" + ], + "patch": [ + "diff --git a/while.rb b/while.rb", + "index 5a24260..c0c26cd 100644", + "--- a/while.rb", + "+++ b/while.rb", + "@@ -1,6 +1,6 @@", + "-while foo", + "- bar", + "+while foo do", + " end", + "+foo while run", + " while foo do", + " end", + " foo while run" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "191c663e18128d184dd98db1619206b02c8e4d18..3c40c479e428877c1a5d3624139f33fc300326d8" +} +,{ + "testCaseDescription": "ruby-while-replacement-test", + "expectedResult": { + "changes": { + "while.rb": [ + { + "span": { + "insert": { + "start": [ + 2, + 3 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added the 'bar' identifier" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 14 + ] + } + }, + "summary": "Deleted the 'run' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while.rb" + ], + "patch": [ + "diff --git a/while.rb b/while.rb", + "index c0c26cd..5a24260 100644", + "--- a/while.rb", + "+++ b/while.rb", + "@@ -1,6 +1,6 @@", + "-while foo do", + "+while foo", + "+ bar", + " end", + "-foo while run", + " while foo do", + " end", + " foo while run" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "3c40c479e428877c1a5d3624139f33fc300326d8..d80bed2229bd0392204940a562f810bcd8097532" +} +,{ + "testCaseDescription": "ruby-while-delete-replacement-test", + "expectedResult": { + "changes": { + "while.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'foo' while statement" + }, + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'foo' while statement" + }, + { + "span": { + "delete": { + "start": [ + 6, + 1 + ], + "end": [ + 6, + 14 + ] + } + }, + "summary": "Deleted the 'run' while statement" + }, + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'foo' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while.rb" + ], + "patch": [ + "diff --git a/while.rb b/while.rb", + "index 5a24260..3763a72 100644", + "--- a/while.rb", + "+++ b/while.rb", + "@@ -1,9 +1,6 @@", + "-while foo", + "- bar", + "-end", + " while foo do", + " end", + " foo while run", + "-while foo do", + "+while foo", + "+ bar", + " end", + "-foo while run" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "d80bed2229bd0392204940a562f810bcd8097532..2e6dde21263f7ced8d6b72a48b272b1b9f2a795e" +} +,{ + "testCaseDescription": "ruby-while-delete-test", + "expectedResult": { + "changes": { + "while.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 2, + 4 + ] + } + }, + "summary": "Deleted the 'foo' while statement" + }, + { + "span": { + "delete": { + "start": [ + 3, + 1 + ], + "end": [ + 3, + 14 + ] + } + }, + "summary": "Deleted the 'run' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while.rb" + ], + "patch": [ + "diff --git a/while.rb b/while.rb", + "index 3763a72..57e673b 100644", + "--- a/while.rb", + "+++ b/while.rb", + "@@ -1,6 +1,3 @@", + "-while foo do", + "-end", + "-foo while run", + " while foo", + " bar", + " end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "2e6dde21263f7ced8d6b72a48b272b1b9f2a795e..53d0cdc0718463cf322c512f331d861d68c74d24" +} +,{ + "testCaseDescription": "ruby-while-delete-rest-test", + "expectedResult": { + "changes": { + "while.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 3, + 4 + ] + } + }, + "summary": "Deleted the 'foo' while statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "while.rb" + ], + "patch": [ + "diff --git a/while.rb b/while.rb", + "index 57e673b..e69de29 100644", + "--- a/while.rb", + "+++ b/while.rb", + "@@ -1,3 +0,0 @@", + "-while foo", + "- bar", + "-end" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "53d0cdc0718463cf322c512f331d861d68c74d24..a0c4cf7b826995415501949766d0401aa940c1a2" +}] diff --git a/test/corpus/diff-summaries/ruby/yield.json b/test/corpus/diff-summaries/ruby/yield.json new file mode 100644 index 000000000..bc9a9c5fa --- /dev/null +++ b/test/corpus/diff-summaries/ruby/yield.json @@ -0,0 +1,323 @@ +[{ + "testCaseDescription": "ruby-yield-insert-test", + "expectedResult": { + "changes": { + "yield.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'foo' yield statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.rb" + ], + "patch": [ + "diff --git a/yield.rb b/yield.rb", + "index e69de29..a1e1b84 100644", + "--- a/yield.rb", + "+++ b/yield.rb", + "@@ -0,0 +1 @@", + "+yield foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "841266de890d1219eaa5215b2aca4c745cedf11a..14f2ed935f5bf93302c58e8256b1584dc842c7b5" +} +,{ + "testCaseDescription": "ruby-yield-replacement-insert-test", + "expectedResult": { + "changes": { + "yield.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Added a yield statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Added the 'foo' yield statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.rb" + ], + "patch": [ + "diff --git a/yield.rb b/yield.rb", + "index a1e1b84..2f5c2c5 100644", + "--- a/yield.rb", + "+++ b/yield.rb", + "@@ -1 +1,3 @@", + "+yield", + "+yield foo", + " yield foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "14f2ed935f5bf93302c58e8256b1584dc842c7b5..eed349475b35f04fd07e0bdf964303de0933be79" +} +,{ + "testCaseDescription": "ruby-yield-delete-insert-test", + "expectedResult": { + "changes": { + "yield.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Added the 'foo' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.rb" + ], + "patch": [ + "diff --git a/yield.rb b/yield.rb", + "index 2f5c2c5..8e68f90 100644", + "--- a/yield.rb", + "+++ b/yield.rb", + "@@ -1,3 +1,3 @@", + "-yield", + "+yield foo", + " yield foo", + " yield foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "eed349475b35f04fd07e0bdf964303de0933be79..9c1cd41d0d451075ea39af1f2c1b48e0d8809b2d" +} +,{ + "testCaseDescription": "ruby-yield-replacement-test", + "expectedResult": { + "changes": { + "yield.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 7 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'foo' identifier" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.rb" + ], + "patch": [ + "diff --git a/yield.rb b/yield.rb", + "index 8e68f90..2f5c2c5 100644", + "--- a/yield.rb", + "+++ b/yield.rb", + "@@ -1,3 +1,3 @@", + "-yield foo", + "+yield", + " yield foo", + " yield foo" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "9c1cd41d0d451075ea39af1f2c1b48e0d8809b2d..b5d3946ea08d26d5000d7885f24b5ffc7f6e0216" +} +,{ + "testCaseDescription": "ruby-yield-delete-replacement-test", + "expectedResult": { + "changes": { + "yield.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted a yield statement" + }, + { + "span": { + "delete": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 10 + ] + } + }, + "summary": "Deleted the 'foo' yield statement" + }, + { + "span": { + "insert": { + "start": [ + 2, + 1 + ], + "end": [ + 2, + 6 + ] + } + }, + "summary": "Added a yield statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.rb" + ], + "patch": [ + "diff --git a/yield.rb b/yield.rb", + "index 2f5c2c5..324b0fe 100644", + "--- a/yield.rb", + "+++ b/yield.rb", + "@@ -1,3 +1,2 @@", + "-yield", + "-yield foo", + " yield foo", + "+yield" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "b5d3946ea08d26d5000d7885f24b5ffc7f6e0216..e1b95dea3025a4f4a0a45745e2466cb5236b3cde" +} +,{ + "testCaseDescription": "ruby-yield-delete-test", + "expectedResult": { + "changes": { + "yield.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 10 + ] + } + }, + "summary": "Deleted the 'foo' yield statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.rb" + ], + "patch": [ + "diff --git a/yield.rb b/yield.rb", + "index 324b0fe..fcd1a85 100644", + "--- a/yield.rb", + "+++ b/yield.rb", + "@@ -1,2 +1 @@", + "-yield foo", + " yield" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "e1b95dea3025a4f4a0a45745e2466cb5236b3cde..f35b987fc87909a85061f50be7a9bd49524df381" +} +,{ + "testCaseDescription": "ruby-yield-delete-rest-test", + "expectedResult": { + "changes": { + "yield.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 1, + 6 + ] + } + }, + "summary": "Deleted a yield statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "yield.rb" + ], + "patch": [ + "diff --git a/yield.rb b/yield.rb", + "index fcd1a85..e69de29 100644", + "--- a/yield.rb", + "+++ b/yield.rb", + "@@ -1 +0,0 @@", + "-yield" + ], + "gitDir": "test/corpus/repos/ruby", + "shas": "f35b987fc87909a85061f50be7a9bd49524df381..200e3134bd9ce6dc71cbcece1a66fbfe3d3268de" +}] diff --git a/test/corpus/generated/go.json b/test/corpus/generated/go.json new file mode 100644 index 000000000..f33b653af --- /dev/null +++ b/test/corpus/generated/go.json @@ -0,0 +1,345 @@ +[ + { + "repoUrl": "https://github.com/diff-summaries/go.git", + "language": "go", + "fileExt": ".go", + "syntaxes": [ + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "single-import-declarations", + "insert": "import \"net/http\"\nimport . \"some/dsl\"\nimport alias \"some/package\"", + "replacement": "import \"foo/bar\"\nimport . \"types/dsl\"\nimport alias \"awesome/packages\"" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "grouped-import-declarations", + "insert": "import (\n\"net/http\"\n . \"some/dsl\"\n alias \"some/package\"\n)", + "replacement": "import (\n\"net/socket\"\n . \"types/dsl\"\n alias \"awesome/package\"\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "int-literals", + "insert": "const (\na = 1, b = 2, c = 3\n)", + "replacement": "const (\na = 4, b = 5, c = 6\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "assignment-statements", + "insert": "a = 1\nb, c += 2, 3\nd *= 3\ne += 1", + "replacement": "x = 1\ny, c += 2, 3\nz *= 3\nh += 1" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "if-statements", + "insert": "if a() {\nb()\n}\nif a := b(); c {\nd()\n}\nif a() {\nb()\n} else {\nc()\n}", + "replacement": "if x() {\nb()\n}\nif y := b(); c {\nd()\n}\nif z() {\nb()\n} else {\nc()\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "short-var-declarations", + "insert": "a, b := 1, 2", + "replacement": "x, y := 3, 4" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "call-expressions", + "insert": "x(b, c...)\ny(b, c,)\nz(b,c...,)", + "replacement": "a(b, c...)\nb(b, c,)\nc(b,c...,)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "function-literals", + "insert": "const s1 = func(s string) (int, int) {\nreturn 1, 2\n}", + "replacement": "const s1 = func(b int) (string, string) {\nreturn 1, 2\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "const-declarations-without-types", + "insert": "const zero = 0", + "replacement": "const one, two = 1, 2" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "const-declarations-with-types", + "insert": "const zero int = 0", + "replacement": "const one, two uiint64 = 1, 2" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "var-declarations-without-types", + "insert": "var zero = 0", + "replacement": "var one, two = 1, 2" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "var-declarations-with-types", + "insert": "var zero int = 0\nvar one, two uint64 = 1, 2", + "replacement": "var a int = 0\n var b, c uint64 = 1, 2" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "var-declarations-with-no-expressions", + "insert": "var zero int\nvar one, two uint64", + "replacement": "var a int\nvar b, c uint64" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "grouped-var-declarations", + "insert": "var (\nzero = 0\none = 1\n)", + "replacement": "var (\na = 0\nb = 1\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "switch-statements", + "insert": "switch { case x < y: f1()\ncase x < z: g()\ncase x == 4: h()\n}", + "replacement": "switch { case a < b: f1()\ncase c < d: g()\ncase e == 4: f()\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "type-switch-statements", + "insert": "switch e.(type) {\n case []Person:\n a()\n case *Dog:\n break\n}", + "replacement": "switch b.(type) {\n case []Person:\n a()\n case *Dog:\n break\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "select-statements", + "insert": "select {\n case x := <-c:\n println(x)\n case y <- c:\n println(5)\n case <-time.After(1):\n println(6)\n default:\n return\n}", + "replacement": "select {\n case a := <-c:\n println(x)\n case b <- c:\n println(5)\n case <-time.After(2):\n println(6)\n default:\n return\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "go-and-defer-statements", + "insert": "defer x.y()\ngo x.y()", + "replacement": "defer a.b()\ngo c.d()" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "label-statements", + "insert": "{\n insert_label:\n}", + "replacement": "{\n replacement_label:\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "for-statements", + "insert": " for {\na()\ngoto loop\n}\nfor i := 0; i < 5; i++ {\na()\nbreak loop\n}\nfor ; i < 10; i++ {\na()\ncontinue loop2\n}\nfor ;; {\na()\ncontinue\n}\nfor x := range y {\na(x)\nbreak\n}", + "replacement": " for ;; {\na()\ngoto loop\n}\nfor x := range y {\na()\nbreak loop\n}\nfor ;; {\na()\ncontinue loop2\n}\nfor ; i < 10; i++ {\na()\ncontinue\n}\nfor {\na(x)\nbreak\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "function-declarations", + "insert": "func f1() {}\nfunc f2(a int, b, c, d string) int {}\nfunc f2() (int, error) {}\nfunc f2() (result int, err error) {}", + "replacement": "func fa() {}\nfunc fb(a int, b, c, d string) int {}\nfunc fc() (int, error) {}\nfunc fd() (result int, err error) {}" + }, + { + "template": "package main\n\nfunc main() {\n\n}\n\n{0}", + "syntax": "single-line-function-declarations", + "insert": "func f1() { a() }\nfunc f2() { a(); b() }\nfunc f3() { a(); b(); }", + "replacement": "func g1() { a() }\nfunc g2() { a(); b() }\nfunc g3() { a(); b(); }" + }, + { + "syntax": "variadic-function-declarations", + "template": "package main\n\nfunc main() {\n\n}\n{0}", + "insert": "func f1(a ...*int) {}\nfunc f2(...int) {}\nfunc f3(a, ...bool) {}", + "replacement": "func g1(a ...*int) {}\nfunc g2(...int) {}\nfunc g3(a, ...bool) {}" + }, + { + "template": "package main\n\nfunc main() {}\n\n{0}", + "syntax": "method-declarations", + "insert": "func (self Person) Equals(other Person) bool {}", + "replacement": "func (self Num) Equals(other Num) bool {}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "type-declarations", + "insert": "type a b\ntype (\n a b\n c d\n)", + "replacement": "type x y\ntype (\n x y\n e f\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "const-with-implicit-values", + "insert": "const (\n zero = iota\n one\n two\n )", + "replacement": "const (\n a = iota\n b\n c\n )" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "constructors", + "insert": "make(chan<- int)\nmake(chan<- int, (new - old))\nmake(chan<- int, 5, 10)\n new(map[string]string)", + "replacement": "make(chan<- string)\nmake(chan<- string, (new - old))\nmake(chan<- string, 7, 11)\n new(map[int]int)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "selector-expressions", + "insert": "a.b.c()", + "replacement": "x.y.z()" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "indexing-expressions", + "insert": "a[1]\n b[:]\n c[1:]\n d[1:2]\n e[:2:3]\n f[1:2:3]", + "replacement": "z[:2]\n y[:1]\n x[1:]\n d[1:2]\n e[:2:3]\n f[1:2:3]" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "type-assertion-expressions", + "insert": "x.(z.Person)", + "replacement": "b.(c.Dog)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "type-conversion-expressions", + "insert": "[]a.b(c.d)\n ([]a.b)(c.d)\n e.f(g)\n (e.f)(g)", + "replacement": "[]x.y(z.e)\n ([]f.g)(h.i)\n j.k(l)\n (m.n)(o)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "unary-expressions", + "insert": "!<-a\n*foo()", + "replacement": "!<-b\n*bar()" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "float-literals", + "insert": "f1 = 1.5\nf2 = 1.5e100\nf3 = 1.5e+50\nf4 = 1.5e-5\nf5 = .5e-50", + "replacement": "f1 = 2.6\nf2 = 2.6e211\nf3 = 2.6e+60\nf4 = 2.6e-7\nf5 = .6e-60" + }, + { + "template": "package main\n{0}", + "syntax": "rune-literals", + "insert": "const (\n a = 'δ'\n b = '⌘'\n c = '⌘'\n d = '⌘'\n e = '⌘'\n f = '⌘'\n)", + "replacement": "const (\n a = '©'\n b = '©'\n c = '©'\n d = '©'\n e = '©'\n f = '©'\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "imaginary-literals", + "insert": "const (\na = 01i\nb = 1.e+100i\n)", + "replacement": "const (\na = 02i\nb = 1.e+103i\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "string-literals", + "insert": "const (\na = \"0\"\nb = \"hello world\"\n)", + "replacement": "const (\na = \"2\"\nb = \"hi\"\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "slice-literals", + "insert": "const s1 = []string{}\nconst s2 = []string{\"hi\"}\nconst s3 = []string{\n\"hi\",\n \"hello\",\n}", + "replacement": "const s1 = []string{\"sup\"}\nconst s2 = []string{\"hello\"}\nconst s3 = []string{\n\"bar\",\n \"baz\",\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "array-with-implicit-length", + "insert": "const a1 = [...]int{1, 2, 3}", + "replacement": "const a1 = [...]int{4,5,6}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "map-literals", + "insert": "const s = map[string]string{\n\"hi\": \"hello\",\n\"bye\": \"goodbye\",\n}", + "replacement": "const s = map[string]int{\n\"foo\": \"bar\",\n\"baz\": \"hello\",\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "struct-literals", + "insert": "const s1 = Person{\nname: \"Frank\",\nAge: \"5 months\",\n}\nconst s2 = struct{i int;}{i: 5}\nconst s3 = time.Time{}", + "replacement": "const s1 = Dog{\nname: \"Frank\",\nAge: \"5 months\",\n}\nconst s2 = struct{i float;}{j: 6}\nconst s3 = time.Month{}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "send-statements", + "insert": "foo <- 5", + "replacement": "bar <- 6" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "increment-decrement-statements", + "insert": "i++\nj--", + "replacement": "foo++\nx++" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "qualified-types", + "insert": "type a b.c", + "replacement": "type x y.z" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "array-types", + "insert": "type a [2+2]x", + "replacement": "type a [1+1]y" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "slice-types", + "insert": "type a []b\ntype c [][]d", + "replacement": "type a [][]p\ntype c []y" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "struct-types", + "insert": "type s1 struct {}\ntype s2 struct { Person }\ntype s3 struct {\nf, g int\n}\ntype s4 struct {\np.s1\n h int `json:\"h\"`\n}", + "replacement": "type t1 struct {}\ntype t2 struct { Person }\ntype t3 struct {\nf, g int\n}\ntype t4 struct {\np.s1\n h int `json:\"h\"`\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "interface-types", + "insert": "type i1 interface {}\ntype i2 interface { io.Reader }\ntype i3 interface {\ni1\nio.Reader\n SomeMethod(s string) error\n}", + "replacement": "type j1 interface {}\ntype j2 interface { io.Reader }\ntype j3 interface {\ni1\nio.Reader\n SomeMethod(s string) error\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "map-types", + "insert": "type m1 map[string]error", + "replacement": "type m1 map[int]error" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "pointer-types", + "insert": "type (\np1 *string\np2 **p1\n)", + "replacement": "type (\np1 *int\np2 **p3\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "channel-types", + "insert": "type (\nc1 chan<- chan int\nc2 chan<- chan<- struct{}\nc3 chan<- <-chan int\n)", + "replacement": "type (\nc2 chan<- chan string\nc3 chan<- chan<- struct{}\nc4 chan<- <-chan string\n)" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "function-types", + "insert": "type (\na func(int) int\nb func(int, string) (bool, error)\n)", + "replacement": "type (\nx func(string) string\ny func(string, int) (chan, error)\n)" + }, + { + "template": "package main\n\nfunc main() {\n}\n\n{0}", + "syntax": "parameter-declarations-with-types", + "insert": "func foo(a int, b string) {\n}", + "replacement": "func foo(x string, y uint64) {\n}" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "case-statements", + "insert": "switch { }", + "replacement": "switch { case foo: f1() }" + }, + { + "template": "package main\n\nfunc main() {\n type s3 struct {{0}} \n}", + "syntax": "struct-field-declarations", + "insert": "\n g int\n", + "replacement": "\n h, i int\n" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "comment", + "insert": "// this is a comment", + "replacement": "/*\nthis is a block comment\n*/" + }, + { + "template": "package main\n\nfunc main() {\n{0}\n}", + "syntax": "modifying-struct-fields", + "insert": "ctx := &uploadContext{\n Remote: remote\n}", + "replacement": "ctx := &uploadContext{\n trackedLocksMu: new(sync.Mutex)\n}" + } + ] + } +] diff --git a/test/corpus/generated/javascript.json b/test/corpus/generated/javascript.json new file mode 100644 index 000000000..83b68863b --- /dev/null +++ b/test/corpus/generated/javascript.json @@ -0,0 +1,332 @@ +[ + { + "language": "javascript", + "fileExt": ".js", + "repoUrl": "https://github.com/diff-fixtures/javascript.git", + "syntaxes": [ + { + "syntax": "object", + "insert": "{ \"key1\": \"value1\" };", + "replacement": "{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };" + }, + { + "syntax": "anonymous-function", + "insert": "function(a,b) { return a + b; }", + "replacement": "function(b,c) { return b * c; }" + }, + { + "syntax": "anonymous-parameterless-function", + "insert": "function() { return 'hi'; }", + "replacement": "function() { return 'hello'; }" + }, + { + "syntax": "objects-with-methods", + "insert": "{ add(a, b) { return a + b; } };", + "replacement": "{ subtract(a, b) { return a - b; } };" + }, + { + "syntax": "string", + "insert": "'A string with \"double\" quotes';", + "replacement": "'A different string with \"double\" quotes';" + }, + { + "syntax": "number", + "insert": "101", + "replacement": "102" + }, + { + "syntax": "variable", + "insert": "theVar;", + "replacement": "theVar2" + }, + { + "syntax": "identifier", + "insert": "theVar;", + "replacement": "theVar2" + }, + { + "syntax": "this-expression", + "insert": "this;", + "replacement": "return this;" + }, + { + "syntax": "null", + "insert": "null;", + "replacement": "return null;" + }, + { + "syntax": "undefined", + "insert": "undefined;", + "replacement": "return undefined;" + }, + { + "syntax": "true", + "insert": "true;", + "replacement": "return true;" + }, + { + "syntax": "false", + "insert": "false;", + "replacement": "return false;" + }, + { + "syntax": "class", + "insert": "class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + "replacement": "class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }" + }, + { + "syntax": "array", + "insert": "[ \"item1\" ];", + "replacement": "[ \"item1\", \"item2\" ];" + }, + { + "syntax": "function", + "insert": "function(arg1, arg2) { arg2; };", + "replacement": "function(arg1, arg2) { arg1; };" + }, + { + "syntax": "arrow-function", + "insert": "(f, g) => { return h; };", + "replacement": "(f, g) => { return g; };" + }, + { + "syntax": "generator-function", + "insert": "function *generateStuff(arg1, arg2) { yield; yield arg2; };", + "replacement": "function *generateNewStuff(arg1, arg2) { yield; yield arg2; };" + }, + { + "syntax": "named-function", + "insert": "function myFunction(arg1, arg2) { arg2; };", + "replacement": "function anotherFunction() { return false; };" + }, + { + "syntax": "member-access", + "insert": "x.someProperty;", + "replacement": "x.someOtherProperty" + }, + { + "syntax": "subscript-access-variable", + "insert": "x[someVariable];", + "replacement": "x[someOtherVariable];" + }, + { + "syntax": "subscript-access-string", + "insert": "x[\"some-string\"];", + "replacement": "x[\"some-other-string\"];" + }, + { + "syntax": "chained-property-access", + "insert": "return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + "replacement": "return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )" + }, + { + "syntax": "chained-callbacks", + "insert": "this.map(function (a) { return a.b; })", + "replacement": "this.reduce(function (a) { return b.a; })" + }, + { + "syntax": "function-call", + "insert": "someFunction(arg1, \"arg2\");", + "replacement": "someFunction(arg1, \"arg3\");" + }, + { + "syntax": "method-call", + "insert": "object.someMethod(arg1, \"arg2\");", + "replacement": "object.someMethod(arg1, \"arg3\");" + }, + { + "syntax": "function-call-args", + "insert": "someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + "replacement": "someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)" + }, + { + "syntax": "constructor-call", + "insert": "new module.Klass(1, \"two\");", + "replacement": "new module.Klass(1, \"three\");" + }, + { + "syntax": "math-operator", + "insert": "i + j * 3 - j % 5;", + "replacement": "i + j * 2 - j % 4;" + }, + { + "syntax": "boolean-operator", + "insert": "i || j;", + "replacement": "i && j;" + }, + { + "syntax": "bitwise-operator", + "insert": "i >> j;", + "replacement": "i >> k;" + }, + { + "syntax": "relational-operator", + "insert": "x < y;", + "replacement": "x <= y;" + }, + { + "syntax": "for-statement", + "insert": "for (i = 0, init(); i < 10; i++) { log(i); }", + "replacement": "for (i = 0, init(); i < 100; i++) { log(i); }" + }, + { + "syntax": "assignment", + "insert": "x = 0;", + "replacement": "x = 1;" + }, + { + "syntax": "member-access-assignment", + "insert": "y.x = 0;", + "replacement": "y.x = 1;" + }, + { + "syntax": "subscript-access-assignment", + "insert": "y[\"x\"] = 0;", + "replacement": "y[\"x\"] = 1;" + }, + { + "syntax": "comma-operator", + "insert": "a = 1, b = 2;", + "replacement": "c = {d: (3, 4 + 5, 6)};" + }, + { + "syntax": "ternary", + "insert": "condition ? case1 : case2;", + "replacement": "x.y = some.condition ? some.case : some.other.case;" + }, + { + "syntax": "type-operator", + "insert": "typeof x;", + "replacement": "x instanceof String;" + }, + { + "syntax": "delete-operator", + "insert": "delete thing['prop'];", + "replacement": "delete thing.prop" + }, + { + "syntax": "void-operator", + "insert": "void b()", + "replacement": "void c()" + }, + { + "syntax": "math-assignment-operator", + "insert": "x += 1;", + "replacement": "x += 2;" + }, + { + "syntax": "for-loop-with-in-statement", + "insert": "for (key in something && i = 0; i < n; i++) { doSomething(); }", + "replacement": "for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }" + }, + { + "syntax": "for-of-statement", + "insert": "for (let item of items) { process(item); };", + "replacement": "for (let thing of things) { process(thing); };" + }, + { + "syntax": "while-statement", + "insert": "while (a) { b(); };", + "replacement": "while (b) { a(); };" + }, + { + "syntax": "do-while-statement", + "insert": "do { console.log(insert); } while (true);", + "replacement": "do { console.log(replacement); } while (false);" + }, + { + "syntax": "return-statement", + "insert": "return 5;", + "replacement": "return;" + }, + { + "syntax": "var-declaration", + "insert": "var x = 1;", + "replacement": "var x, y = {}, z;" + }, + { + "syntax": "comment", + "insert": "// This is a property", + "replacement": "/*\n * This is a method\n*/" + }, + { + "syntax": "switch-statement", + "insert": "switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + "replacement": "switch (2) { case 1: 1; case 2: 2; case 3: 3; };" + }, + { + "syntax": "throw-statement", + "insert": "throw new Error(\"uh oh\");", + "replacement": "throw new Error(\"oooooops\");" + }, + { + "syntax": "try-statement", + "insert": "try { f; } catch { g; } finally { h; };", + "replacement": "try { f; } catch { h; } finally { g; };" + }, + { + "syntax": "regex", + "insert": "/one/g;", + "replacement": "/on[^/]afe/gim;" + }, + { + "syntax": "if", + "insert": "if (x) { log(y); }", + "replacement": "if (a.b) { log(c); d; }" + }, + { + "syntax": "if-else", + "insert": "if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + "replacement": "if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o" + }, + { + "syntax": "template-string", + "insert": "`one line`", + "replacement": "`multi line`" + }, + { + "syntax": "for-in-statement", + "insert": "for (thing in things) { thing(); }", + "replacement": "for (item in items) { item(); }" + }, + { + "syntax": "nested-functions", + "insert": "function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + "replacement": "function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }" + }, + { + "syntax": "nested-do-while-in-function", + "insert": "function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + "replacement": "function f(arg1, arg2) { do { something(arg2); } while (arg1); }" + }, + { + "syntax": "import", + "insert": "import defaultMember from \"foo\";\nimport * as name from \"aardvark\";\nimport { member } from \"ant\";\nimport { member1 , member2 } from \"antelope\";\nimport { member1 , member2 as alias2 } from \"ant-eater\";\nimport defaultMember, { member1, member2 as alias2 } from \"anaconda\";\nimport defaultMember, * as name from \"alligator\";\nimport \"arctic-tern\";", + "replacement": "import defaultMember from \"babirusa\";\nimport * as otherName from \"baboon\";\nimport { element } from \"badger\";\nimport { element1 , element2 } from \"bald-eagle\";\nimport { element1 , element2 as elementAlias2 } from \"bandicoot\";\nimport defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";\nimport defaultMember, * as element from \"barbet\";\nimport \"basilisk\";" + }, + { + "syntax": "export", + "insert": "export { name1, name2, name3, nameN };\nexport { variable1 as name1, variable2 as name2, nameN };\nexport let name1, name2, nameN;\nexport let name1 = value1, name2 = value2, name3, nameN;\nexport default namedFunction;\nexport default function () { };\nexport default function name1() { };\nexport { name1 as default };\nexport * from 'foo';\nexport { name1, name2, nameN } from 'foo';\nexport { import1 as name1, import2 as name2, nameN } from 'bar';", + "replacement": "export { name4, name5, name6, nameZ };\nexport { variable2 as name2, variable3 as name3, nameY };\nexport let name3, name4, nameT;\nexport let name2 = value2, name3 = value3, name4, nameO;\nexport default otherNamedFunction;\nexport default function newName1() {};\nexport default function () {};\nexport { name2 as statement };\nexport * from 'baz';\nexport { name7, name8, nameP } from 'buzz';\nexport { import6 as name6, import7 as name7, nameB } from 'fizz';" + }, + { + "syntax": "break", + "insert": "break;", + "replacement": "continue;", + "template": "for (i = 0; i < 10; i++) { if (i === 4) { {0} }; i }" + }, + { + "syntax": "continue", + "insert": "continue;", + "replacement": "break;", + "template": "for (i = 0; i < 10; i++) { if (i === 4) { {0} }; i }" + }, + { + "syntax": "yield", + "insert": "yield i;", + "replacement": "yield i++;", + "template": "function* foo(){ var index = 0; {0} }" + } + ] + } +] diff --git a/test/corpus/generated/ruby.json b/test/corpus/generated/ruby.json new file mode 100644 index 000000000..d33444720 --- /dev/null +++ b/test/corpus/generated/ruby.json @@ -0,0 +1,307 @@ +[ + { + "language": "ruby", + "fileExt": ".rb", + "repoUrl": "https://github.com/diff-fixtures/ruby.git", + "syntaxes": [ + { + "syntax": "assignment", + "insert": "x = 0", + "replacement": "x = 1" + }, + { + "syntax": "comment", + "insert": "# This is a comment", + "replacement": "=begin\nThis is a multiline\ncomment\n=end" + }, + { + "syntax": "number", + "insert": "1234\n1_234\n0d1_234\n0xa_bcd_ef0_123_456_789\n0o1234567\n0b1_0\n1.234_5e678_90\n", + "replacement": "1235\n1_235\n0d1_235\n0xa_bcd_ef0_123_456_788\n0o1234576\n0b1_1\n1.234_5e678_91\n" + }, + { + "syntax": "symbol", + "insert": ":foo\n:'foo'\n:\"foo\"", + "replacement": ":bar\n:'bar'\n:\"bar\"" + }, + { + "syntax": "string", + "insert": "''\n'foo with \"bar\"'", + "replacement": "\"\"\n\"bar with 'foo'\"" + }, + { + "syntax": "interpolation", + "insert": ":\"foo #{bar}\"\n\"foo #{bar}\"", + "replacement": ":\"bar #{foo}\"\n\"bar #{foo}\"" + }, + { + "syntax": "delimiter", + "insert": "%q#a#\n%qc>\n%#a#\n%Q#a#\n%c>\n%Qc>", + "replacement": "%q/b/\n%q{d{e}f}\n%/b/\n%Q/b/\n%{d{e}f}\n%Q{d{e}f}" + }, + { + "syntax": "math-assignment", + "insert": "x += 1\nx -= 1\nx *= 1\nx /= 1\nx **= 1", + "replacement": "x+= 2\nx -= 1\nx *= 1\nx /= 1\nx **= 1" + }, + { + "syntax": "conditional-assignment", + "insert": "x ||= 5", + "replacement": "x &&= 7" + }, + { + "syntax": "multiple-assignments", + "insert": "x, y, z = [10, 20, 30]", + "replacement": "x, *y = [10, 20, 30]" + }, + { + "syntax": "pseudo-variables", + "insert": "nil\nself\nfalse\ntrue", + "replacement": "self\nNIL\nTRUE\nFALSE" + }, + { + "syntax": "subshell", + "insert": "`ls -la`", + "replacement": "`git status`" + }, + { + "syntax": "hash", + "insert": "{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }", + "replacement": "{ key1: \"changed value\", key2: 2, key3: true }" + }, + { + "syntax": "boolean-operator", + "insert": "a || b", + "replacement": "a && b" + }, + { + "syntax": "relational-operator", + "insert": "x == y\nx != y\nx === y", + "replacement": "x <=> y\nx =~ y\nx =! y" + }, + { + "syntax": "comparision-operator", + "insert": "x < y\na > b", + "replacement": "x <= y\na >= b" + }, + { + "syntax": "bitwise-operator", + "insert": "a | b\na >> b\na ^ b", + "replacement": "a & b\na << b" + }, + { + "syntax": "ternary", + "insert": "foo ? case1 : case2", + "replacement": "bar ? a : b" + }, + { + "syntax": "method-declaration", + "insert": "def foo\nend", + "replacement": "def bar(a)\n baz\nend" + }, + { + "syntax": "method-declaration-params", + "template": "def foo{0}\nend", + "insert": "(a)", + "replacement": "(a, b, c)" + }, + { + "syntax": "method-declaration-required-keyword-param", + "insert": "def foo()\nend", + "replacement": "def foo(name:)\nend" + }, + { + "syntax": "method-declaration-keyword-param", + "insert": "def foo()\nend", + "replacement": "def foo(name: nil)\nend" + }, + { + "syntax": "method-declaration-param-default", + "insert": "def foo()\nend", + "replacement": "def foo(name = nil)\nend" + }, + { + "syntax": "method-declaration-unnamed-param", + "insert": "def foo(name)\nend", + "replacement": "def foo(name, **)\nend" + }, + { + "syntax": "method-invocation", + "insert": "print\nfoo.bar\nbar", + "replacement": "print(\"hello world\")\nfoo.bar()\nbar 2, 3\nbar(2, 3)" + }, + { + "syntax": "method-calls", + "insert": "x.foo()", + "replacement": "bar()" + }, + { + "syntax": "method-calls-keyword-args", + "insert": "foo(bar: true)", + "replacement": "foo(bar: true, baz: 1)" + }, + { + "syntax": "method-calls-hash-args", + "insert": "foo(:bar => true)", + "replacement": "foo(:bar => true, :baz => 1)" + }, + { + "syntax": "class", + "insert": "class Foo < Super\n def test; end\nend", + "replacement": "class Foo\n def test; end\nend" + }, + { + "syntax": "module", + "insert": "module Foo\nend", + "replacement": "module Foo\n def bar\n end\nend" + }, + { + "syntax": "return", + "insert": "return foo", + "replacement": "return" + }, + { + "syntax": "yield", + "insert": "yield foo", + "replacement": "yield" + }, + { + "syntax": "while", + "insert": "while foo do\nend\nfoo while run", + "replacement": "while foo\n bar\nend" + }, + { + "syntax": "until", + "insert": "until foo do\nend\nfoo until done", + "replacement": "until foo\n bar\nend" + }, + { + "syntax": "if", + "insert": "if foo\n bar\nelsif quux\n baz\nelse\n bat\nend", + "replacement": "if x\nend\nif y then\nend" + }, + { + "syntax": "unless", + "insert": "unless foo\n bar\nelse\n bat\nend", + "replacement": "unless x\nend\nunless y then\nend" + }, + { + "syntax": "if-unless-modifiers", + "insert": "print unless foo", + "replacement": "print if foo" + }, + { + "syntax": "and-or", + "insert": "foo and bar", + "replacement": "foo or bar\na or b and c" + }, + { + "syntax": "regex", + "insert": "/^(foo|bar[^_])$/i", + "replacement": "%r/a/\n%rc>" + }, + { + "syntax": "array", + "insert": "[ 1, 2, 3]", + "replacement": "['a', 'b', 'c']" + }, + { + "syntax": "percent-array", + "insert": "%w(one two)", + "replacement": "%W(one #{b} three)" + }, + { + "syntax": "lambda-dash-rocket", + "insert": "-> (a, b, c) {\n 1\n 2\n}", + "replacement": "-> { foo }" + }, + { + "syntax": "lambda", + "insert": "lambda { foo }", + "replacement": "lambda { |x| x + 1 }" + }, + { + "syntax": "for", + "insert": "for x in y\n f\nend", + "replacement": "for i in [1,2,3] do\n print i\nend" + }, + { + "syntax": "element-reference", + "insert": "foo[bar]\nfoo[:bar]\nfoo[bar] = 1", + "replacement": "x[\"b\"]\nx[:\"c\"]" + }, + { + "syntax": "begin", + "template": "def foo\n{0}end", + "insert": "begin\nend\n", + "replacement": "begin\n puts 'hi'\nend\n" + }, + { + "syntax": "else", + "template": "begin\n foo()\n{0}end", + "insert": "else\n", + "replacement": "else\n bar()\n" + }, + { + "syntax": "elsif", + "template": "if bar\n foo()\n{0}end", + "insert": "elsif baz\n", + "replacement": "elsif baz\n qoz()\n" + }, + { + "syntax": "ensure", + "template": "begin\n foo\n{0}end", + "insert": "ensure\n", + "replacement": "ensure\n bar\n" + }, + { + "syntax": "rescue", + "template": "begin\n foo\n{0}end", + "insert": "rescue x\n", + "replacement": "rescue x\n bar\n" + }, + { + "syntax": "rescue-empty", + "insert": "begin\n foo\nrescue\nend", + "replacement": "begin\n foo\nrescue\n bar\nend" + }, + { + "syntax": "rescue-last-ex", + "insert": "begin\n foo\nrescue Error => x\nend", + "replacement": "begin\n foo\nrescue Error => x\n bar\nend" + }, + { + "syntax": "rescue-modifier", + "insert": "foo rescue nil", + "replacement": "foo rescue false" + }, + { + "syntax": "rescue-modifier2", + "insert": "foo rescue nil", + "replacement": "bar rescue nil" + }, + { + "syntax": "when", + "template": "case foo\n{0}end", + "insert": "when bar\n", + "replacement": "when bar\n baz\n" + }, + { + "syntax": "when-else", + "template": "case foo\nwhen bar\n baz\n{0}end", + "insert": "else\n", + "replacement": "else\n qoz\n" + }, + { + "syntax": "begin-block", + "insert": "BEGIN {\n foo\n}", + "replacement": "foo\nBEGIN {\n bar\n}" + }, + { + "syntax": "end-block", + "insert": "END {\n foo\n}", + "replacement": "foo\nEND {\n bar\n}" + } + ] + } +] diff --git a/test/corpus/generators/.gitkeep b/test/corpus/generators/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/corpus/json/javascript/anonymous-function.json b/test/corpus/json/javascript/anonymous-function.json new file mode 100644 index 000000000..7ffe605ab --- /dev/null +++ b/test/corpus/json/javascript/anonymous-function.json @@ -0,0 +1,2890 @@ +[{ + "testCaseDescription": "javascript-anonymous-function-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "anonymous-function.js", + "anonymous-function.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "b59286814d33474a8667383c72b79e078a5136a8" + ] + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index e69de29..b592868 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -0,0 +1 @@", + "+function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "193d1078ef93cde9a03725d1f4b6a42b856754d3..0f94ee7144066b4bf2e6fb86266fe3980d7c20aa" +} +,{ + "testCaseDescription": "javascript-anonymous-function-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "patch": "insert", + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 32 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 78, + 95 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + } + ] + ], + "paths": [ + "anonymous-function.js", + "anonymous-function.js" + ], + "oids": [ + "b59286814d33474a8667383c72b79e078a5136a8", + "e1de356cc2db59253a7d991cd857caaf3c1cf4ef" + ] + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index b592868..e1de356 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1 +1,3 @@", + "+function(b,c) { return b * c; }", + "+function(a,b) { return a + b; }", + " function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0f94ee7144066b4bf2e6fb86266fe3980d7c20aa..85b50027ed8e318f409ebfdeec95d332e4372c9d" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 78, + 95 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 78, + 95 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + } + ] + ], + "paths": [ + "anonymous-function.js", + "anonymous-function.js" + ], + "oids": [ + "e1de356cc2db59253a7d991cd857caaf3c1cf4ef", + "4ca0d4c7ab996e35752d0a7ebdc0b51818e38c89" + ] + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index e1de356..4ca0d4c 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,3 +1,3 @@", + "-function(b,c) { return b * c; }", + "+function(a,b) { return a + b; }", + " function(a,b) { return a + b; }", + " function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "85b50027ed8e318f409ebfdeec95d332e4372c9d..277409950b39db70396ab88d79fef61e6f355cf9" +} +,{ + "testCaseDescription": "javascript-anonymous-function-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 78, + 95 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 78, + 95 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + } + ] + ], + "paths": [ + "anonymous-function.js", + "anonymous-function.js" + ], + "oids": [ + "4ca0d4c7ab996e35752d0a7ebdc0b51818e38c89", + "e1de356cc2db59253a7d991cd857caaf3c1cf4ef" + ] + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index 4ca0d4c..e1de356 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,3 +1,3 @@", + "-function(a,b) { return a + b; }", + "+function(b,c) { return b * c; }", + " function(a,b) { return a + b; }", + " function(a,b) { return a + b; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "277409950b39db70396ab88d79fef61e6f355cf9..1f70d35c4fc7af5fef2b1f33af11fea8bf74ac64" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "patch": "delete", + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 78, + 95 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "patch": "insert", + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 64, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 64 + ], + "number": 3 + } + ] + ], + "paths": [ + "anonymous-function.js", + "anonymous-function.js" + ], + "oids": [ + "e1de356cc2db59253a7d991cd857caaf3c1cf4ef", + "afdaccf774a09485c39a606dc0e0ca185e90aff0" + ] + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index e1de356..afdaccf 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,3 +1,2 @@", + "-function(b,c) { return b * c; }", + "-function(a,b) { return a + b; }", + " function(a,b) { return a + b; }", + "+function(b,c) { return b * c; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1f70d35c4fc7af5fef2b1f33af11fea8bf74ac64..085a8e51416cd260921607437cf74474535dd1e8" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 44 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 56 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 48, + 61 + ] + } + ], + "range": [ + 46, + 63 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 64, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 64 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "anonymous-function.js", + "anonymous-function.js" + ], + "oids": [ + "afdaccf774a09485c39a606dc0e0ca185e90aff0", + "9f1856f5c7c35a7866a562e85a98af16aee083dc" + ] + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index afdaccf..9f1856f 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1,2 +1 @@", + "-function(a,b) { return a + b; }", + " function(b,c) { return b * c; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "085a8e51416cd260921607437cf74474535dd1e8..4dba50c9b3f7e53a052d78885254b1138bd11caa" +} +,{ + "testCaseDescription": "javascript-anonymous-function-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 16, + 29 + ] + } + ], + "range": [ + 14, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "anonymous-function.js", + "anonymous-function.js" + ], + "oids": [ + "9f1856f5c7c35a7866a562e85a98af16aee083dc", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "anonymous-function.js" + ], + "patch": [ + "diff --git a/anonymous-function.js b/anonymous-function.js", + "index 9f1856f..e69de29 100644", + "--- a/anonymous-function.js", + "+++ b/anonymous-function.js", + "@@ -1 +0,0 @@", + "-function(b,c) { return b * c; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4dba50c9b3f7e53a052d78885254b1138bd11caa..b6fb98d6c49e32009671313bca0c3f8b9f01f8d4" +}] diff --git a/test/corpus/json/javascript/anonymous-parameterless-function.json b/test/corpus/json/javascript/anonymous-parameterless-function.json new file mode 100644 index 000000000..9324a1686 --- /dev/null +++ b/test/corpus/json/javascript/anonymous-parameterless-function.json @@ -0,0 +1,2098 @@ +[{ + "testCaseDescription": "javascript-anonymous-parameterless-function-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 11, + 27 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 28 + ], + "number": 2 + } + ] + ], + "paths": [ + "anonymous-parameterless-function.js", + "anonymous-parameterless-function.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "4a26ae863437e7a845005d5619eafbe434a03c73" + ] + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index e69de29..4a26ae8 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -0,0 +1 @@", + "+function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b6fb98d6c49e32009671313bca0c3f8b9f01f8d4..90907a7b09e75e065f750c20ebfd4e4dc338606c" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 13, + 28 + ] + } + ], + "range": [ + 11, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 31 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 44, + 56 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 31, + 58 + ] + } + ], + "patch": "insert", + "range": [ + 31, + 59 + ] + } + ], + "range": [ + 31, + 59 + ] + } + ], + "hasChanges": true, + "range": [ + 31, + 59 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 11, + 27 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 28 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 83 + ] + } + ], + "range": [ + 72, + 84 + ] + } + ], + "range": [ + 70, + 86 + ] + } + ], + "range": [ + 59, + 86 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 59, + 87 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 87, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 87 + ], + "number": 4 + } + ] + ], + "paths": [ + "anonymous-parameterless-function.js", + "anonymous-parameterless-function.js" + ], + "oids": [ + "4a26ae863437e7a845005d5619eafbe434a03c73", + "c31dd4b71a0a91b55871b3d9b1e45443222e53ec" + ] + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index 4a26ae8..c31dd4b 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1 +1,3 @@", + "+function() { return 'hello'; }", + "+function() { return 'hi'; }", + " function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "90907a7b09e75e065f750c20ebfd4e4dc338606c..7502e8aa7b1be8e9fccfb8a13d7a4198e2e6bfaf" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 13, + 28 + ] + } + ], + "range": [ + 11, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 31 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 11, + 27 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 44, + 56 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 31, + 58 + ] + } + ], + "range": [ + 31, + 59 + ] + } + ], + "range": [ + 31, + 59 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 59 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 48, + 52 + ] + } + ], + "range": [ + 41, + 53 + ] + } + ], + "range": [ + 39, + 55 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 83 + ] + } + ], + "range": [ + 72, + 84 + ] + } + ], + "range": [ + 70, + 86 + ] + } + ], + "range": [ + 59, + 86 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 59, + 87 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 76, + 80 + ] + } + ], + "range": [ + 69, + 81 + ] + } + ], + "range": [ + 67, + 83 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 87, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 87 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + } + ] + ], + "paths": [ + "anonymous-parameterless-function.js", + "anonymous-parameterless-function.js" + ], + "oids": [ + "c31dd4b71a0a91b55871b3d9b1e45443222e53ec", + "6b1efa42e992001f0f5c16f8a263156d2352547b" + ] + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index c31dd4b..6b1efa4 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,3 +1,3 @@", + "-function() { return 'hello'; }", + "+function() { return 'hi'; }", + " function() { return 'hi'; }", + " function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7502e8aa7b1be8e9fccfb8a13d7a4198e2e6bfaf..bd22ef3539284345f997eb0db0dc499250191ec8" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 11, + 27 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 13, + 28 + ] + } + ], + "range": [ + 11, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 31 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 48, + 52 + ] + } + ], + "range": [ + 41, + 53 + ] + } + ], + "range": [ + 39, + 55 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 44, + 56 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 31, + 58 + ] + } + ], + "range": [ + 31, + 59 + ] + } + ], + "range": [ + 31, + 59 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 59 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 76, + 80 + ] + } + ], + "range": [ + 69, + 81 + ] + } + ], + "range": [ + 67, + 83 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 83 + ] + } + ], + "range": [ + 72, + 84 + ] + } + ], + "range": [ + 70, + 86 + ] + } + ], + "range": [ + 59, + 86 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 59, + 87 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 87, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 87 + ], + "number": 4 + } + ] + ], + "paths": [ + "anonymous-parameterless-function.js", + "anonymous-parameterless-function.js" + ], + "oids": [ + "6b1efa42e992001f0f5c16f8a263156d2352547b", + "c31dd4b71a0a91b55871b3d9b1e45443222e53ec" + ] + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index 6b1efa4..c31dd4b 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,3 +1,3 @@", + "-function() { return 'hi'; }", + "+function() { return 'hello'; }", + " function() { return 'hi'; }", + " function() { return 'hi'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "bd22ef3539284345f997eb0db0dc499250191ec8..0e4f4ffdb14d066c264de5949c5676a620be32f3" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 13, + 28 + ] + } + ], + "range": [ + 11, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 31 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 44, + 56 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 31, + 58 + ] + } + ], + "patch": "delete", + "range": [ + 31, + 59 + ] + } + ], + "range": [ + 31, + 59 + ] + } + ], + "hasChanges": true, + "range": [ + 31, + 59 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 83 + ] + } + ], + "range": [ + 72, + 84 + ] + } + ], + "range": [ + 70, + 86 + ] + } + ], + "range": [ + 59, + 86 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "range": [ + 59, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 59, + 87 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 11, + 27 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 48, + 55 + ] + } + ], + "range": [ + 41, + 56 + ] + } + ], + "range": [ + 39, + 58 + ] + } + ], + "range": [ + 28, + 58 + ] + } + ], + "patch": "insert", + "range": [ + 28, + 59 + ] + } + ], + "range": [ + 28, + 59 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 59 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 87, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 87 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 59, + 59 + ] + } + ], + "hasChanges": false, + "range": [ + 59, + 59 + ], + "number": 3 + } + ] + ], + "paths": [ + "anonymous-parameterless-function.js", + "anonymous-parameterless-function.js" + ], + "oids": [ + "c31dd4b71a0a91b55871b3d9b1e45443222e53ec", + "b8e05c0e18b2183be864b6277f1d072c03527ee3" + ] + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index c31dd4b..b8e05c0 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,3 +1,2 @@", + "-function() { return 'hello'; }", + "-function() { return 'hi'; }", + " function() { return 'hi'; }", + "+function() { return 'hello'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0e4f4ffdb14d066c264de5949c5676a620be32f3..d03a8c9a2bf8e64daedb6d617fa97ff6d8215b64" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 11, + 27 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 48, + 55 + ] + } + ], + "range": [ + 41, + 56 + ] + } + ], + "range": [ + 39, + 58 + ] + } + ], + "range": [ + 28, + 58 + ] + } + ], + "range": [ + 28, + 59 + ] + } + ], + "range": [ + 28, + 59 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 59 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 13, + 28 + ] + } + ], + "range": [ + 11, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 31 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 59, + 59 + ] + } + ], + "hasChanges": false, + "range": [ + 59, + 59 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 31, + 31 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 31 + ], + "number": 2 + } + ] + ], + "paths": [ + "anonymous-parameterless-function.js", + "anonymous-parameterless-function.js" + ], + "oids": [ + "b8e05c0e18b2183be864b6277f1d072c03527ee3", + "ce1ef83341ff771f6306c08175696a70c3866eef" + ] + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index b8e05c0..ce1ef83 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1,2 +1 @@", + "-function() { return 'hi'; }", + " function() { return 'hello'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d03a8c9a2bf8e64daedb6d617fa97ff6d8215b64..61b53588ccb1690db4be3c566dc13037f86e2631" +} +,{ + "testCaseDescription": "javascript-anonymous-parameterless-function-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 13, + 28 + ] + } + ], + "range": [ + 11, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 31 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 31, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 31, + 31 + ], + "number": 2 + } + ] + ], + "paths": [ + "anonymous-parameterless-function.js", + "anonymous-parameterless-function.js" + ], + "oids": [ + "ce1ef83341ff771f6306c08175696a70c3866eef", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "anonymous-parameterless-function.js" + ], + "patch": [ + "diff --git a/anonymous-parameterless-function.js b/anonymous-parameterless-function.js", + "index ce1ef83..e69de29 100644", + "--- a/anonymous-parameterless-function.js", + "+++ b/anonymous-parameterless-function.js", + "@@ -1 +0,0 @@", + "-function() { return 'hello'; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "61b53588ccb1690db4be3c566dc13037f86e2631..d85c24526768ef13d44a0e8cce5aefe270e43c4a" +}] diff --git a/test/corpus/json/javascript/array.json b/test/corpus/json/javascript/array.json new file mode 100644 index 000000000..da4279943 --- /dev/null +++ b/test/corpus/json/javascript/array.json @@ -0,0 +1,1684 @@ +[{ + "testCaseDescription": "javascript-array-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "array.js", + "array.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "333558251d9d75b2f92ea2e7b4fde10635ea326e" + ] + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index e69de29..3335582 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -0,0 +1 @@", + "+[ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f24de0d24746d9f2408eda661698733705bd8a14..cc01ed254daa10d4e01b67e7d04ba5432020ca79" +} +,{ + "testCaseDescription": "javascript-array-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + }, + { + "category": "StringLiteral", + "range": [ + 11, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "patch": "insert", + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 22, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 35 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 37, + 44 + ] + } + ], + "range": [ + 35, + 46 + ] + } + ], + "range": [ + 35, + 47 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 48 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 13 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 4 + } + ] + ], + "paths": [ + "array.js", + "array.js" + ], + "oids": [ + "333558251d9d75b2f92ea2e7b4fde10635ea326e", + "cf37d7c11b4cd430324ccafe51e2437d6aefcd16" + ] + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index 3335582..cf37d7c 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1 +1,3 @@", + "+[ \"item1\", \"item2\" ];", + "+[ \"item1\" ];", + " [ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cc01ed254daa10d4e01b67e7d04ba5432020ca79..c32c125fbf94e5f446da6b4bcc71ab83790e3eb8" +} +,{ + "testCaseDescription": "javascript-array-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + }, + { + "category": "StringLiteral", + "patch": "delete", + "range": [ + 11, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 22, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 35 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 15, + 22 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 13, + 26 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 26 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 37, + 44 + ] + } + ], + "range": [ + 35, + 46 + ] + } + ], + "range": [ + 35, + 47 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 48 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 28, + 35 + ] + } + ], + "range": [ + 26, + 37 + ] + } + ], + "range": [ + 26, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 39 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 39, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 39 + ], + "number": 4 + } + ] + ], + "paths": [ + "array.js", + "array.js" + ], + "oids": [ + "cf37d7c11b4cd430324ccafe51e2437d6aefcd16", + "c2cb17facc693eda29753be3fc0ba8df902d61a7" + ] + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index cf37d7c..c2cb17f 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,3 +1,3 @@", + "-[ \"item1\", \"item2\" ];", + "+[ \"item1\" ];", + " [ \"item1\" ];", + " [ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c32c125fbf94e5f446da6b4bcc71ab83790e3eb8..439bb224c0c4fe667a42c61bc319ca7891a035df" +} +,{ + "testCaseDescription": "javascript-array-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + }, + { + "category": "StringLiteral", + "patch": "insert", + "range": [ + 11, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 15, + 22 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "range": [ + 13, + 25 + ] + } + ], + "range": [ + 13, + 26 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 26 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 22, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 35 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 28, + 35 + ] + } + ], + "range": [ + 26, + 37 + ] + } + ], + "range": [ + 26, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 39 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 37, + 44 + ] + } + ], + "range": [ + 35, + 46 + ] + } + ], + "range": [ + 35, + 47 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 48 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 39, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 39 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 4 + } + ] + ], + "paths": [ + "array.js", + "array.js" + ], + "oids": [ + "c2cb17facc693eda29753be3fc0ba8df902d61a7", + "cf37d7c11b4cd430324ccafe51e2437d6aefcd16" + ] + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index c2cb17f..cf37d7c 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,3 +1,3 @@", + "-[ \"item1\" ];", + "+[ \"item1\", \"item2\" ];", + " [ \"item1\" ];", + " [ \"item1\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "439bb224c0c4fe667a42c61bc319ca7891a035df..d19df2f2b147510e83c6f72fc96759a8fc316015" +} +,{ + "testCaseDescription": "javascript-array-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + }, + { + "category": "StringLiteral", + "range": [ + 11, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "patch": "delete", + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 22, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 35 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 37, + 44 + ] + } + ], + "range": [ + 35, + 46 + ] + } + ], + "range": [ + 35, + 47 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 48 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 15, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 13, + 33 + ] + } + ], + "patch": "insert", + "range": [ + 13, + 34 + ] + } + ], + "range": [ + 13, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 35 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 35 + ], + "number": 3 + } + ] + ], + "paths": [ + "array.js", + "array.js" + ], + "oids": [ + "cf37d7c11b4cd430324ccafe51e2437d6aefcd16", + "a4d92b81400cceb07a65847680515a0990b0f7d9" + ] + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index cf37d7c..a4d92b8 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,3 +1,2 @@", + "-[ \"item1\", \"item2\" ];", + "-[ \"item1\" ];", + " [ \"item1\" ];", + "+[ \"item1\", \"item2\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d19df2f2b147510e83c6f72fc96759a8fc316015..8f07abcf89121cd177cd3d238c1ffe36321da00b" +} +,{ + "testCaseDescription": "javascript-array-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 15, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 13, + 33 + ] + } + ], + "range": [ + 13, + 34 + ] + } + ], + "range": [ + 13, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 35 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + }, + { + "category": "StringLiteral", + "range": [ + 11, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 35 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 2 + } + ] + ], + "paths": [ + "array.js", + "array.js" + ], + "oids": [ + "a4d92b81400cceb07a65847680515a0990b0f7d9", + "7f2f50e64a7063f8d786726568e38e7ea72accc7" + ] + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index a4d92b8..7f2f50e 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1,2 +1 @@", + "-[ \"item1\" ];", + " [ \"item1\", \"item2\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8f07abcf89121cd177cd3d238c1ffe36321da00b..9bfceef09e8693663faf7ed767e2526379aa7d28" +} +,{ + "testCaseDescription": "javascript-array-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ArrayLiteral", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 9 + ] + }, + { + "category": "StringLiteral", + "range": [ + 11, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 22 + ], + "number": 2 + } + ] + ], + "paths": [ + "array.js", + "array.js" + ], + "oids": [ + "7f2f50e64a7063f8d786726568e38e7ea72accc7", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "array.js" + ], + "patch": [ + "diff --git a/array.js b/array.js", + "index 7f2f50e..e69de29 100644", + "--- a/array.js", + "+++ b/array.js", + "@@ -1 +0,0 @@", + "-[ \"item1\", \"item2\" ];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9bfceef09e8693663faf7ed767e2526379aa7d28..47efa692005800aae87fccdba3a089c87d9c46f1" +}] diff --git a/test/corpus/json/javascript/arrow-function.json b/test/corpus/json/javascript/arrow-function.json new file mode 100644 index 000000000..8bb823204 --- /dev/null +++ b/test/corpus/json/javascript/arrow-function.json @@ -0,0 +1,2462 @@ +[{ + "testCaseDescription": "javascript-arrow-function-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 25, + 25 + ], + "number": 2 + } + ] + ], + "paths": [ + "arrow-function.js", + "arrow-function.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "9ef167c095354f01060ae7a1449f334cff2c6699" + ] + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index e69de29..9ef167c 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -0,0 +1 @@", + "+(f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4a56270744e8c9a123c828e7ab9409789ab51e5b..354952d5bb12d69a77c300031873d5f24cdfb8ec" +} +,{ + "testCaseDescription": "javascript-arrow-function-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "patch": "insert", + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": true, + "range": [ + 25, + 50 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 25 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 62, + 71 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 50, + 73 + ] + } + ], + "range": [ + 50, + 74 + ] + } + ], + "range": [ + 50, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 75 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 75 + ], + "number": 4 + } + ] + ], + "paths": [ + "arrow-function.js", + "arrow-function.js" + ], + "oids": [ + "9ef167c095354f01060ae7a1449f334cff2c6699", + "92dea6faa11245e596381526b5c2cc1418f9b9b9" + ] + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 9ef167c..92dea6f 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1 +1,3 @@", + "+(f, g) => { return g; };", + "+(f, g) => { return h; };", + " (f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "354952d5bb12d69a77c300031873d5f24cdfb8ec..e14d6bef489fc103f67915f63487672c56e71171" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 50 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 50 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 62, + 71 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 50, + 73 + ] + } + ], + "range": [ + 50, + 74 + ] + } + ], + "range": [ + 50, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 75 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 62, + 71 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 50, + 73 + ] + } + ], + "range": [ + 50, + 74 + ] + } + ], + "range": [ + 50, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 75 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 75 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 75 + ], + "number": 4 + } + ] + ], + "paths": [ + "arrow-function.js", + "arrow-function.js" + ], + "oids": [ + "92dea6faa11245e596381526b5c2cc1418f9b9b9", + "8f5bb5167767d854482600df00a00a2d04ccbef3" + ] + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 92dea6f..8f5bb51 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,3 +1,3 @@", + "-(f, g) => { return g; };", + "+(f, g) => { return h; };", + " (f, g) => { return h; };", + " (f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e14d6bef489fc103f67915f63487672c56e71171..07cd8aacb36d8bff27fa08fa74711bd4dc234bf9" +} +,{ + "testCaseDescription": "javascript-arrow-function-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 50 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 50 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 62, + 71 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 50, + 73 + ] + } + ], + "range": [ + 50, + 74 + ] + } + ], + "range": [ + 50, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 75 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 62, + 71 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 50, + 73 + ] + } + ], + "range": [ + 50, + 74 + ] + } + ], + "range": [ + 50, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 75 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 75 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 75 + ], + "number": 4 + } + ] + ], + "paths": [ + "arrow-function.js", + "arrow-function.js" + ], + "oids": [ + "8f5bb5167767d854482600df00a00a2d04ccbef3", + "92dea6faa11245e596381526b5c2cc1418f9b9b9" + ] + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 8f5bb51..92dea6f 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,3 +1,3 @@", + "-(f, g) => { return h; };", + "+(f, g) => { return g; };", + " (f, g) => { return h; };", + " (f, g) => { return h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "07cd8aacb36d8bff27fa08fa74711bd4dc234bf9..04e144b29b788332a7b841f72d3a54e54bf177a1" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "patch": "delete", + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": true, + "range": [ + 25, + 50 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 62, + 71 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 50, + 73 + ] + } + ], + "range": [ + 50, + 74 + ] + } + ], + "range": [ + 50, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 75 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "patch": "insert", + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": true, + "range": [ + 25, + 50 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 75 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 50, + 50 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 50 + ], + "number": 3 + } + ] + ], + "paths": [ + "arrow-function.js", + "arrow-function.js" + ], + "oids": [ + "92dea6faa11245e596381526b5c2cc1418f9b9b9", + "acab9a9cb6d6b26ffce64e3e9f09b6e6066ac1f0" + ] + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index 92dea6f..acab9a9 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,3 +1,2 @@", + "-(f, g) => { return g; };", + "-(f, g) => { return h; };", + " (f, g) => { return h; };", + "+(f, g) => { return g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "04e144b29b788332a7b841f72d3a54e54bf177a1..99d26e538f591473bc4c23e991a8fb4addcb2c15" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 37, + 46 + ] + } + ], + "range": [ + 35, + 48 + ] + } + ], + "range": [ + 25, + 48 + ] + } + ], + "range": [ + 25, + 49 + ] + } + ], + "range": [ + 25, + 50 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 50 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 50, + 50 + ] + } + ], + "hasChanges": false, + "range": [ + 50, + 50 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 2 + } + ] + ], + "paths": [ + "arrow-function.js", + "arrow-function.js" + ], + "oids": [ + "acab9a9cb6d6b26ffce64e3e9f09b6e6066ac1f0", + "ef1be25b964065d986148f262fed182255fc2713" + ] + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index acab9a9..ef1be25 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1,2 +1 @@", + "-(f, g) => { return h; };", + " (f, g) => { return g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "99d26e538f591473bc4c23e991a8fb4addcb2c15..1327f9cc5b23ac1be93532b0a8d3f096044105f9" +} +,{ + "testCaseDescription": "javascript-arrow-function-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1, + 2 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 10, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 25 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 25, + 25 + ], + "number": 2 + } + ] + ], + "paths": [ + "arrow-function.js", + "arrow-function.js" + ], + "oids": [ + "ef1be25b964065d986148f262fed182255fc2713", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "arrow-function.js" + ], + "patch": [ + "diff --git a/arrow-function.js b/arrow-function.js", + "index ef1be25..e69de29 100644", + "--- a/arrow-function.js", + "+++ b/arrow-function.js", + "@@ -1 +0,0 @@", + "-(f, g) => { return g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1327f9cc5b23ac1be93532b0a8d3f096044105f9..a52e2d614f9e9504970732cbc2d5f9c933eb061f" +}] diff --git a/test/corpus/json/javascript/assignment.json b/test/corpus/json/javascript/assignment.json new file mode 100644 index 000000000..7778e53c3 --- /dev/null +++ b/test/corpus/json/javascript/assignment.json @@ -0,0 +1,1812 @@ +[{ + "testCaseDescription": "javascript-assignment-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 7 + ], + "number": 2 + } + ] + ], + "paths": [ + "assignment.js", + "assignment.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "6882fe5e9b61219ab73752afdc310b095bfe745d" + ] + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index e69de29..6882fe5 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -0,0 +1 @@", + "+x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "aa5f6a7c2031a5c8823a005dffbe948bd997e140..f5d468945963e06f4af8f37da1f4b43c6f7dc89b" +} +,{ + "testCaseDescription": "javascript-assignment-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "patch": "insert", + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 14 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 7 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + } + ] + ], + "paths": [ + "assignment.js", + "assignment.js" + ], + "oids": [ + "6882fe5e9b61219ab73752afdc310b095bfe745d", + "fb4cba44067ebf39e2fd6f2141e6f37a06092835" + ] + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 6882fe5..fb4cba4 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1 +1,3 @@", + "+x = 1;", + "+x = 0;", + " x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f5d468945963e06f4af8f37da1f4b43c6f7dc89b..079aadf7d837be3f3cbaa970bda8df4f24ca9dfd" +} +,{ + "testCaseDescription": "javascript-assignment-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + } + ] + ], + "paths": [ + "assignment.js", + "assignment.js" + ], + "oids": [ + "fb4cba44067ebf39e2fd6f2141e6f37a06092835", + "42e16c611cdbe3ec9b3bb6a364f3c0f9fb57844f" + ] + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index fb4cba4..42e16c6 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,3 +1,3 @@", + "-x = 1;", + "+x = 0;", + " x = 0;", + " x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "079aadf7d837be3f3cbaa970bda8df4f24ca9dfd..59dc3f7b9aa4067d998fe7a7167d25a879597bbe" +} +,{ + "testCaseDescription": "javascript-assignment-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + } + ] + ], + "paths": [ + "assignment.js", + "assignment.js" + ], + "oids": [ + "42e16c611cdbe3ec9b3bb6a364f3c0f9fb57844f", + "fb4cba44067ebf39e2fd6f2141e6f37a06092835" + ] + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 42e16c6..fb4cba4 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,3 +1,3 @@", + "-x = 0;", + "+x = 1;", + " x = 0;", + " x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "59dc3f7b9aa4067d998fe7a7167d25a879597bbe..7a05860458ff8fe37877bd3105ddd6cae586b0cf" +} +,{ + "testCaseDescription": "javascript-assignment-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 14 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "patch": "insert", + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 14 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 14, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 14 + ], + "number": 3 + } + ] + ], + "paths": [ + "assignment.js", + "assignment.js" + ], + "oids": [ + "fb4cba44067ebf39e2fd6f2141e6f37a06092835", + "11fe15d7f4c6042ed39993811cb54e0f3cd3ac83" + ] + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index fb4cba4..11fe15d 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,3 +1,2 @@", + "-x = 1;", + "-x = 0;", + " x = 0;", + "+x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7a05860458ff8fe37877bd3105ddd6cae586b0cf..b815835af80b7e47423649f4ac97477d00069b02" +} +,{ + "testCaseDescription": "javascript-assignment-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 14, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 14 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 7 + ], + "number": 2 + } + ] + ], + "paths": [ + "assignment.js", + "assignment.js" + ], + "oids": [ + "11fe15d7f4c6042ed39993811cb54e0f3cd3ac83", + "198b8f89e758aee0adce3806353120c3b674937d" + ] + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 11fe15d..198b8f8 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1,2 +1 @@", + "-x = 0;", + " x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b815835af80b7e47423649f4ac97477d00069b02..5524702d577596f2531f09de1af7369cbc54b582" +} +,{ + "testCaseDescription": "javascript-assignment-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 7 + ], + "number": 2 + } + ] + ], + "paths": [ + "assignment.js", + "assignment.js" + ], + "oids": [ + "198b8f89e758aee0adce3806353120c3b674937d", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "assignment.js" + ], + "patch": [ + "diff --git a/assignment.js b/assignment.js", + "index 198b8f8..e69de29 100644", + "--- a/assignment.js", + "+++ b/assignment.js", + "@@ -1 +0,0 @@", + "-x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5524702d577596f2531f09de1af7369cbc54b582..30a517ace94526eae9f09618d7cc587cdbb96c25" +}] diff --git a/test/corpus/json/javascript/bitwise-operator.json b/test/corpus/json/javascript/bitwise-operator.json new file mode 100644 index 000000000..a7d167c45 --- /dev/null +++ b/test/corpus/json/javascript/bitwise-operator.json @@ -0,0 +1,1812 @@ +[{ + "testCaseDescription": "javascript-bitwise-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "bitwise-operator.js", + "bitwise-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "021cf6ad4507a61be9061e0b18f59aff92a14ead" + ] + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index e69de29..021cf6a 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -0,0 +1 @@", + "+i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "94fca5fc215c9c7199b86ef4da0ad543ca630b92..99ba41aa0041a3105e46827e137d5105469bddeb" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "bitwise-operator.js", + "bitwise-operator.js" + ], + "oids": [ + "021cf6ad4507a61be9061e0b18f59aff92a14ead", + "3e0b6c17ee39779fc24b7fe4cc698da681d80f2f" + ] + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 021cf6a..3e0b6c1 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1 +1,3 @@", + "+i >> k;", + "+i >> j;", + " i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "99ba41aa0041a3105e46827e137d5105469bddeb..202e42ebe72f74a25c429078725af9921fe65545" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "bitwise-operator.js", + "bitwise-operator.js" + ], + "oids": [ + "3e0b6c17ee39779fc24b7fe4cc698da681d80f2f", + "18853d16a6dbe43b0fe72ba743af853d03eaf8bf" + ] + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 3e0b6c1..18853d1 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,3 +1,3 @@", + "-i >> k;", + "+i >> j;", + " i >> j;", + " i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "202e42ebe72f74a25c429078725af9921fe65545..5f5111c80d08d0bbc7a1a2661d1a4ead7021937e" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "bitwise-operator.js", + "bitwise-operator.js" + ], + "oids": [ + "18853d16a6dbe43b0fe72ba743af853d03eaf8bf", + "3e0b6c17ee39779fc24b7fe4cc698da681d80f2f" + ] + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 18853d1..3e0b6c1 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,3 +1,3 @@", + "-i >> j;", + "+i >> k;", + " i >> j;", + " i >> j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5f5111c80d08d0bbc7a1a2661d1a4ead7021937e..beeda50d15e6e13cfd9a03d83f30a410dbc07fe9" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "patch": "delete", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + } + ] + ], + "paths": [ + "bitwise-operator.js", + "bitwise-operator.js" + ], + "oids": [ + "3e0b6c17ee39779fc24b7fe4cc698da681d80f2f", + "ee7d8dec284f8d88cc513926d701b89a5adee4ff" + ] + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 3e0b6c1..ee7d8de 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,3 +1,2 @@", + "-i >> k;", + "-i >> j;", + " i >> j;", + "+i >> k;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "beeda50d15e6e13cfd9a03d83f30a410dbc07fe9..02065a82a63470d29c655c04adeebc72961353d0" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "bitwise-operator.js", + "bitwise-operator.js" + ], + "oids": [ + "ee7d8dec284f8d88cc513926d701b89a5adee4ff", + "2800c8c8828d890a70c023479726c3f551cb5d36" + ] + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index ee7d8de..2800c8c 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1,2 +1 @@", + "-i >> j;", + " i >> k;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "02065a82a63470d29c655c04adeebc72961353d0..59a5ae59bc44cac921e21f84a88c8ee0f0690a47" +} +,{ + "testCaseDescription": "javascript-bitwise-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BitwiseOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "bitwise-operator.js", + "bitwise-operator.js" + ], + "oids": [ + "2800c8c8828d890a70c023479726c3f551cb5d36", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "bitwise-operator.js" + ], + "patch": [ + "diff --git a/bitwise-operator.js b/bitwise-operator.js", + "index 2800c8c..e69de29 100644", + "--- a/bitwise-operator.js", + "+++ b/bitwise-operator.js", + "@@ -1 +0,0 @@", + "-i >> k;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "59a5ae59bc44cac921e21f84a88c8ee0f0690a47..ba72732ac272c8ae8487ba0af9045dea54eb02d9" +}] diff --git a/test/corpus/json/javascript/boolean-operator.json b/test/corpus/json/javascript/boolean-operator.json new file mode 100644 index 000000000..b944594b6 --- /dev/null +++ b/test/corpus/json/javascript/boolean-operator.json @@ -0,0 +1,1804 @@ +[{ + "testCaseDescription": "javascript-boolean-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "boolean-operator.js", + "boolean-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "7280a98cdd0353c1bb7e03770613ae709bcb2cf5" + ] + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index e69de29..7280a98 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -0,0 +1 @@", + "+i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b0194f4ccae027de9b6fbbc4ceefe070cf51555c..c8ce4905edb0321dfaf25203714eda8d05133dc0" +} +,{ + "testCaseDescription": "javascript-boolean-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "boolean-operator.js", + "boolean-operator.js" + ], + "oids": [ + "7280a98cdd0353c1bb7e03770613ae709bcb2cf5", + "fe3f30646b4683f9a0bf94b7464d5dd0a9b216d5" + ] + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index 7280a98..fe3f306 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1 +1,3 @@", + "+i && j;", + "+i || j;", + " i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c8ce4905edb0321dfaf25203714eda8d05133dc0..018d110adadddb7b94c0c87869f4ef32d9f38bc8" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "boolean-operator.js", + "boolean-operator.js" + ], + "oids": [ + "fe3f30646b4683f9a0bf94b7464d5dd0a9b216d5", + "273c0ee8f4c5684f46f62e9bc61a9b937fd42da6" + ] + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index fe3f306..273c0ee 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,3 +1,3 @@", + "-i && j;", + "+i || j;", + " i || j;", + " i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "018d110adadddb7b94c0c87869f4ef32d9f38bc8..a6577b774ffd0e26986c4e60b951efb7b2680f5c" +} +,{ + "testCaseDescription": "javascript-boolean-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "boolean-operator.js", + "boolean-operator.js" + ], + "oids": [ + "273c0ee8f4c5684f46f62e9bc61a9b937fd42da6", + "fe3f30646b4683f9a0bf94b7464d5dd0a9b216d5" + ] + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index 273c0ee..fe3f306 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,3 +1,3 @@", + "-i || j;", + "+i && j;", + " i || j;", + " i || j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a6577b774ffd0e26986c4e60b951efb7b2680f5c..742092b6c51172647d7fae976b8b8a5f90842bcc" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + } + ] + ], + "paths": [ + "boolean-operator.js", + "boolean-operator.js" + ], + "oids": [ + "fe3f30646b4683f9a0bf94b7464d5dd0a9b216d5", + "7f4873c126dd7633b40d7d706254e05fdf4fa703" + ] + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index fe3f306..7f4873c 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,3 +1,2 @@", + "-i && j;", + "-i || j;", + " i || j;", + "+i && j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "742092b6c51172647d7fae976b8b8a5f90842bcc..2d12e99c24f6e12742ce6c4456d2ee36b8506d95" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "boolean-operator.js", + "boolean-operator.js" + ], + "oids": [ + "7f4873c126dd7633b40d7d706254e05fdf4fa703", + "c6921d12a6f183c99b1d8107b16f6f428d133af8" + ] + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index 7f4873c..c6921d1 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1,2 +1 @@", + "-i || j;", + " i && j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2d12e99c24f6e12742ce6c4456d2ee36b8506d95..c5a063d347caaa73b7d767f02acda08a144928c0" +} +,{ + "testCaseDescription": "javascript-boolean-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "boolean-operator.js", + "boolean-operator.js" + ], + "oids": [ + "c6921d12a6f183c99b1d8107b16f6f428d133af8", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "boolean-operator.js" + ], + "patch": [ + "diff --git a/boolean-operator.js b/boolean-operator.js", + "index c6921d1..e69de29 100644", + "--- a/boolean-operator.js", + "+++ b/boolean-operator.js", + "@@ -1 +0,0 @@", + "-i && j;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c5a063d347caaa73b7d767f02acda08a144928c0..94fca5fc215c9c7199b86ef4da0ad543ca630b92" +}] diff --git a/test/corpus/json/javascript/chained-callbacks.json b/test/corpus/json/javascript/chained-callbacks.json new file mode 100644 index 000000000..67077ca31 --- /dev/null +++ b/test/corpus/json/javascript/chained-callbacks.json @@ -0,0 +1,3302 @@ +[{ + "testCaseDescription": "javascript-chained-callbacks-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 31, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 9, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 39, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 39 + ], + "number": 2 + } + ] + ], + "paths": [ + "chained-callbacks.js", + "chained-callbacks.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "ce9ee1ed9e861af97055f45e8bba4135e730cd5c" + ] + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index e69de29..ce9ee1e 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -0,0 +1 @@", + "+this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "20036c5dfbcbfda6adb2ac623f76a2d33319daff..8fe67e615790750c81a0d0cf671039fd04874196" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 11 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 34, + 37 + ] + } + ], + "range": [ + 27, + 38 + ] + } + ], + "range": [ + 25, + 40 + ] + } + ], + "range": [ + 12, + 40 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 46 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 50 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + } + ], + "range": [ + 73, + 76 + ] + } + ], + "range": [ + 66, + 77 + ] + } + ], + "range": [ + 64, + 79 + ] + } + ], + "range": [ + 51, + 79 + ] + } + ], + "range": [ + 42, + 80 + ] + } + ], + "patch": "insert", + "range": [ + 42, + 81 + ] + } + ], + "range": [ + 42, + 81 + ] + } + ], + "hasChanges": true, + "range": [ + 42, + 81 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 31, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 9, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 39 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + }, + { + "category": "Identifier", + "range": [ + 86, + 89 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 112, + 115 + ] + } + ], + "range": [ + 105, + 116 + ] + } + ], + "range": [ + 103, + 118 + ] + } + ], + "range": [ + 90, + 118 + ] + } + ], + "range": [ + 81, + 119 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 120 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 39, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 39 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + } + ] + ], + "paths": [ + "chained-callbacks.js", + "chained-callbacks.js" + ], + "oids": [ + "ce9ee1ed9e861af97055f45e8bba4135e730cd5c", + "acba744a8426d46dd1ef2f760336b6be5329b75b" + ] + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index ce9ee1e..acba744 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1 +1,3 @@", + "+this.reduce(function (a) { return b.a; })", + "+this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8fe67e615790750c81a0d0cf671039fd04874196..2a557ecea000afb29ccc7a685858096c6eee76a3" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 11 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 34, + 37 + ] + } + ], + "range": [ + 27, + 38 + ] + } + ], + "range": [ + 25, + 40 + ] + } + ], + "range": [ + 12, + 40 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 8 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 31, + 32 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 31, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 9, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 46 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 50 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + } + ], + "range": [ + 73, + 76 + ] + } + ], + "range": [ + 66, + 77 + ] + } + ], + "range": [ + 64, + 79 + ] + } + ], + "range": [ + 51, + 79 + ] + } + ], + "range": [ + 42, + 80 + ] + } + ], + "range": [ + 42, + 81 + ] + } + ], + "range": [ + 42, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 81 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 47 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 73 + ] + } + ], + "range": [ + 70, + 73 + ] + } + ], + "range": [ + 63, + 74 + ] + } + ], + "range": [ + 61, + 76 + ] + } + ], + "range": [ + 48, + 76 + ] + } + ], + "range": [ + 39, + 77 + ] + } + ], + "range": [ + 39, + 78 + ] + } + ], + "range": [ + 39, + 78 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 78 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + }, + { + "category": "Identifier", + "range": [ + 86, + 89 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 112, + 115 + ] + } + ], + "range": [ + 105, + 116 + ] + } + ], + "range": [ + 103, + 118 + ] + } + ], + "range": [ + 90, + 118 + ] + } + ], + "range": [ + 81, + 119 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 120 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 82 + ] + }, + { + "category": "Identifier", + "range": [ + 83, + 86 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 97, + 98 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 109, + 110 + ] + }, + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + } + ], + "range": [ + 109, + 112 + ] + } + ], + "range": [ + 102, + 113 + ] + } + ], + "range": [ + 100, + 115 + ] + } + ], + "range": [ + 87, + 115 + ] + } + ], + "range": [ + 78, + 116 + ] + } + ], + "range": [ + 78, + 117 + ] + } + ], + "range": [ + 78, + 117 + ] + } + ], + "hasChanges": false, + "range": [ + 78, + 117 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 117, + 117 + ] + } + ], + "hasChanges": false, + "range": [ + 117, + 117 + ], + "number": 4 + } + ] + ], + "paths": [ + "chained-callbacks.js", + "chained-callbacks.js" + ], + "oids": [ + "acba744a8426d46dd1ef2f760336b6be5329b75b", + "7390534322bff352014e45fdc8399881b290d5a2" + ] + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index acba744..7390534 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,3 +1,3 @@", + "-this.reduce(function (a) { return b.a; })", + "+this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2a557ecea000afb29ccc7a685858096c6eee76a3..11717a449f96cc2edba70e66ebe01b4f23cd9cc7" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 8 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 31, + 32 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 31, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 9, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 11 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 34, + 37 + ] + } + ], + "range": [ + 27, + 38 + ] + } + ], + "range": [ + 25, + 40 + ] + } + ], + "range": [ + 12, + 40 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 47 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 73 + ] + } + ], + "range": [ + 70, + 73 + ] + } + ], + "range": [ + 63, + 74 + ] + } + ], + "range": [ + 61, + 76 + ] + } + ], + "range": [ + 48, + 76 + ] + } + ], + "range": [ + 39, + 77 + ] + } + ], + "range": [ + 39, + 78 + ] + } + ], + "range": [ + 39, + 78 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 78 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 46 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 50 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + } + ], + "range": [ + 73, + 76 + ] + } + ], + "range": [ + 66, + 77 + ] + } + ], + "range": [ + 64, + 79 + ] + } + ], + "range": [ + 51, + 79 + ] + } + ], + "range": [ + 42, + 80 + ] + } + ], + "range": [ + 42, + 81 + ] + } + ], + "range": [ + 42, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 81 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 82 + ] + }, + { + "category": "Identifier", + "range": [ + 83, + 86 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 97, + 98 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 109, + 110 + ] + }, + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + } + ], + "range": [ + 109, + 112 + ] + } + ], + "range": [ + 102, + 113 + ] + } + ], + "range": [ + 100, + 115 + ] + } + ], + "range": [ + 87, + 115 + ] + } + ], + "range": [ + 78, + 116 + ] + } + ], + "range": [ + 78, + 117 + ] + } + ], + "range": [ + 78, + 117 + ] + } + ], + "hasChanges": false, + "range": [ + 78, + 117 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + }, + { + "category": "Identifier", + "range": [ + 86, + 89 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 112, + 115 + ] + } + ], + "range": [ + 105, + 116 + ] + } + ], + "range": [ + 103, + 118 + ] + } + ], + "range": [ + 90, + 118 + ] + } + ], + "range": [ + 81, + 119 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 120 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 117, + 117 + ] + } + ], + "hasChanges": false, + "range": [ + 117, + 117 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + } + ] + ], + "paths": [ + "chained-callbacks.js", + "chained-callbacks.js" + ], + "oids": [ + "7390534322bff352014e45fdc8399881b290d5a2", + "acba744a8426d46dd1ef2f760336b6be5329b75b" + ] + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index 7390534..acba744 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,3 +1,3 @@", + "-this.map(function (a) { return a.b; })", + "+this.reduce(function (a) { return b.a; })", + " this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "11717a449f96cc2edba70e66ebe01b4f23cd9cc7..0cac26668c9121a11276917ab985c409a8091507" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 11 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 34, + 37 + ] + } + ], + "range": [ + 27, + 38 + ] + } + ], + "range": [ + 25, + 40 + ] + } + ], + "range": [ + 12, + 40 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 46 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 50 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + } + ], + "range": [ + 73, + 76 + ] + } + ], + "range": [ + 66, + 77 + ] + } + ], + "range": [ + 64, + 79 + ] + } + ], + "range": [ + 51, + 79 + ] + } + ], + "range": [ + 42, + 80 + ] + } + ], + "patch": "delete", + "range": [ + 42, + 81 + ] + } + ], + "range": [ + 42, + 81 + ] + } + ], + "hasChanges": true, + "range": [ + 42, + 81 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + }, + { + "category": "Identifier", + "range": [ + 86, + 89 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 112, + 115 + ] + } + ], + "range": [ + 105, + 116 + ] + } + ], + "range": [ + 103, + 118 + ] + } + ], + "range": [ + 90, + 118 + ] + } + ], + "range": [ + 81, + 119 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "range": [ + 81, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 120 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 31, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 9, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 50 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + } + ], + "range": [ + 73, + 76 + ] + } + ], + "range": [ + 66, + 77 + ] + } + ], + "range": [ + 64, + 79 + ] + } + ], + "range": [ + 51, + 79 + ] + } + ], + "range": [ + 39, + 80 + ] + } + ], + "patch": "insert", + "range": [ + 39, + 81 + ] + } + ], + "range": [ + 39, + 81 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 81 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 3 + } + ] + ], + "paths": [ + "chained-callbacks.js", + "chained-callbacks.js" + ], + "oids": [ + "acba744a8426d46dd1ef2f760336b6be5329b75b", + "c4db4326d7f3f7ffe3d6ec61d9962c153c2d3d9e" + ] + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index acba744..c4db432 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,3 +1,2 @@", + "-this.reduce(function (a) { return b.a; })", + "-this.map(function (a) { return a.b; })", + " this.map(function (a) { return a.b; })", + "+this.reduce(function (a) { return b.a; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0cac26668c9121a11276917ab985c409a8091507..f00a27acc2ab003cdeb75993917c80427380f75a" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 31, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 9, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 39 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 50 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + } + ], + "range": [ + 73, + 76 + ] + } + ], + "range": [ + 66, + 77 + ] + } + ], + "range": [ + 64, + 79 + ] + } + ], + "range": [ + 51, + 79 + ] + } + ], + "range": [ + 39, + 80 + ] + } + ], + "range": [ + 39, + 81 + ] + } + ], + "range": [ + 39, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 81 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 11 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 34, + 37 + ] + } + ], + "range": [ + 27, + 38 + ] + } + ], + "range": [ + 25, + 40 + ] + } + ], + "range": [ + 12, + 40 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 42 + ], + "number": 2 + } + ] + ], + "paths": [ + "chained-callbacks.js", + "chained-callbacks.js" + ], + "oids": [ + "c4db4326d7f3f7ffe3d6ec61d9962c153c2d3d9e", + "e593419889a5ac26f2f6d01ba83fe3c421f04feb" + ] + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index c4db432..e593419 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1,2 +1 @@", + "-this.map(function (a) { return a.b; })", + " this.reduce(function (a) { return b.a; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f00a27acc2ab003cdeb75993917c80427380f75a..ee5b62d892c81a79ad65ad30e017ee7f983b46fb" +} +,{ + "testCaseDescription": "javascript-chained-callbacks-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 11 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 34, + 37 + ] + } + ], + "range": [ + 27, + 38 + ] + } + ], + "range": [ + 25, + 40 + ] + } + ], + "range": [ + 12, + 40 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 42, + 42 + ], + "number": 2 + } + ] + ], + "paths": [ + "chained-callbacks.js", + "chained-callbacks.js" + ], + "oids": [ + "e593419889a5ac26f2f6d01ba83fe3c421f04feb", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "chained-callbacks.js" + ], + "patch": [ + "diff --git a/chained-callbacks.js b/chained-callbacks.js", + "index e593419..e69de29 100644", + "--- a/chained-callbacks.js", + "+++ b/chained-callbacks.js", + "@@ -1 +0,0 @@", + "-this.reduce(function (a) { return b.a; })" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ee5b62d892c81a79ad65ad30e017ee7f983b46fb..2f1a5ed4016f7e817cb5b1b4839bb64deecd8042" +}] diff --git a/test/corpus/json/javascript/chained-property-access.json b/test/corpus/json/javascript/chained-property-access.json new file mode 100644 index 000000000..b8d77c124 --- /dev/null +++ b/test/corpus/json/javascript/chained-property-access.json @@ -0,0 +1,3844 @@ +[{ + "testCaseDescription": "javascript-chained-property-access-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 48 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "range": [ + 7, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + } + ], + "range": [ + 57, + 72 + ] + } + ], + "range": [ + 7, + 74 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 75 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 75, + 75 + ], + "number": 2 + } + ] + ], + "paths": [ + "chained-property-access.js", + "chained-property-access.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "5914a55c722e29bde628ac81a0a863acd4c7fab0" + ] + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index e69de29..5914a55 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -0,0 +1 @@", + "+return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6a24d1bc284fee3110e5699439106922f5381fd5..f3f2a6e1032364aab733b4a8ed87fa66fe71cd40" +} +,{ + "testCaseDescription": "javascript-chained-property-access-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 7, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 70, + 76 + ] + } + ], + "range": [ + 59, + 76 + ] + } + ], + "range": [ + 7, + 78 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 79 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 79 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 94 + ] + }, + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + } + ], + "range": [ + 86, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 127 + ] + } + ], + "range": [ + 111, + 127 + ] + } + ], + "range": [ + 86, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 134 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 145, + 151 + ] + } + ], + "range": [ + 136, + 151 + ] + } + ], + "range": [ + 86, + 153 + ] + } + ], + "patch": "insert", + "range": [ + 79, + 154 + ] + } + ], + "range": [ + 79, + 154 + ] + } + ], + "hasChanges": true, + "range": [ + 79, + 154 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 48 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "range": [ + 7, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + } + ], + "range": [ + 57, + 72 + ] + } + ], + "range": [ + 7, + 74 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 75 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 177 + ] + } + ], + "range": [ + 161, + 179 + ] + }, + { + "category": "Identifier", + "range": [ + 180, + 184 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 186, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 202 + ] + } + ], + "range": [ + 186, + 202 + ] + } + ], + "range": [ + 161, + 204 + ] + }, + { + "category": "Identifier", + "range": [ + 205, + 209 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 211, + 219 + ] + }, + { + "category": "Identifier", + "range": [ + 220, + 226 + ] + } + ], + "range": [ + 211, + 226 + ] + } + ], + "range": [ + 161, + 228 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 229 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 75, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 75 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 229, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 229, + 229 + ], + "number": 4 + } + ] + ], + "paths": [ + "chained-property-access.js", + "chained-property-access.js" + ], + "oids": [ + "5914a55c722e29bde628ac81a0a863acd4c7fab0", + "709597662d3fc81801278309a6d7719404df9cdf" + ] + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 5914a55..7095976 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1 +1,3 @@", + "+return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + "+return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f3f2a6e1032364aab733b4a8ed87fa66fe71cd40..7d1949aa8a939002afd35d7388419b83ff514a26" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 32, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 7, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 59, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 70, + 76 + ] + } + ], + "range": [ + 59, + 76 + ] + } + ], + "range": [ + 7, + 78 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 79 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 32, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 48 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "range": [ + 7, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 57, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + } + ], + "range": [ + 57, + 72 + ] + } + ], + "range": [ + 7, + 74 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 75 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 94 + ] + }, + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + } + ], + "range": [ + 86, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 127 + ] + } + ], + "range": [ + 111, + 127 + ] + } + ], + "range": [ + 86, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 134 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 145, + 151 + ] + } + ], + "range": [ + 136, + 151 + ] + } + ], + "range": [ + 86, + 153 + ] + } + ], + "range": [ + 79, + 154 + ] + } + ], + "range": [ + 79, + 154 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 154 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 82, + 90 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 82, + 100 + ] + }, + { + "category": "Identifier", + "range": [ + 101, + 105 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 115 + ] + }, + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 107, + 123 + ] + } + ], + "range": [ + 82, + 125 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 132, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 147 + ] + } + ], + "range": [ + 132, + 147 + ] + } + ], + "range": [ + 82, + 149 + ] + } + ], + "range": [ + 75, + 150 + ] + } + ], + "range": [ + 75, + 150 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 150 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 177 + ] + } + ], + "range": [ + 161, + 179 + ] + }, + { + "category": "Identifier", + "range": [ + 180, + 184 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 186, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 202 + ] + } + ], + "range": [ + 186, + 202 + ] + } + ], + "range": [ + 161, + 204 + ] + }, + { + "category": "Identifier", + "range": [ + 205, + 209 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 211, + 219 + ] + }, + { + "category": "Identifier", + "range": [ + 220, + 226 + ] + } + ], + "range": [ + 211, + 226 + ] + } + ], + "range": [ + 161, + 228 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 229 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 157, + 165 + ] + }, + { + "category": "Identifier", + "range": [ + 166, + 173 + ] + } + ], + "range": [ + 157, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 182, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 198 + ] + } + ], + "range": [ + 182, + 198 + ] + } + ], + "range": [ + 157, + 200 + ] + }, + { + "category": "Identifier", + "range": [ + 201, + 205 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 215 + ] + }, + { + "category": "Identifier", + "range": [ + 216, + 222 + ] + } + ], + "range": [ + 207, + 222 + ] + } + ], + "range": [ + 157, + 224 + ] + } + ], + "range": [ + 150, + 225 + ] + } + ], + "range": [ + 150, + 225 + ] + } + ], + "hasChanges": false, + "range": [ + 150, + 225 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 229, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 229, + 229 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 225, + 225 + ] + } + ], + "hasChanges": false, + "range": [ + 225, + 225 + ], + "number": 4 + } + ] + ], + "paths": [ + "chained-property-access.js", + "chained-property-access.js" + ], + "oids": [ + "709597662d3fc81801278309a6d7719404df9cdf", + "98df938b83ae88aa10111359beffa02fce9dbd81" + ] + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 7095976..98df938 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,3 +1,3 @@", + "-return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + "+return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7d1949aa8a939002afd35d7388419b83ff514a26..6e2dc74e68e53734e0a44bdd2397d55c37b770e2" +} +,{ + "testCaseDescription": "javascript-chained-property-access-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 32, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 48 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "range": [ + 7, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 57, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + } + ], + "range": [ + 57, + 72 + ] + } + ], + "range": [ + 7, + 74 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 75 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 32, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 7, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 59, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 70, + 76 + ] + } + ], + "range": [ + 59, + 76 + ] + } + ], + "range": [ + 7, + 78 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 79 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 82, + 90 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 82, + 100 + ] + }, + { + "category": "Identifier", + "range": [ + 101, + 105 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 115 + ] + }, + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 107, + 123 + ] + } + ], + "range": [ + 82, + 125 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 132, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 147 + ] + } + ], + "range": [ + 132, + 147 + ] + } + ], + "range": [ + 82, + 149 + ] + } + ], + "range": [ + 75, + 150 + ] + } + ], + "range": [ + 75, + 150 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 150 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 94 + ] + }, + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + } + ], + "range": [ + 86, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 127 + ] + } + ], + "range": [ + 111, + 127 + ] + } + ], + "range": [ + 86, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 134 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 145, + 151 + ] + } + ], + "range": [ + 136, + 151 + ] + } + ], + "range": [ + 86, + 153 + ] + } + ], + "range": [ + 79, + 154 + ] + } + ], + "range": [ + 79, + 154 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 154 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 157, + 165 + ] + }, + { + "category": "Identifier", + "range": [ + 166, + 173 + ] + } + ], + "range": [ + 157, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 182, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 198 + ] + } + ], + "range": [ + 182, + 198 + ] + } + ], + "range": [ + 157, + 200 + ] + }, + { + "category": "Identifier", + "range": [ + 201, + 205 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 215 + ] + }, + { + "category": "Identifier", + "range": [ + 216, + 222 + ] + } + ], + "range": [ + 207, + 222 + ] + } + ], + "range": [ + 157, + 224 + ] + } + ], + "range": [ + 150, + 225 + ] + } + ], + "range": [ + 150, + 225 + ] + } + ], + "hasChanges": false, + "range": [ + 150, + 225 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 177 + ] + } + ], + "range": [ + 161, + 179 + ] + }, + { + "category": "Identifier", + "range": [ + 180, + 184 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 186, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 202 + ] + } + ], + "range": [ + 186, + 202 + ] + } + ], + "range": [ + 161, + 204 + ] + }, + { + "category": "Identifier", + "range": [ + 205, + 209 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 211, + 219 + ] + }, + { + "category": "Identifier", + "range": [ + 220, + 226 + ] + } + ], + "range": [ + 211, + 226 + ] + } + ], + "range": [ + 161, + 228 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 229 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 225, + 225 + ] + } + ], + "hasChanges": false, + "range": [ + 225, + 225 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 229, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 229, + 229 + ], + "number": 4 + } + ] + ], + "paths": [ + "chained-property-access.js", + "chained-property-access.js" + ], + "oids": [ + "98df938b83ae88aa10111359beffa02fce9dbd81", + "709597662d3fc81801278309a6d7719404df9cdf" + ] + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 98df938..7095976 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,3 +1,3 @@", + "-return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + "+return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6e2dc74e68e53734e0a44bdd2397d55c37b770e2..cdb6f7928a5ab9445c48fd99678565f10d1e0b0b" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 7, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 70, + 76 + ] + } + ], + "range": [ + 59, + 76 + ] + } + ], + "range": [ + 7, + 78 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 79 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 79 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 94 + ] + }, + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + } + ], + "range": [ + 86, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 127 + ] + } + ], + "range": [ + 111, + 127 + ] + } + ], + "range": [ + 86, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 134 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 145, + 151 + ] + } + ], + "range": [ + 136, + 151 + ] + } + ], + "range": [ + 86, + 153 + ] + } + ], + "patch": "delete", + "range": [ + 79, + 154 + ] + } + ], + "range": [ + 79, + 154 + ] + } + ], + "hasChanges": true, + "range": [ + 79, + 154 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 177 + ] + } + ], + "range": [ + 161, + 179 + ] + }, + { + "category": "Identifier", + "range": [ + 180, + 184 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 186, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 202 + ] + } + ], + "range": [ + 186, + 202 + ] + } + ], + "range": [ + 161, + 204 + ] + }, + { + "category": "Identifier", + "range": [ + 205, + 209 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 211, + 219 + ] + }, + { + "category": "Identifier", + "range": [ + 220, + 226 + ] + } + ], + "range": [ + 211, + 226 + ] + } + ], + "range": [ + 161, + 228 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "range": [ + 154, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 229 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 48 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "range": [ + 7, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + } + ], + "range": [ + 57, + 72 + ] + } + ], + "range": [ + 7, + 74 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 75 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 82, + 90 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 82, + 100 + ] + }, + { + "category": "Identifier", + "range": [ + 101, + 105 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 117 + ] + }, + { + "category": "Identifier", + "range": [ + 118, + 125 + ] + } + ], + "range": [ + 107, + 125 + ] + } + ], + "range": [ + 82, + 127 + ] + }, + { + "category": "Identifier", + "range": [ + 128, + 132 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 134, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 145, + 151 + ] + } + ], + "range": [ + 134, + 151 + ] + } + ], + "range": [ + 82, + 153 + ] + } + ], + "patch": "insert", + "range": [ + 75, + 154 + ] + } + ], + "range": [ + 75, + 154 + ] + } + ], + "hasChanges": true, + "range": [ + 75, + 154 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 229, + 229 + ] + } + ], + "hasChanges": false, + "range": [ + 229, + 229 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 154, + 154 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 154 + ], + "number": 3 + } + ] + ], + "paths": [ + "chained-property-access.js", + "chained-property-access.js" + ], + "oids": [ + "709597662d3fc81801278309a6d7719404df9cdf", + "7b764ca90d3f25f4705d2744b4937e44b6284281" + ] + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 7095976..7b764ca 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,3 +1,2 @@", + "-return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )", + "-return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + "+return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cdb6f7928a5ab9445c48fd99678565f10d1e0b0b..d26157472f6fc6ea0ef66c22b3dac195cdd5006a" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 48 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "range": [ + 7, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + } + ], + "range": [ + 57, + 72 + ] + } + ], + "range": [ + 7, + 74 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 75 + ] + } + ], + "range": [ + 0, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 75 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 82, + 90 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 82, + 100 + ] + }, + { + "category": "Identifier", + "range": [ + 101, + 105 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 117 + ] + }, + { + "category": "Identifier", + "range": [ + 118, + 125 + ] + } + ], + "range": [ + 107, + 125 + ] + } + ], + "range": [ + 82, + 127 + ] + }, + { + "category": "Identifier", + "range": [ + 128, + 132 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 134, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 145, + 151 + ] + } + ], + "range": [ + 134, + 151 + ] + } + ], + "range": [ + 82, + 153 + ] + } + ], + "range": [ + 75, + 154 + ] + } + ], + "range": [ + 75, + 154 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 154 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 7, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 70, + 76 + ] + } + ], + "range": [ + 59, + 76 + ] + } + ], + "range": [ + 7, + 78 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 79 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 154, + 154 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 154 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 79, + 79 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 79 + ], + "number": 2 + } + ] + ], + "paths": [ + "chained-property-access.js", + "chained-property-access.js" + ], + "oids": [ + "7b764ca90d3f25f4705d2744b4937e44b6284281", + "5d6d3a0262ab69c2072556a807fb8938d2c605bb" + ] + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 7b764ca..5d6d3a0 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1,2 +1 @@", + "-return returned.promise().done( newDefer.resolve ).fail( newDefer.reject )", + " return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d26157472f6fc6ea0ef66c22b3dac195cdd5006a..a85470721ab757c33254d805cf99d43de95a2d23" +} +,{ + "testCaseDescription": "javascript-chained-property-access-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 7, + 25 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 43, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 7, + 52 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 70, + 76 + ] + } + ], + "range": [ + 59, + 76 + ] + } + ], + "range": [ + 7, + 78 + ] + } + ], + "range": [ + 0, + 79 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 79 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 79, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 79, + 79 + ], + "number": 2 + } + ] + ], + "paths": [ + "chained-property-access.js", + "chained-property-access.js" + ], + "oids": [ + "5d6d3a0262ab69c2072556a807fb8938d2c605bb", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "chained-property-access.js" + ], + "patch": [ + "diff --git a/chained-property-access.js b/chained-property-access.js", + "index 5d6d3a0..e69de29 100644", + "--- a/chained-property-access.js", + "+++ b/chained-property-access.js", + "@@ -1 +0,0 @@", + "-return returned.promise().done( otherDefer.resolve ).fail( otherDefer.reject )" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a85470721ab757c33254d805cf99d43de95a2d23..20036c5dfbcbfda6adb2ac623f76a2d33319daff" +}] diff --git a/test/corpus/json/javascript/class.json b/test/corpus/json/javascript/class.json new file mode 100644 index 000000000..6fee9e84e --- /dev/null +++ b/test/corpus/json/javascript/class.json @@ -0,0 +1,4680 @@ +[{ + "testCaseDescription": "javascript-class-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + } + ], + "range": [ + 73, + 82 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 0, + 86 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 87 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 87 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 87, + 87 + ] + } + ], + "hasChanges": true, + "range": [ + 87, + 87 + ], + "number": 2 + } + ] + ], + "paths": [ + "class.js", + "class.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "8f6ae64dbe49f3d6f2043226aea0eb8148d2751f" + ] + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index e69de29..8f6ae64 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -0,0 +1 @@", + "+class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "025ac2dcb7ae8e622fb5a7f0508e2ec9e15604f8..b8c0b35327672fc19a3bbbb950aa826d0b501b1d" +} +,{ + "testCaseDescription": "javascript-class-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 79 + ] + } + ], + "range": [ + 71, + 80 + ] + } + ], + "range": [ + 62, + 82 + ] + } + ], + "range": [ + 0, + 84 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 85 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 85 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 94 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 107 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 109 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + } + ], + "range": [ + 113, + 122 + ] + } + ], + "range": [ + 104, + 124 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 142, + 143 + ] + } + ], + "range": [ + 135, + 144 + ] + } + ], + "range": [ + 126, + 146 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 147, + 152 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 154 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 158, + 167 + ] + } + ], + "range": [ + 147, + 169 + ] + } + ], + "range": [ + 85, + 171 + ] + } + ], + "patch": "insert", + "range": [ + 85, + 172 + ] + } + ], + "range": [ + 85, + 172 + ] + } + ], + "hasChanges": true, + "range": [ + 85, + 172 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + } + ], + "range": [ + 73, + 82 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 0, + 86 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 87 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 178, + 181 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 208 + ] + } + ], + "range": [ + 200, + 209 + ] + } + ], + "range": [ + 191, + 211 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 213, + 216 + ] + }, + { + "category": "Identifier", + "range": [ + 217, + 218 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 229, + 230 + ] + } + ], + "range": [ + 222, + 231 + ] + } + ], + "range": [ + 213, + 233 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 234, + 239 + ] + }, + { + "category": "Identifier", + "range": [ + 240, + 241 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 252, + 253 + ] + } + ], + "range": [ + 245, + 254 + ] + } + ], + "range": [ + 234, + 256 + ] + } + ], + "range": [ + 172, + 258 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 172, + 259 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 87, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 87 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 259, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 259, + 259 + ], + "number": 4 + } + ] + ], + "paths": [ + "class.js", + "class.js" + ], + "oids": [ + "8f6ae64dbe49f3d6f2043226aea0eb8148d2751f", + "b509437fd330d637bc4043a60bfc8202dfe8b258" + ] + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index 8f6ae64..b509437 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1 +1,3 @@", + "+class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + "+class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b8c0b35327672fc19a3bbbb950aa826d0b501b1d..8385c4226c156fe5e6bf67a99d00305e085e535c" +} +,{ + "testCaseDescription": "javascript-class-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "patch": "delete", + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 79 + ] + } + ], + "range": [ + 71, + 80 + ] + } + ], + "patch": "delete", + "range": [ + 62, + 82 + ] + } + ], + "range": [ + 0, + 84 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 85 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "patch": "insert", + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + } + ], + "range": [ + 73, + 82 + ] + } + ], + "patch": "insert", + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 0, + 86 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 87 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 94 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 107 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 109 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + } + ], + "range": [ + 113, + 122 + ] + } + ], + "range": [ + 104, + 124 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 142, + 143 + ] + } + ], + "range": [ + 135, + 144 + ] + } + ], + "range": [ + 126, + 146 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 147, + 152 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 154 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 158, + 167 + ] + } + ], + "range": [ + 147, + 169 + ] + } + ], + "range": [ + 85, + 171 + ] + } + ], + "range": [ + 85, + 172 + ] + } + ], + "range": [ + 85, + 172 + ] + } + ], + "hasChanges": false, + "range": [ + 85, + 172 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 93, + 96 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 109 + ] + }, + { + "category": "Identifier", + "range": [ + 110, + 111 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 115, + 124 + ] + } + ], + "range": [ + 106, + 126 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 128, + 131 + ] + }, + { + "category": "Identifier", + "range": [ + 132, + 133 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 144, + 145 + ] + } + ], + "range": [ + 137, + 146 + ] + } + ], + "range": [ + 128, + 148 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 149, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 155, + 156 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 167, + 168 + ] + } + ], + "range": [ + 160, + 169 + ] + } + ], + "range": [ + 149, + 171 + ] + } + ], + "range": [ + 87, + 173 + ] + } + ], + "range": [ + 87, + 174 + ] + } + ], + "range": [ + 87, + 174 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 174 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 178, + 181 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 208 + ] + } + ], + "range": [ + 200, + 209 + ] + } + ], + "range": [ + 191, + 211 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 213, + 216 + ] + }, + { + "category": "Identifier", + "range": [ + 217, + 218 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 229, + 230 + ] + } + ], + "range": [ + 222, + 231 + ] + } + ], + "range": [ + 213, + 233 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 234, + 239 + ] + }, + { + "category": "Identifier", + "range": [ + 240, + 241 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 252, + 253 + ] + } + ], + "range": [ + 245, + 254 + ] + } + ], + "range": [ + 234, + 256 + ] + } + ], + "range": [ + 172, + 258 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 172, + 259 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 180, + 183 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 193, + 196 + ] + }, + { + "category": "Identifier", + "range": [ + 197, + 198 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 209, + 210 + ] + } + ], + "range": [ + 202, + 211 + ] + } + ], + "range": [ + 193, + 213 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 218 + ] + }, + { + "category": "Identifier", + "range": [ + 219, + 220 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 231, + 232 + ] + } + ], + "range": [ + 224, + 233 + ] + } + ], + "range": [ + 215, + 235 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 236, + 241 + ] + }, + { + "category": "Identifier", + "range": [ + 242, + 243 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 254, + 255 + ] + } + ], + "range": [ + 247, + 256 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "range": [ + 174, + 260 + ] + } + ], + "range": [ + 174, + 261 + ] + } + ], + "range": [ + 174, + 261 + ] + } + ], + "hasChanges": false, + "range": [ + 174, + 261 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 259, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 259, + 259 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 261, + 261 + ] + } + ], + "hasChanges": false, + "range": [ + 261, + 261 + ], + "number": 4 + } + ] + ], + "paths": [ + "class.js", + "class.js" + ], + "oids": [ + "b509437fd330d637bc4043a60bfc8202dfe8b258", + "c4f5c91cec1c4f59df2ae283d70c8194697a777b" + ] + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index b509437..c4f5c91 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,3 +1,3 @@", + "-class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + "+class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8385c4226c156fe5e6bf67a99d00305e085e535c..ba68e53cd03ffdc79c72cd1d14aff85ac2bcbb6d" +} +,{ + "testCaseDescription": "javascript-class-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "patch": "delete", + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + } + ], + "range": [ + 73, + 82 + ] + } + ], + "patch": "delete", + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 0, + 86 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 87 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "patch": "insert", + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 79 + ] + } + ], + "range": [ + 71, + 80 + ] + } + ], + "patch": "insert", + "range": [ + 62, + 82 + ] + } + ], + "range": [ + 0, + 84 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 85 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 93, + 96 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 109 + ] + }, + { + "category": "Identifier", + "range": [ + 110, + 111 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 115, + 124 + ] + } + ], + "range": [ + 106, + 126 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 128, + 131 + ] + }, + { + "category": "Identifier", + "range": [ + 132, + 133 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 144, + 145 + ] + } + ], + "range": [ + 137, + 146 + ] + } + ], + "range": [ + 128, + 148 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 149, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 155, + 156 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 167, + 168 + ] + } + ], + "range": [ + 160, + 169 + ] + } + ], + "range": [ + 149, + 171 + ] + } + ], + "range": [ + 87, + 173 + ] + } + ], + "range": [ + 87, + 174 + ] + } + ], + "range": [ + 87, + 174 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 174 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 94 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 107 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 109 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + } + ], + "range": [ + 113, + 122 + ] + } + ], + "range": [ + 104, + 124 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 142, + 143 + ] + } + ], + "range": [ + 135, + 144 + ] + } + ], + "range": [ + 126, + 146 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 147, + 152 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 154 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 158, + 167 + ] + } + ], + "range": [ + 147, + 169 + ] + } + ], + "range": [ + 85, + 171 + ] + } + ], + "range": [ + 85, + 172 + ] + } + ], + "range": [ + 85, + 172 + ] + } + ], + "hasChanges": false, + "range": [ + 85, + 172 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 180, + 183 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 193, + 196 + ] + }, + { + "category": "Identifier", + "range": [ + 197, + 198 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 209, + 210 + ] + } + ], + "range": [ + 202, + 211 + ] + } + ], + "range": [ + 193, + 213 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 218 + ] + }, + { + "category": "Identifier", + "range": [ + 219, + 220 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 231, + 232 + ] + } + ], + "range": [ + 224, + 233 + ] + } + ], + "range": [ + 215, + 235 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 236, + 241 + ] + }, + { + "category": "Identifier", + "range": [ + 242, + 243 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 254, + 255 + ] + } + ], + "range": [ + 247, + 256 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "range": [ + 174, + 260 + ] + } + ], + "range": [ + 174, + 261 + ] + } + ], + "range": [ + 174, + 261 + ] + } + ], + "hasChanges": false, + "range": [ + 174, + 261 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 178, + 181 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 208 + ] + } + ], + "range": [ + 200, + 209 + ] + } + ], + "range": [ + 191, + 211 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 213, + 216 + ] + }, + { + "category": "Identifier", + "range": [ + 217, + 218 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 229, + 230 + ] + } + ], + "range": [ + 222, + 231 + ] + } + ], + "range": [ + 213, + 233 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 234, + 239 + ] + }, + { + "category": "Identifier", + "range": [ + 240, + 241 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 252, + 253 + ] + } + ], + "range": [ + 245, + 254 + ] + } + ], + "range": [ + 234, + 256 + ] + } + ], + "range": [ + 172, + 258 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 172, + 259 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 261, + 261 + ] + } + ], + "hasChanges": false, + "range": [ + 261, + 261 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 259, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 259, + 259 + ], + "number": 4 + } + ] + ], + "paths": [ + "class.js", + "class.js" + ], + "oids": [ + "c4f5c91cec1c4f59df2ae283d70c8194697a777b", + "b509437fd330d637bc4043a60bfc8202dfe8b258" + ] + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index c4f5c91..b509437 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,3 +1,3 @@", + "-class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + "+class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ba68e53cd03ffdc79c72cd1d14aff85ac2bcbb6d..ba852685e6014e0c26c2a092de5c242d5c3d34fc" +} +,{ + "testCaseDescription": "javascript-class-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 79 + ] + } + ], + "range": [ + 71, + 80 + ] + } + ], + "range": [ + 62, + 82 + ] + } + ], + "range": [ + 0, + 84 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 85 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 85 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 94 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 107 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 109 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + } + ], + "range": [ + 113, + 122 + ] + } + ], + "range": [ + 104, + 124 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 142, + 143 + ] + } + ], + "range": [ + 135, + 144 + ] + } + ], + "range": [ + 126, + 146 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 147, + 152 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 154 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 158, + 167 + ] + } + ], + "range": [ + 147, + 169 + ] + } + ], + "range": [ + 85, + 171 + ] + } + ], + "patch": "delete", + "range": [ + 85, + 172 + ] + } + ], + "range": [ + 85, + 172 + ] + } + ], + "hasChanges": true, + "range": [ + 85, + 172 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 178, + 181 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 208 + ] + } + ], + "range": [ + 200, + 209 + ] + } + ], + "range": [ + 191, + 211 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 213, + 216 + ] + }, + { + "category": "Identifier", + "range": [ + 217, + 218 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 229, + 230 + ] + } + ], + "range": [ + 222, + 231 + ] + } + ], + "range": [ + 213, + 233 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 234, + 239 + ] + }, + { + "category": "Identifier", + "range": [ + 240, + 241 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 252, + 253 + ] + } + ], + "range": [ + 245, + 254 + ] + } + ], + "range": [ + 234, + 256 + ] + } + ], + "range": [ + 172, + 258 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "range": [ + 172, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 172, + 259 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + } + ], + "range": [ + 73, + 82 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 0, + 86 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 87 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 93, + 96 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 109 + ] + }, + { + "category": "Identifier", + "range": [ + 110, + 111 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 115, + 124 + ] + } + ], + "range": [ + 106, + 126 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 128, + 131 + ] + }, + { + "category": "Identifier", + "range": [ + 132, + 133 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 144, + 145 + ] + } + ], + "range": [ + 137, + 146 + ] + } + ], + "range": [ + 128, + 148 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 149, + 152 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 154 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 158, + 167 + ] + } + ], + "range": [ + 149, + 169 + ] + } + ], + "range": [ + 87, + 171 + ] + } + ], + "patch": "insert", + "range": [ + 87, + 172 + ] + } + ], + "range": [ + 87, + 172 + ] + } + ], + "hasChanges": true, + "range": [ + 87, + 172 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 259, + 259 + ] + } + ], + "hasChanges": false, + "range": [ + 259, + 259 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 172, + 172 + ] + } + ], + "hasChanges": false, + "range": [ + 172, + 172 + ], + "number": 3 + } + ] + ], + "paths": [ + "class.js", + "class.js" + ], + "oids": [ + "b509437fd330d637bc4043a60bfc8202dfe8b258", + "b1ef404f85e863410d324f59cc25d4506b4e3385" + ] + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index b509437..b1ef404 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,3 +1,2 @@", + "-class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }", + "-class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + "+class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ba852685e6014e0c26c2a092de5c242d5c3d34fc..6ebb5eb0cca061d650120b97379df9a26bc1a7c3" +} +,{ + "testCaseDescription": "javascript-class-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + } + ], + "range": [ + 73, + 82 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 0, + 86 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 87 + ] + } + ], + "range": [ + 0, + 87 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 87 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 93, + 96 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 109 + ] + }, + { + "category": "Identifier", + "range": [ + 110, + 111 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 115, + 124 + ] + } + ], + "range": [ + 106, + 126 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 128, + 131 + ] + }, + { + "category": "Identifier", + "range": [ + 132, + 133 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 144, + 145 + ] + } + ], + "range": [ + 137, + 146 + ] + } + ], + "range": [ + 128, + 148 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 149, + 152 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 154 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 158, + 167 + ] + } + ], + "range": [ + 149, + 169 + ] + } + ], + "range": [ + 87, + 171 + ] + } + ], + "range": [ + 87, + 172 + ] + } + ], + "range": [ + 87, + 172 + ] + } + ], + "hasChanges": false, + "range": [ + 87, + 172 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 79 + ] + } + ], + "range": [ + 71, + 80 + ] + } + ], + "range": [ + 62, + 82 + ] + } + ], + "range": [ + 0, + 84 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 85 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 172, + 172 + ] + } + ], + "hasChanges": false, + "range": [ + 172, + 172 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 85, + 85 + ] + } + ], + "hasChanges": false, + "range": [ + 85, + 85 + ], + "number": 2 + } + ] + ], + "paths": [ + "class.js", + "class.js" + ], + "oids": [ + "b1ef404f85e863410d324f59cc25d4506b4e3385", + "2c17f72f428aa0b184cb0b54ce069f9920b8a647" + ] + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index b1ef404..2c17f72 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1,2 +1 @@", + "-class Foo { static one(a) { return a; }; two(b) { return b; } three(c) { return c; } }", + " class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6ebb5eb0cca061d650120b97379df9a26bc1a7c3..b990bf8d8e2680f56bc1fb39f8f36750ba4ba7fb" +} +,{ + "testCaseDescription": "javascript-class-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Class", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 9 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 28, + 37 + ] + } + ], + "range": [ + 19, + 39 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 58 + ] + } + ], + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 41, + 61 + ] + }, + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 79 + ] + } + ], + "range": [ + 71, + 80 + ] + } + ], + "range": [ + 62, + 82 + ] + } + ], + "range": [ + 0, + 84 + ] + } + ], + "range": [ + 0, + 85 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 85 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 85 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 85, + 85 + ] + } + ], + "hasChanges": true, + "range": [ + 85, + 85 + ], + "number": 2 + } + ] + ], + "paths": [ + "class.js", + "class.js" + ], + "oids": [ + "2c17f72f428aa0b184cb0b54ce069f9920b8a647", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "class.js" + ], + "patch": [ + "diff --git a/class.js b/class.js", + "index 2c17f72..e69de29 100644", + "--- a/class.js", + "+++ b/class.js", + "@@ -1 +0,0 @@", + "-class Foo { static foo(a) { return a; }; bar(b) { return b; } baz(c) { return c; } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b990bf8d8e2680f56bc1fb39f8f36750ba4ba7fb..f24de0d24746d9f2408eda661698733705bd8a14" +}] diff --git a/test/corpus/json/javascript/comma-operator.json b/test/corpus/json/javascript/comma-operator.json new file mode 100644 index 000000000..a814025aa --- /dev/null +++ b/test/corpus/json/javascript/comma-operator.json @@ -0,0 +1,2904 @@ +[{ + "testCaseDescription": "javascript-comma-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 14, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 14, + 14 + ], + "number": 2 + } + ] + ], + "paths": [ + "comma-operator.js", + "comma-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "cff019f3ebc7414d076fca3712154a90d2f984e2" + ] + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index e69de29..cff019f 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -0,0 +1 @@", + "+a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ac9dba90a6e274a0ed1a230da35e51fd47c0eef4..66691850a16c2c62462cb0e35ddf66f28b75cc35" +} +,{ + "testCaseDescription": "javascript-comma-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 9, + 20 + ] + } + ], + "range": [ + 5, + 21 + ] + } + ], + "range": [ + 4, + 22 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 24, + 29 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "patch": "insert", + "range": [ + 24, + 37 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 14 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 42, + 43 + ] + } + ], + "range": [ + 38, + 43 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 49, + 50 + ] + } + ], + "range": [ + 45, + 50 + ] + } + ], + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 38, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 52 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 14, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 14 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + } + ] + ], + "paths": [ + "comma-operator.js", + "comma-operator.js" + ], + "oids": [ + "cff019f3ebc7414d076fca3712154a90d2f984e2", + "93ece10f5a31cedac35901950818e330466edc00" + ] + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index cff019f..93ece10 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1 +1,3 @@", + "+c = {d: (3, 4 + 5, 6)};", + "+a = 1, b = 2;", + " a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "66691850a16c2c62462cb0e35ddf66f28b75cc35..21ac1ff87f4564dd0b3305f5ad0546472397f93c" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 9, + 20 + ] + } + ], + "range": [ + 5, + 21 + ] + } + ], + "range": [ + 4, + 22 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 24, + 29 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "range": [ + 24, + 37 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 38 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 14, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 28 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 42, + 43 + ] + } + ], + "range": [ + 38, + 43 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 49, + 50 + ] + } + ], + "range": [ + 45, + 50 + ] + } + ], + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 38, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 52 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 28, + 33 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 40 + ] + } + ], + "range": [ + 28, + 40 + ] + } + ], + "range": [ + 28, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 42 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 42 + ], + "number": 4 + } + ] + ], + "paths": [ + "comma-operator.js", + "comma-operator.js" + ], + "oids": [ + "93ece10f5a31cedac35901950818e330466edc00", + "f738c2db2e69f694d1bf092477dd7d562bfa4843" + ] + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 93ece10..f738c2d 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,3 +1,3 @@", + "-c = {d: (3, 4 + 5, 6)};", + "+a = 1, b = 2;", + " a = 1, b = 2;", + " a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "21ac1ff87f4564dd0b3305f5ad0546472397f93c..6d5acfbdee3d00d5079694faee05edcccef90c9d" +} +,{ + "testCaseDescription": "javascript-comma-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 9, + 20 + ] + } + ], + "range": [ + 5, + 21 + ] + } + ], + "range": [ + 4, + 22 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 14, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 28 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 24, + 29 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "range": [ + 24, + 37 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 28, + 33 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 40 + ] + } + ], + "range": [ + 28, + 40 + ] + } + ], + "range": [ + 28, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 42 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 42, + 43 + ] + } + ], + "range": [ + 38, + 43 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 49, + 50 + ] + } + ], + "range": [ + 45, + 50 + ] + } + ], + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 38, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 52 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 42 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + } + ] + ], + "paths": [ + "comma-operator.js", + "comma-operator.js" + ], + "oids": [ + "f738c2db2e69f694d1bf092477dd7d562bfa4843", + "93ece10f5a31cedac35901950818e330466edc00" + ] + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index f738c2d..93ece10 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,3 +1,3 @@", + "-a = 1, b = 2;", + "+c = {d: (3, 4 + 5, 6)};", + " a = 1, b = 2;", + " a = 1, b = 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6d5acfbdee3d00d5079694faee05edcccef90c9d..68b6075b56afa34efaa8020f6edddf07755af8d2" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 9, + 20 + ] + } + ], + "range": [ + 5, + 21 + ] + } + ], + "range": [ + 4, + 22 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 24, + 29 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "patch": "delete", + "range": [ + 24, + 37 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 42, + 43 + ] + } + ], + "range": [ + 38, + 43 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 49, + 50 + ] + } + ], + "range": [ + 45, + 50 + ] + } + ], + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 38, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 52 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 23, + 24 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 26, + 27 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 23, + 34 + ] + } + ], + "range": [ + 19, + 35 + ] + } + ], + "range": [ + 18, + 36 + ] + } + ], + "range": [ + 14, + 36 + ] + } + ], + "patch": "insert", + "range": [ + 14, + 37 + ] + } + ], + "range": [ + 14, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 14, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 38, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 38 + ], + "number": 3 + } + ] + ], + "paths": [ + "comma-operator.js", + "comma-operator.js" + ], + "oids": [ + "93ece10f5a31cedac35901950818e330466edc00", + "297e28dd22e2db2dea07ce316731d4329815f429" + ] + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 93ece10..297e28d 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,3 +1,2 @@", + "-c = {d: (3, 4 + 5, 6)};", + "-a = 1, b = 2;", + " a = 1, b = 2;", + "+c = {d: (3, 4 + 5, 6)};" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "68b6075b56afa34efaa8020f6edddf07755af8d2..6b6cca519bfa2607fd54303b781add1a23f927a9" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "CommaOperator", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 23, + 24 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 26, + 27 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 23, + 34 + ] + } + ], + "range": [ + 19, + 35 + ] + } + ], + "range": [ + 18, + 36 + ] + } + ], + "range": [ + 14, + 36 + ] + } + ], + "range": [ + 14, + 37 + ] + } + ], + "range": [ + 14, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 38 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 9, + 20 + ] + } + ], + "range": [ + 5, + 21 + ] + } + ], + "range": [ + 4, + 22 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 38, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 38 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 2 + } + ] + ], + "paths": [ + "comma-operator.js", + "comma-operator.js" + ], + "oids": [ + "297e28dd22e2db2dea07ce316731d4329815f429", + "421bc7feea6a1d94fc1097a7835b15151ec55984" + ] + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 297e28d..421bc7f 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1,2 +1 @@", + "-a = 1, b = 2;", + " c = {d: (3, 4 + 5, 6)};" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6b6cca519bfa2607fd54303b781add1a23f927a9..4eb818100f3130330e2fe0f0decb77b827594365" +} +,{ + "testCaseDescription": "javascript-comma-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "CommaOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 9, + 20 + ] + } + ], + "range": [ + 5, + 21 + ] + } + ], + "range": [ + 4, + 22 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 24 + ], + "number": 2 + } + ] + ], + "paths": [ + "comma-operator.js", + "comma-operator.js" + ], + "oids": [ + "421bc7feea6a1d94fc1097a7835b15151ec55984", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "comma-operator.js" + ], + "patch": [ + "diff --git a/comma-operator.js b/comma-operator.js", + "index 421bc7f..e69de29 100644", + "--- a/comma-operator.js", + "+++ b/comma-operator.js", + "@@ -1 +0,0 @@", + "-c = {d: (3, 4 + 5, 6)};" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4eb818100f3130330e2fe0f0decb77b827594365..785493d3bbdebc780e436799269cfe3ecd5bbf77" +}] diff --git a/test/corpus/json/javascript/comment.json b/test/corpus/json/javascript/comment.json new file mode 100644 index 000000000..31071fd5a --- /dev/null +++ b/test/corpus/json/javascript/comment.json @@ -0,0 +1,1630 @@ +[{ + "testCaseDescription": "javascript-comment-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 0, + 21 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 22 + ], + "number": 2 + } + ] + ], + "paths": [ + "comment.js", + "comment.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "a5821d24d27222b5f5b8024ed74f0f7f339d877d" + ] + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index e69de29..a5821d2 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -0,0 +1 @@", + "+// This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b7c92617e1bc8e5fbcf483a8ea69e94339a33a4a..cf7c951b9c8ee1023cae2d7a32317a4362912261" +} +,{ + "testCaseDescription": "javascript-comment-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "insert", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 3 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "insert", + "range": [ + 3, + 23 + ] + } + ], + "range": [ + 3, + 23 + ] + } + ], + "hasChanges": true, + "range": [ + 3, + 23 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "insert", + "range": [ + 23, + 25 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 23, + 26 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "insert", + "range": [ + 26, + 47 + ] + } + ], + "range": [ + 26, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 26, + 48 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 48, + 69 + ] + } + ], + "range": [ + 48, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 70 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 70, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 70 + ], + "number": 6 + } + ] + ], + "paths": [ + "comment.js", + "comment.js" + ], + "oids": [ + "a5821d24d27222b5f5b8024ed74f0f7f339d877d", + "761aa7a3b13e167bf6b4e800787ddbf677bee26b" + ] + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index a5821d2..761aa7a 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1 +1,5 @@", + "+/*", + "+ * This is a method", + "+*/", + "+// This is a property", + " // This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cf7c951b9c8ee1023cae2d7a32317a4362912261..df64e896d53420fe0c45f73e4a7cd026b432de2c" +} +,{ + "testCaseDescription": "javascript-comment-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 3 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 3, + 23 + ] + } + ], + "range": [ + 3, + 23 + ] + } + ], + "hasChanges": true, + "range": [ + 3, + 23 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 23, + 25 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 23, + 26 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 26, + 47 + ] + } + ], + "range": [ + 26, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 48 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 22, + 43 + ] + } + ], + "range": [ + 22, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 44 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 48, + 69 + ] + } + ], + "range": [ + 48, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 70 + ], + "number": 5 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 44, + 65 + ] + } + ], + "range": [ + 44, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 66 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 70, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 70 + ], + "number": 6 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 4 + } + ] + ], + "paths": [ + "comment.js", + "comment.js" + ], + "oids": [ + "761aa7a3b13e167bf6b4e800787ddbf677bee26b", + "3b33406a01816465ab4e84b83e2815cf7db929e5" + ] + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 761aa7a..3b33406 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,5 +1,3 @@", + "-/*", + "- * This is a method", + "-*/", + "+// This is a property", + " // This is a property", + " // This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "df64e896d53420fe0c45f73e4a7cd026b432de2c..d66aef0291587fde4d520e86c9f50340aa83dc17" +} +,{ + "testCaseDescription": "javascript-comment-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 3 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 3, + 23 + ] + } + ], + "range": [ + 3, + 23 + ] + } + ], + "hasChanges": true, + "range": [ + 3, + 23 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "replace", + "range": [ + 23, + 25 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 23, + 26 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 22, + 43 + ] + } + ], + "range": [ + 22, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 44 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 26, + 47 + ] + } + ], + "range": [ + 26, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 48 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 44, + 65 + ] + } + ], + "range": [ + 44, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 66 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 48, + 69 + ] + } + ], + "range": [ + 48, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 70 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 70, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 70 + ], + "number": 6 + } + ] + ], + "paths": [ + "comment.js", + "comment.js" + ], + "oids": [ + "3b33406a01816465ab4e84b83e2815cf7db929e5", + "761aa7a3b13e167bf6b4e800787ddbf677bee26b" + ] + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 3b33406..761aa7a 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,3 +1,5 @@", + "-// This is a property", + "+/*", + "+ * This is a method", + "+*/", + " // This is a property", + " // This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d66aef0291587fde4d520e86c9f50340aa83dc17..7f0b4f05b850cba13b1f73b0c3a673c27c41c69f" +} +,{ + "testCaseDescription": "javascript-comment-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "delete", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 3 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "delete", + "range": [ + 3, + 23 + ] + } + ], + "range": [ + 3, + 23 + ] + } + ], + "hasChanges": true, + "range": [ + 3, + 23 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "delete", + "range": [ + 23, + 25 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 23, + 26 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "delete", + "range": [ + 26, + 47 + ] + } + ], + "range": [ + 26, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 26, + 48 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 48, + 69 + ] + } + ], + "range": [ + 48, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 70 + ], + "number": 5 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "insert", + "range": [ + 22, + 25 + ] + } + ], + "range": [ + 22, + 25 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 25 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "insert", + "range": [ + 25, + 45 + ] + } + ], + "range": [ + 25, + 45 + ] + } + ], + "hasChanges": true, + "range": [ + 25, + 45 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "insert", + "range": [ + 45, + 47 + ] + } + ], + "range": [ + 45, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 45, + 48 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 70, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 70 + ], + "number": 6 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 5 + } + ] + ], + "paths": [ + "comment.js", + "comment.js" + ], + "oids": [ + "761aa7a3b13e167bf6b4e800787ddbf677bee26b", + "c2a8148ac79eb59d05d153c2d7470b73ec1848c6" + ] + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 761aa7a..c2a8148 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,5 +1,4 @@", + "+// This is a property", + " /*", + " * This is a method", + " */", + "-// This is a property", + "-// This is a property" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7f0b4f05b850cba13b1f73b0c3a673c27c41c69f..7f6aeb575b8b29a59634bee8f9992d33a7326ad5" +} +,{ + "testCaseDescription": "javascript-comment-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "patch": "delete", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 22, + 25 + ] + } + ], + "range": [ + 22, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 25 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 3 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 25, + 45 + ] + } + ], + "range": [ + 25, + 45 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 45 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 3, + 23 + ] + } + ], + "range": [ + 3, + 23 + ] + } + ], + "hasChanges": false, + "range": [ + 3, + 23 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 45, + 47 + ] + } + ], + "range": [ + 45, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 45, + 48 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 23, + 25 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "hasChanges": false, + "range": [ + 23, + 26 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 5 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 26, + 26 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 26 + ], + "number": 4 + } + ] + ], + "paths": [ + "comment.js", + "comment.js" + ], + "oids": [ + "c2a8148ac79eb59d05d153c2d7470b73ec1848c6", + "7c74dcdf6bb8fb8f0b945321c9c2d23da6a9973d" + ] + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index c2a8148..7c74dcd 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,4 +1,3 @@", + "-// This is a property", + " /*", + " * This is a method", + " */" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7f6aeb575b8b29a59634bee8f9992d33a7326ad5..e4fd4adee259b94d3c2fd1f48c1b61c2489f6d13" +} +,{ + "testCaseDescription": "javascript-comment-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 0, + 3 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 3 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 3 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 3, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 3, + 23 + ] + } + ], + "hasChanges": true, + "range": [ + 3, + 23 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Comment", + "range": [ + 23, + 25 + ] + } + ], + "patch": "delete", + "range": [ + 23, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 23, + 26 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 26, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 26, + 26 + ], + "number": 4 + } + ] + ], + "paths": [ + "comment.js", + "comment.js" + ], + "oids": [ + "7c74dcdf6bb8fb8f0b945321c9c2d23da6a9973d", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "comment.js" + ], + "patch": [ + "diff --git a/comment.js b/comment.js", + "index 7c74dcd..e69de29 100644", + "--- a/comment.js", + "+++ b/comment.js", + "@@ -1,3 +0,0 @@", + "-/*", + "- * This is a method", + "-*/" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e4fd4adee259b94d3c2fd1f48c1b61c2489f6d13..954df1246c20f230e519c9fb74e256a93cd3e92a" +}] diff --git a/test/corpus/json/javascript/constructor-call.json b/test/corpus/json/javascript/constructor-call.json new file mode 100644 index 000000000..587d1dd26 --- /dev/null +++ b/test/corpus/json/javascript/constructor-call.json @@ -0,0 +1,2410 @@ +[{ + "testCaseDescription": "javascript-constructor-call-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 4, + 26 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 28 + ], + "number": 2 + } + ] + ], + "paths": [ + "constructor-call.js", + "constructor-call.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "9d723b9127f5d4f6a2df656e5afdc116be0fc4f9" + ] + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index e69de29..9d723b9 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -0,0 +1 @@", + "+new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "24ed5bdc27489ca788d6784b0385a26f77c8c9d7..2ec18c47ee0949d47e06d4b706051321d7393927" +} +,{ + "testCaseDescription": "javascript-constructor-call-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 4, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 29 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 30 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 47, + 48 + ] + }, + { + "category": "StringLiteral", + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 34, + 56 + ] + } + ], + "range": [ + 30, + 56 + ] + } + ], + "patch": "insert", + "range": [ + 30, + 57 + ] + } + ], + "range": [ + 30, + 58 + ] + } + ], + "hasChanges": true, + "range": [ + 30, + 58 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 4, + 26 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 28 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 74 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 75, + 76 + ] + }, + { + "category": "StringLiteral", + "range": [ + 78, + 83 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 58, + 84 + ] + } + ], + "range": [ + 58, + 85 + ] + } + ], + "range": [ + 58, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 58, + 86 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 86, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 86, + 86 + ], + "number": 4 + } + ] + ], + "paths": [ + "constructor-call.js", + "constructor-call.js" + ], + "oids": [ + "9d723b9127f5d4f6a2df656e5afdc116be0fc4f9", + "2c91b1151e6efdd7ecd99150edbe9cd50c19351c" + ] + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 9d723b9..2c91b11 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1 +1,3 @@", + "+new module.Klass(1, \"three\");", + "+new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2ec18c47ee0949d47e06d4b706051321d7393927..1790e7257c8d99f44abc41148a90f83b9a110d2c" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 4, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 30 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 4, + 26 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 47, + 48 + ] + }, + { + "category": "StringLiteral", + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 34, + 56 + ] + } + ], + "range": [ + 30, + 56 + ] + } + ], + "range": [ + 30, + 57 + ] + } + ], + "range": [ + 30, + 58 + ] + } + ], + "hasChanges": false, + "range": [ + 30, + 58 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 45, + 46 + ] + }, + { + "category": "StringLiteral", + "range": [ + 48, + 53 + ] + } + ], + "range": [ + 32, + 54 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 74 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 75, + 76 + ] + }, + { + "category": "StringLiteral", + "range": [ + 78, + 83 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 58, + 84 + ] + } + ], + "range": [ + 58, + 85 + ] + } + ], + "range": [ + 58, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 58, + 86 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 60, + 66 + ] + }, + { + "category": "Identifier", + "range": [ + 67, + 72 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 73, + 74 + ] + }, + { + "category": "StringLiteral", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 60, + 82 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 86, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 86, + 86 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + } + ] + ], + "paths": [ + "constructor-call.js", + "constructor-call.js" + ], + "oids": [ + "2c91b1151e6efdd7ecd99150edbe9cd50c19351c", + "892f5425143c4490d93486eaf63e4cb0c3b8b8b2" + ] + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 2c91b11..892f542 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,3 +1,3 @@", + "-new module.Klass(1, \"three\");", + "+new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1790e7257c8d99f44abc41148a90f83b9a110d2c..3900103a4bcd12d243d7b2932b5960777b7343e4" +} +,{ + "testCaseDescription": "javascript-constructor-call-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 4, + 26 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 4, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 30 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 45, + 46 + ] + }, + { + "category": "StringLiteral", + "range": [ + 48, + 53 + ] + } + ], + "range": [ + 32, + 54 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 47, + 48 + ] + }, + { + "category": "StringLiteral", + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 34, + 56 + ] + } + ], + "range": [ + 30, + 56 + ] + } + ], + "range": [ + 30, + 57 + ] + } + ], + "range": [ + 30, + 58 + ] + } + ], + "hasChanges": false, + "range": [ + 30, + 58 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 60, + 66 + ] + }, + { + "category": "Identifier", + "range": [ + 67, + 72 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 73, + 74 + ] + }, + { + "category": "StringLiteral", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 60, + 82 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 74 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 75, + 76 + ] + }, + { + "category": "StringLiteral", + "range": [ + 78, + 83 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 58, + 84 + ] + } + ], + "range": [ + 58, + 85 + ] + } + ], + "range": [ + 58, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 58, + 86 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 86, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 86, + 86 + ], + "number": 4 + } + ] + ], + "paths": [ + "constructor-call.js", + "constructor-call.js" + ], + "oids": [ + "892f5425143c4490d93486eaf63e4cb0c3b8b8b2", + "2c91b1151e6efdd7ecd99150edbe9cd50c19351c" + ] + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 892f542..2c91b11 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,3 +1,3 @@", + "-new module.Klass(1, \"two\");", + "+new module.Klass(1, \"three\");", + " new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3900103a4bcd12d243d7b2932b5960777b7343e4..8eaf061030a44928daec97fca055b3ca51141039" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 4, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 29 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 30 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 46 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 47, + 48 + ] + }, + { + "category": "StringLiteral", + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 34, + 56 + ] + } + ], + "range": [ + 30, + 56 + ] + } + ], + "patch": "delete", + "range": [ + 30, + 57 + ] + } + ], + "range": [ + 30, + 58 + ] + } + ], + "hasChanges": true, + "range": [ + 30, + 58 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 74 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 75, + 76 + ] + }, + { + "category": "StringLiteral", + "range": [ + 78, + 83 + ] + } + ], + "range": [ + 62, + 84 + ] + } + ], + "range": [ + 58, + 84 + ] + } + ], + "range": [ + 58, + 85 + ] + } + ], + "range": [ + 58, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 58, + 86 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 4, + 26 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 45, + 46 + ] + }, + { + "category": "StringLiteral", + "range": [ + 48, + 55 + ] + } + ], + "range": [ + 32, + 56 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "patch": "insert", + "range": [ + 28, + 57 + ] + } + ], + "range": [ + 28, + 58 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 58 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 86, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 86, + 86 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 58, + 58 + ] + } + ], + "hasChanges": false, + "range": [ + 58, + 58 + ], + "number": 3 + } + ] + ], + "paths": [ + "constructor-call.js", + "constructor-call.js" + ], + "oids": [ + "2c91b1151e6efdd7ecd99150edbe9cd50c19351c", + "cd77b9857f66642d7d9715eef7cc9b1cb6702036" + ] + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 2c91b11..cd77b98 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,3 +1,2 @@", + "-new module.Klass(1, \"three\");", + "-new module.Klass(1, \"two\");", + " new module.Klass(1, \"two\");", + "+new module.Klass(1, \"three\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8eaf061030a44928daec97fca055b3ca51141039..ae3ba92f8b0dd27d93e0b5c283f2bd76a3ae217f" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 4, + 26 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 45, + 46 + ] + }, + { + "category": "StringLiteral", + "range": [ + 48, + 55 + ] + } + ], + "range": [ + 32, + 56 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "range": [ + 28, + 57 + ] + } + ], + "range": [ + 28, + 58 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 58 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 4, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 30 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 58, + 58 + ] + } + ], + "hasChanges": false, + "range": [ + 58, + 58 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 30, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 30, + 30 + ], + "number": 2 + } + ] + ], + "paths": [ + "constructor-call.js", + "constructor-call.js" + ], + "oids": [ + "cd77b9857f66642d7d9715eef7cc9b1cb6702036", + "75f6a29e8aa603eddf12947dc41d1f887aec0e8b" + ] + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index cd77b98..75f6a29 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1,2 +1 @@", + "-new module.Klass(1, \"two\");", + " new module.Klass(1, \"three\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ae3ba92f8b0dd27d93e0b5c283f2bd76a3ae217f..41ff76acb7246669b7453dca3b1cd2d390fbd459" +} +,{ + "testCaseDescription": "javascript-constructor-call-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 27 + ] + } + ], + "range": [ + 4, + 28 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 30 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 30 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 30, + 30 + ] + } + ], + "hasChanges": true, + "range": [ + 30, + 30 + ], + "number": 2 + } + ] + ], + "paths": [ + "constructor-call.js", + "constructor-call.js" + ], + "oids": [ + "75f6a29e8aa603eddf12947dc41d1f887aec0e8b", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "constructor-call.js" + ], + "patch": [ + "diff --git a/constructor-call.js b/constructor-call.js", + "index 75f6a29..e69de29 100644", + "--- a/constructor-call.js", + "+++ b/constructor-call.js", + "@@ -1 +0,0 @@", + "-new module.Klass(1, \"three\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "41ff76acb7246669b7453dca3b1cd2d390fbd459..349ec3f8639b7b854f6fcfdaaf8e2ef63c05fef7" +}] diff --git a/test/corpus/json/javascript/delete-operator.json b/test/corpus/json/javascript/delete-operator.json new file mode 100644 index 000000000..1863dfeb9 --- /dev/null +++ b/test/corpus/json/javascript/delete-operator.json @@ -0,0 +1,2046 @@ +[{ + "testCaseDescription": "javascript-delete-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "StringLiteral", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 7, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 22 + ], + "number": 2 + } + ] + ], + "paths": [ + "delete-operator.js", + "delete-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "c83346db7cc26ffb88d39bba2e5ea473628a5d64" + ] + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index e69de29..c83346d 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -0,0 +1 @@", + "+delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ef3e803a7f48d3ce5e8de0ca9017609664e7ef16..0461e9260a4a5564683fbf96259d64c3562ba580" +} +,{ + "testCaseDescription": "javascript-delete-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 7, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 31, + 37 + ] + } + ], + "range": [ + 25, + 38 + ] + } + ], + "range": [ + 18, + 38 + ] + } + ], + "patch": "insert", + "range": [ + 18, + 39 + ] + } + ], + "range": [ + 18, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "StringLiteral", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 7, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 52 + ] + }, + { + "category": "StringLiteral", + "range": [ + 53, + 59 + ] + } + ], + "range": [ + 47, + 60 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "range": [ + 40, + 61 + ] + } + ], + "range": [ + 40, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 62 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + } + ] + ], + "paths": [ + "delete-operator.js", + "delete-operator.js" + ], + "oids": [ + "c83346db7cc26ffb88d39bba2e5ea473628a5d64", + "7c8b990856cc161278d88fbf344995bb0e511c79" + ] + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index c83346d..7c8b990 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1 +1,3 @@", + "+delete thing.prop", + "+delete thing['prop'];", + " delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0461e9260a4a5564683fbf96259d64c3562ba580..99c2bc8dc427e20c6fa363fcd86f595bfce7287b" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 7, + 17 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "StringLiteral", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 7, + 20 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 31, + 37 + ] + } + ], + "range": [ + 25, + 38 + ] + } + ], + "range": [ + 18, + 38 + ] + } + ], + "range": [ + 18, + 39 + ] + } + ], + "range": [ + 18, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 40 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 34 + ] + }, + { + "category": "StringLiteral", + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 22, + 42 + ] + } + ], + "range": [ + 22, + 43 + ] + } + ], + "range": [ + 22, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 44 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 52 + ] + }, + { + "category": "StringLiteral", + "range": [ + 53, + 59 + ] + } + ], + "range": [ + 47, + 60 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "range": [ + 40, + 61 + ] + } + ], + "range": [ + 40, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 62 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 56 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 64 + ] + } + ], + "range": [ + 44, + 64 + ] + } + ], + "range": [ + 44, + 65 + ] + } + ], + "range": [ + 44, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 66 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 4 + } + ] + ], + "paths": [ + "delete-operator.js", + "delete-operator.js" + ], + "oids": [ + "7c8b990856cc161278d88fbf344995bb0e511c79", + "f506e360a27ff5a46107a78305cb26eae376969a" + ] + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 7c8b990..f506e36 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,3 +1,3 @@", + "-delete thing.prop", + "+delete thing['prop'];", + " delete thing['prop'];", + " delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "99c2bc8dc427e20c6fa363fcd86f595bfce7287b..afb58bf5ef29de81c83d85b695c637a78769f7c4" +} +,{ + "testCaseDescription": "javascript-delete-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "StringLiteral", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 7, + 20 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 7, + 17 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 34 + ] + }, + { + "category": "StringLiteral", + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 22, + 42 + ] + } + ], + "range": [ + 22, + 43 + ] + } + ], + "range": [ + 22, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 44 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 31, + 37 + ] + } + ], + "range": [ + 25, + 38 + ] + } + ], + "range": [ + 18, + 38 + ] + } + ], + "range": [ + 18, + 39 + ] + } + ], + "range": [ + 18, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 56 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 64 + ] + } + ], + "range": [ + 44, + 64 + ] + } + ], + "range": [ + 44, + 65 + ] + } + ], + "range": [ + 44, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 66 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 52 + ] + }, + { + "category": "StringLiteral", + "range": [ + 53, + 59 + ] + } + ], + "range": [ + 47, + 60 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "range": [ + 40, + 61 + ] + } + ], + "range": [ + 40, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 62 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + } + ] + ], + "paths": [ + "delete-operator.js", + "delete-operator.js" + ], + "oids": [ + "f506e360a27ff5a46107a78305cb26eae376969a", + "7c8b990856cc161278d88fbf344995bb0e511c79" + ] + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index f506e36..7c8b990 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,3 +1,3 @@", + "-delete thing['prop'];", + "+delete thing.prop", + " delete thing['prop'];", + " delete thing['prop'];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "afb58bf5ef29de81c83d85b695c637a78769f7c4..380a9c46ee9372e02905f51f67580c6eaaa6c1c3" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 7, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 31, + 37 + ] + } + ], + "range": [ + 25, + 38 + ] + } + ], + "range": [ + 18, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 18, + 39 + ] + } + ], + "range": [ + 18, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 52 + ] + }, + { + "category": "StringLiteral", + "range": [ + 53, + 59 + ] + } + ], + "range": [ + 47, + 60 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "range": [ + 40, + 61 + ] + } + ], + "range": [ + 40, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 62 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "StringLiteral", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 7, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 34 + ] + }, + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 22, + 39 + ] + } + ], + "patch": "insert", + "range": [ + 22, + 40 + ] + } + ], + "range": [ + 22, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 3 + } + ] + ], + "paths": [ + "delete-operator.js", + "delete-operator.js" + ], + "oids": [ + "7c8b990856cc161278d88fbf344995bb0e511c79", + "2dfe0799039bd2ada9ce8baae7d0bf386081de9e" + ] + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 7c8b990..2dfe079 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,3 +1,2 @@", + "-delete thing.prop", + "-delete thing['prop'];", + " delete thing['prop'];", + "+delete thing.prop" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "380a9c46ee9372e02905f51f67580c6eaaa6c1c3..4ba8af8d818542e86d02544a1b80c6301f7a89ea" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "StringLiteral", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 7, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 34 + ] + }, + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 22, + 39 + ] + } + ], + "range": [ + 22, + 40 + ] + } + ], + "range": [ + 22, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 40 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 7, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 2 + } + ] + ], + "paths": [ + "delete-operator.js", + "delete-operator.js" + ], + "oids": [ + "2dfe0799039bd2ada9ce8baae7d0bf386081de9e", + "9d68dfb82c6d88266f02270c6896ef7056448ef9" + ] + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 2dfe079..9d68dfb 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1,2 +1 @@", + "-delete thing['prop'];", + " delete thing.prop" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4ba8af8d818542e86d02544a1b80c6301f7a89ea..ce4b96be08657c97d2afe1c5a0604685d81cf378" +} +,{ + "testCaseDescription": "javascript-delete-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 7, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 18 + ], + "number": 2 + } + ] + ], + "paths": [ + "delete-operator.js", + "delete-operator.js" + ], + "oids": [ + "9d68dfb82c6d88266f02270c6896ef7056448ef9", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "delete-operator.js" + ], + "patch": [ + "diff --git a/delete-operator.js b/delete-operator.js", + "index 9d68dfb..e69de29 100644", + "--- a/delete-operator.js", + "+++ b/delete-operator.js", + "@@ -1 +0,0 @@", + "-delete thing.prop" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ce4b96be08657c97d2afe1c5a0604685d81cf378..5434e42ccac5d681cef511be2131960ba1884c93" +}] diff --git a/test/corpus/json/javascript/do-while-statement.json b/test/corpus/json/javascript/do-while-statement.json new file mode 100644 index 000000000..8f6ae824b --- /dev/null +++ b/test/corpus/json/javascript/do-while-statement.json @@ -0,0 +1,2648 @@ +[{ + "testCaseDescription": "javascript-do-while-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 5, + 24 + ] + } + ], + "range": [ + 5, + 25 + ] + } + ], + "range": [ + 3, + 27 + ] + }, + { + "category": "Boolean", + "range": [ + 35, + 39 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 42, + 42 + ], + "number": 2 + } + ] + ], + "paths": [ + "do-while-statement.js", + "do-while-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "d1ec804be028c1082c29147c22df5a1fd753125a" + ] + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index e69de29..d1ec804 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -0,0 +1 @@", + "+do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a22f0481bc6a70fba4f09d450abc7b2787f85762..7abcf89b7a75b91d70522e0d5aa9b9307ef26224" +} +,{ + "testCaseDescription": "javascript-do-while-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 28 + ] + } + ], + "range": [ + 5, + 29 + ] + } + ], + "range": [ + 5, + 30 + ] + } + ], + "range": [ + 3, + 32 + ] + }, + { + "category": "Boolean", + "range": [ + 40, + 45 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 48 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 64 + ] + }, + { + "category": "Identifier", + "range": [ + 65, + 71 + ] + } + ], + "range": [ + 53, + 72 + ] + } + ], + "range": [ + 53, + 73 + ] + } + ], + "range": [ + 51, + 75 + ] + }, + { + "category": "Boolean", + "range": [ + 83, + 87 + ] + } + ], + "patch": "insert", + "range": [ + 48, + 89 + ] + } + ], + "range": [ + 48, + 90 + ] + } + ], + "hasChanges": true, + "range": [ + 48, + 90 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 5, + 24 + ] + } + ], + "range": [ + 5, + 25 + ] + } + ], + "range": [ + 3, + 27 + ] + }, + { + "category": "Boolean", + "range": [ + 35, + 39 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 42 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + }, + { + "category": "Identifier", + "range": [ + 103, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 107, + 113 + ] + } + ], + "range": [ + 95, + 114 + ] + } + ], + "range": [ + 95, + 115 + ] + } + ], + "range": [ + 93, + 117 + ] + }, + { + "category": "Boolean", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 90, + 131 + ] + } + ], + "range": [ + 90, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 132 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 42 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + } + ] + ], + "paths": [ + "do-while-statement.js", + "do-while-statement.js" + ], + "oids": [ + "d1ec804be028c1082c29147c22df5a1fd753125a", + "d9a410d6571c70907e09d1e530a76acbd56b7c94" + ] + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index d1ec804..d9a410d 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1 +1,3 @@", + "+do { console.log(replacement); } while (false);", + "+do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7abcf89b7a75b91d70522e0d5aa9b9307ef26224..74d2541a79d1212236c1d9f7a9dd5138a5dcf059" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 17, + 28 + ] + } + ], + "range": [ + 5, + 29 + ] + } + ], + "range": [ + 5, + 30 + ] + } + ], + "range": [ + 3, + 32 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 48 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 5, + 24 + ] + } + ], + "range": [ + 5, + 25 + ] + } + ], + "range": [ + 3, + 27 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 35, + 39 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 64 + ] + }, + { + "category": "Identifier", + "range": [ + 65, + 71 + ] + } + ], + "range": [ + 53, + 72 + ] + } + ], + "range": [ + 53, + 73 + ] + } + ], + "range": [ + 51, + 75 + ] + }, + { + "category": "Boolean", + "range": [ + 83, + 87 + ] + } + ], + "range": [ + 48, + 89 + ] + } + ], + "range": [ + 48, + 90 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 90 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 65 + ] + } + ], + "range": [ + 47, + 66 + ] + } + ], + "range": [ + 47, + 67 + ] + } + ], + "range": [ + 45, + 69 + ] + }, + { + "category": "Boolean", + "range": [ + 77, + 81 + ] + } + ], + "range": [ + 42, + 83 + ] + } + ], + "range": [ + 42, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 84 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + }, + { + "category": "Identifier", + "range": [ + 103, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 107, + 113 + ] + } + ], + "range": [ + 95, + 114 + ] + } + ], + "range": [ + 95, + 115 + ] + } + ], + "range": [ + 93, + 117 + ] + }, + { + "category": "Boolean", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 90, + 131 + ] + } + ], + "range": [ + 90, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 132 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 89, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 97, + 100 + ] + }, + { + "category": "Identifier", + "range": [ + 101, + 107 + ] + } + ], + "range": [ + 89, + 108 + ] + } + ], + "range": [ + 89, + 109 + ] + } + ], + "range": [ + 87, + 111 + ] + }, + { + "category": "Boolean", + "range": [ + 119, + 123 + ] + } + ], + "range": [ + 84, + 125 + ] + } + ], + "range": [ + 84, + 126 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 126 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 126, + 126 + ] + } + ], + "hasChanges": false, + "range": [ + 126, + 126 + ], + "number": 4 + } + ] + ], + "paths": [ + "do-while-statement.js", + "do-while-statement.js" + ], + "oids": [ + "d9a410d6571c70907e09d1e530a76acbd56b7c94", + "4197835909b801739dc2901215041f848ccfbaa1" + ] + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index d9a410d..4197835 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,3 +1,3 @@", + "-do { console.log(replacement); } while (false);", + "+do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "74d2541a79d1212236c1d9f7a9dd5138a5dcf059..8133ce7720b56dceb36f7fd781e37f3348c7a72f" +} +,{ + "testCaseDescription": "javascript-do-while-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 5, + 24 + ] + } + ], + "range": [ + 5, + 25 + ] + } + ], + "range": [ + 3, + 27 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 35, + 39 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 17, + 28 + ] + } + ], + "range": [ + 5, + 29 + ] + } + ], + "range": [ + 5, + 30 + ] + } + ], + "range": [ + 3, + 32 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 48 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 65 + ] + } + ], + "range": [ + 47, + 66 + ] + } + ], + "range": [ + 47, + 67 + ] + } + ], + "range": [ + 45, + 69 + ] + }, + { + "category": "Boolean", + "range": [ + 77, + 81 + ] + } + ], + "range": [ + 42, + 83 + ] + } + ], + "range": [ + 42, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 84 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 64 + ] + }, + { + "category": "Identifier", + "range": [ + 65, + 71 + ] + } + ], + "range": [ + 53, + 72 + ] + } + ], + "range": [ + 53, + 73 + ] + } + ], + "range": [ + 51, + 75 + ] + }, + { + "category": "Boolean", + "range": [ + 83, + 87 + ] + } + ], + "range": [ + 48, + 89 + ] + } + ], + "range": [ + 48, + 90 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 90 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 89, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 97, + 100 + ] + }, + { + "category": "Identifier", + "range": [ + 101, + 107 + ] + } + ], + "range": [ + 89, + 108 + ] + } + ], + "range": [ + 89, + 109 + ] + } + ], + "range": [ + 87, + 111 + ] + }, + { + "category": "Boolean", + "range": [ + 119, + 123 + ] + } + ], + "range": [ + 84, + 125 + ] + } + ], + "range": [ + 84, + 126 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 126 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + }, + { + "category": "Identifier", + "range": [ + 103, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 107, + 113 + ] + } + ], + "range": [ + 95, + 114 + ] + } + ], + "range": [ + 95, + 115 + ] + } + ], + "range": [ + 93, + 117 + ] + }, + { + "category": "Boolean", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 90, + 131 + ] + } + ], + "range": [ + 90, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 132 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 126, + 126 + ] + } + ], + "hasChanges": false, + "range": [ + 126, + 126 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + } + ] + ], + "paths": [ + "do-while-statement.js", + "do-while-statement.js" + ], + "oids": [ + "4197835909b801739dc2901215041f848ccfbaa1", + "d9a410d6571c70907e09d1e530a76acbd56b7c94" + ] + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index 4197835..d9a410d 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,3 +1,3 @@", + "-do { console.log(insert); } while (true);", + "+do { console.log(replacement); } while (false);", + " do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8133ce7720b56dceb36f7fd781e37f3348c7a72f..c6c0469d03dd8958d0e0ad486cdd788101104fa7" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 28 + ] + } + ], + "range": [ + 5, + 29 + ] + } + ], + "range": [ + 5, + 30 + ] + } + ], + "range": [ + 3, + 32 + ] + }, + { + "category": "Boolean", + "range": [ + 40, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 48 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 64 + ] + }, + { + "category": "Identifier", + "range": [ + 65, + 71 + ] + } + ], + "range": [ + 53, + 72 + ] + } + ], + "range": [ + 53, + 73 + ] + } + ], + "range": [ + 51, + 75 + ] + }, + { + "category": "Boolean", + "range": [ + 83, + 87 + ] + } + ], + "patch": "delete", + "range": [ + 48, + 89 + ] + } + ], + "range": [ + 48, + 90 + ] + } + ], + "hasChanges": true, + "range": [ + 48, + 90 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 102 + ] + }, + { + "category": "Identifier", + "range": [ + 103, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 107, + 113 + ] + } + ], + "range": [ + 95, + 114 + ] + } + ], + "range": [ + 95, + 115 + ] + } + ], + "range": [ + 93, + 117 + ] + }, + { + "category": "Boolean", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 90, + 131 + ] + } + ], + "range": [ + 90, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 132 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 5, + 24 + ] + } + ], + "range": [ + 5, + 25 + ] + } + ], + "range": [ + 3, + 27 + ] + }, + { + "category": "Boolean", + "range": [ + 35, + 39 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 70 + ] + } + ], + "range": [ + 47, + 71 + ] + } + ], + "range": [ + 47, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + }, + { + "category": "Boolean", + "range": [ + 82, + 87 + ] + } + ], + "patch": "insert", + "range": [ + 42, + 89 + ] + } + ], + "range": [ + 42, + 90 + ] + } + ], + "hasChanges": true, + "range": [ + 42, + 90 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 90, + 90 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 90 + ], + "number": 3 + } + ] + ], + "paths": [ + "do-while-statement.js", + "do-while-statement.js" + ], + "oids": [ + "d9a410d6571c70907e09d1e530a76acbd56b7c94", + "c5291b47b88a3879190af5225191ff232cd4ebce" + ] + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index d9a410d..c5291b4 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,3 +1,2 @@", + "-do { console.log(replacement); } while (false);", + "-do { console.log(insert); } while (true);", + " do { console.log(insert); } while (true);", + "+do { console.log(replacement); } while (false);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c6c0469d03dd8958d0e0ad486cdd788101104fa7..3b1ba172e86f43f1976164c806df448a6bc53e3e" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 5, + 24 + ] + } + ], + "range": [ + 5, + 25 + ] + } + ], + "range": [ + 3, + 27 + ] + }, + { + "category": "Boolean", + "range": [ + 35, + 39 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 42 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 70 + ] + } + ], + "range": [ + 47, + 71 + ] + } + ], + "range": [ + 47, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + }, + { + "category": "Boolean", + "range": [ + 82, + 87 + ] + } + ], + "range": [ + 42, + 89 + ] + } + ], + "range": [ + 42, + 90 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 90 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 28 + ] + } + ], + "range": [ + 5, + 29 + ] + } + ], + "range": [ + 5, + 30 + ] + } + ], + "range": [ + 3, + 32 + ] + }, + { + "category": "Boolean", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 48 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 90, + 90 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 90 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 2 + } + ] + ], + "paths": [ + "do-while-statement.js", + "do-while-statement.js" + ], + "oids": [ + "c5291b47b88a3879190af5225191ff232cd4ebce", + "6085cb11f70dbccaedffcb6a02f1bde589b13168" + ] + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index c5291b4..6085cb1 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1,2 +1 @@", + "-do { console.log(insert); } while (true);", + " do { console.log(replacement); } while (false);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3b1ba172e86f43f1976164c806df448a6bc53e3e..cb580d744365fee8ee88e2dcc525cd7af8b237fc" +} +,{ + "testCaseDescription": "javascript-do-while-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 28 + ] + } + ], + "range": [ + 5, + 29 + ] + } + ], + "range": [ + 5, + 30 + ] + } + ], + "range": [ + 3, + 32 + ] + }, + { + "category": "Boolean", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 48 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": true, + "range": [ + 48, + 48 + ], + "number": 2 + } + ] + ], + "paths": [ + "do-while-statement.js", + "do-while-statement.js" + ], + "oids": [ + "6085cb11f70dbccaedffcb6a02f1bde589b13168", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "do-while-statement.js" + ], + "patch": [ + "diff --git a/do-while-statement.js b/do-while-statement.js", + "index 6085cb1..e69de29 100644", + "--- a/do-while-statement.js", + "+++ b/do-while-statement.js", + "@@ -1 +0,0 @@", + "-do { console.log(replacement); } while (false);" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cb580d744365fee8ee88e2dcc525cd7af8b237fc..9fdae081cef5395f539eef79836a911574344379" +}] diff --git a/test/corpus/json/javascript/export.json b/test/corpus/json/javascript/export.json new file mode 100644 index 000000000..b95c0f0f1 --- /dev/null +++ b/test/corpus/json/javascript/export.json @@ -0,0 +1,21372 @@ +[{ + "testCaseDescription": "javascript-export-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 39, + 96 + ] + } + ], + "patch": "insert", + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 97, + 128 + ] + } + ], + "patch": "insert", + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 129, + 185 + ] + } + ], + "patch": "insert", + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 214 + ] + } + ], + "range": [ + 186, + 215 + ] + } + ], + "patch": "insert", + "range": [ + 186, + 216 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 216 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 243, + 246 + ] + } + ], + "range": [ + 231, + 246 + ] + } + ], + "range": [ + 216, + 247 + ] + } + ], + "patch": "insert", + "range": [ + 216, + 248 + ] + } + ], + "hasChanges": true, + "range": [ + 216, + 248 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 272, + 277 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 280, + 283 + ] + } + ], + "range": [ + 263, + 283 + ] + } + ], + "range": [ + 248, + 284 + ] + } + ], + "patch": "insert", + "range": [ + 248, + 285 + ] + } + ], + "hasChanges": true, + "range": [ + 248, + 285 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 294, + 299 + ] + }, + { + "category": "Identifier", + "range": [ + 303, + 310 + ] + } + ], + "range": [ + 294, + 310 + ] + } + ], + "range": [ + 285, + 313 + ] + } + ], + "patch": "insert", + "range": [ + 285, + 314 + ] + } + ], + "hasChanges": true, + "range": [ + 285, + 314 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 328, + 333 + ] + } + ], + "range": [ + 314, + 334 + ] + } + ], + "patch": "insert", + "range": [ + 314, + 335 + ] + } + ], + "hasChanges": true, + "range": [ + 314, + 335 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 344, + 349 + ] + } + ], + "range": [ + 344, + 349 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 351, + 356 + ] + } + ], + "range": [ + 351, + 356 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 358, + 363 + ] + } + ], + "range": [ + 358, + 363 + ] + }, + { + "category": "StringLiteral", + "range": [ + 371, + 376 + ] + } + ], + "range": [ + 335, + 377 + ] + } + ], + "patch": "insert", + "range": [ + 335, + 378 + ] + } + ], + "hasChanges": true, + "range": [ + 335, + 378 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 394 + ] + }, + { + "category": "Identifier", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 387, + 403 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 405, + 412 + ] + }, + { + "category": "Identifier", + "range": [ + 416, + 421 + ] + } + ], + "range": [ + 405, + 421 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 423, + 428 + ] + } + ], + "range": [ + 423, + 428 + ] + }, + { + "category": "StringLiteral", + "range": [ + 436, + 441 + ] + } + ], + "range": [ + 378, + 442 + ] + } + ], + "patch": "insert", + "range": [ + 378, + 443 + ] + } + ], + "hasChanges": true, + "range": [ + 378, + 443 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 443, + 443 + ] + } + ], + "hasChanges": true, + "range": [ + 443, + 443 + ], + "number": 12 + } + ] + ], + "paths": [ + "export.js", + "export.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "dcd9320b8ffae85ce7a088ddfe4f68bb07c094f1" + ] + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index e69de29..dcd9320 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -0,0 +1,11 @@", + "+export { name1, name2, name3, nameN };", + "+export { variable1 as name1, variable2 as name2, nameN };", + "+export let name1, name2, nameN;", + "+export let name1 = value1, name2 = value2, name3, nameN;", + "+export default namedFunction;", + "+export default function () { };", + "+export default function name1() { };", + "+export { name1 as default };", + "+export * from 'foo';", + "+export { name1, name2, nameN } from 'foo';", + "+export { import1 as name1, import2 as name2, nameN } from 'bar';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0bb74af8eede739c6d9a6b79a13e61263d3c52e6..3d34a0f856d545b0a728805cb18bb843d66b31ef" +} +,{ + "testCaseDescription": "javascript-export-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "patch": "insert", + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "patch": "insert", + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "patch": "insert", + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 219 + ] + } + ], + "patch": "insert", + "range": [ + 186, + 220 + ] + } + ], + "range": [ + 186, + 221 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 221 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 245, + 253 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 256, + 258 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "patch": "insert", + "range": [ + 221, + 259 + ] + } + ], + "range": [ + 221, + 260 + ] + } + ], + "hasChanges": true, + "range": [ + 221, + 260 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 287, + 289 + ] + } + ], + "range": [ + 275, + 289 + ] + } + ], + "patch": "insert", + "range": [ + 260, + 290 + ] + } + ], + "range": [ + 260, + 291 + ] + } + ], + "hasChanges": true, + "range": [ + 260, + 291 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 300, + 305 + ] + }, + { + "category": "Identifier", + "range": [ + 309, + 318 + ] + } + ], + "range": [ + 300, + 318 + ] + } + ], + "patch": "insert", + "range": [ + 291, + 321 + ] + } + ], + "range": [ + 291, + 322 + ] + } + ], + "hasChanges": true, + "range": [ + 291, + 322 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 336, + 341 + ] + } + ], + "patch": "insert", + "range": [ + 322, + 342 + ] + } + ], + "range": [ + 322, + 343 + ] + } + ], + "hasChanges": true, + "range": [ + 322, + 343 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 352, + 357 + ] + } + ], + "range": [ + 352, + 357 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 359, + 364 + ] + } + ], + "range": [ + 359, + 364 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 366, + 371 + ] + } + ], + "range": [ + 366, + 371 + ] + }, + { + "category": "StringLiteral", + "range": [ + 379, + 385 + ] + } + ], + "patch": "insert", + "range": [ + 343, + 386 + ] + } + ], + "range": [ + 343, + 387 + ] + } + ], + "hasChanges": true, + "range": [ + 343, + 387 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 396, + 403 + ] + }, + { + "category": "Identifier", + "range": [ + 407, + 412 + ] + } + ], + "range": [ + 396, + 412 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 414, + 421 + ] + }, + { + "category": "Identifier", + "range": [ + 425, + 430 + ] + } + ], + "range": [ + 414, + 430 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 432, + 437 + ] + }, + { + "category": "StringLiteral", + "range": [ + 445, + 451 + ] + } + ], + "patch": "insert", + "range": [ + 387, + 452 + ] + } + ], + "range": [ + 387, + 453 + ] + } + ], + "hasChanges": true, + "range": [ + 387, + 453 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 462, + 467 + ] + } + ], + "range": [ + 462, + 467 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 469, + 474 + ] + } + ], + "range": [ + 469, + 474 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 476, + 481 + ] + } + ], + "range": [ + 476, + 481 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 483, + 488 + ] + } + ], + "range": [ + 483, + 488 + ] + } + ], + "patch": "insert", + "range": [ + 453, + 491 + ] + } + ], + "range": [ + 453, + 492 + ] + } + ], + "hasChanges": true, + "range": [ + 453, + 492 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 501, + 510 + ] + }, + { + "category": "Identifier", + "range": [ + 514, + 519 + ] + } + ], + "range": [ + 501, + 519 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 521, + 530 + ] + }, + { + "category": "Identifier", + "range": [ + 534, + 539 + ] + } + ], + "range": [ + 521, + 539 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 541, + 546 + ] + } + ], + "range": [ + 541, + 546 + ] + } + ], + "patch": "insert", + "range": [ + 492, + 549 + ] + } + ], + "range": [ + 492, + 550 + ] + } + ], + "hasChanges": true, + "range": [ + 492, + 550 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 561, + 566 + ] + } + ], + "range": [ + 561, + 566 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 568, + 573 + ] + } + ], + "range": [ + 568, + 573 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 575, + 580 + ] + } + ], + "range": [ + 575, + 580 + ] + } + ], + "patch": "insert", + "range": [ + 550, + 581 + ] + } + ], + "range": [ + 550, + 582 + ] + } + ], + "hasChanges": true, + "range": [ + 550, + 582 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 593, + 598 + ] + }, + { + "category": "Identifier", + "range": [ + 601, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 609, + 614 + ] + }, + { + "category": "Identifier", + "range": [ + 617, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 625, + 630 + ] + } + ], + "range": [ + 625, + 630 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 632, + 637 + ] + } + ], + "range": [ + 632, + 637 + ] + } + ], + "patch": "insert", + "range": [ + 582, + 638 + ] + } + ], + "range": [ + 582, + 639 + ] + } + ], + "hasChanges": true, + "range": [ + 582, + 639 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 654, + 667 + ] + } + ], + "patch": "insert", + "range": [ + 639, + 668 + ] + } + ], + "range": [ + 639, + 669 + ] + } + ], + "hasChanges": true, + "range": [ + 639, + 669 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 696, + 699 + ] + } + ], + "range": [ + 684, + 699 + ] + } + ], + "patch": "insert", + "range": [ + 669, + 700 + ] + } + ], + "range": [ + 669, + 701 + ] + } + ], + "hasChanges": true, + "range": [ + 669, + 701 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 725, + 730 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 733, + 736 + ] + } + ], + "range": [ + 716, + 736 + ] + } + ], + "patch": "insert", + "range": [ + 701, + 737 + ] + } + ], + "range": [ + 701, + 738 + ] + } + ], + "hasChanges": true, + "range": [ + 701, + 738 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 747, + 752 + ] + }, + { + "category": "Identifier", + "range": [ + 756, + 763 + ] + } + ], + "range": [ + 747, + 763 + ] + } + ], + "patch": "insert", + "range": [ + 738, + 766 + ] + } + ], + "range": [ + 738, + 767 + ] + } + ], + "hasChanges": true, + "range": [ + 738, + 767 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 781, + 786 + ] + } + ], + "patch": "insert", + "range": [ + 767, + 787 + ] + } + ], + "range": [ + 767, + 788 + ] + } + ], + "hasChanges": true, + "range": [ + 767, + 788 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 797, + 802 + ] + } + ], + "range": [ + 797, + 802 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 804, + 809 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 811, + 816 + ] + } + ], + "range": [ + 811, + 816 + ] + }, + { + "category": "StringLiteral", + "range": [ + 824, + 829 + ] + } + ], + "patch": "insert", + "range": [ + 788, + 830 + ] + } + ], + "range": [ + 788, + 831 + ] + } + ], + "hasChanges": true, + "range": [ + 788, + 831 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 840, + 847 + ] + }, + { + "category": "Identifier", + "range": [ + 851, + 856 + ] + } + ], + "range": [ + 840, + 856 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 858, + 865 + ] + }, + { + "category": "Identifier", + "range": [ + 869, + 874 + ] + } + ], + "range": [ + 858, + 874 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 881 + ] + } + ], + "range": [ + 876, + 881 + ] + }, + { + "category": "StringLiteral", + "range": [ + 889, + 894 + ] + } + ], + "patch": "insert", + "range": [ + 831, + 895 + ] + } + ], + "range": [ + 831, + 896 + ] + } + ], + "hasChanges": true, + "range": [ + 831, + 896 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 39 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 905, + 910 + ] + } + ], + "range": [ + 905, + 910 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 912, + 917 + ] + } + ], + "range": [ + 912, + 917 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 919, + 924 + ] + } + ], + "range": [ + 919, + 924 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 896, + 934 + ] + } + ], + "range": [ + 896, + 935 + ] + } + ], + "hasChanges": false, + "range": [ + 896, + 935 + ], + "number": 23 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 97 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 944, + 953 + ] + }, + { + "category": "Identifier", + "range": [ + 957, + 962 + ] + } + ], + "range": [ + 944, + 962 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 964, + 973 + ] + }, + { + "category": "Identifier", + "range": [ + 977, + 982 + ] + } + ], + "range": [ + 964, + 982 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 935, + 992 + ] + } + ], + "range": [ + 935, + 993 + ] + } + ], + "hasChanges": false, + "range": [ + 935, + 993 + ], + "number": 24 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": false, + "range": [ + 97, + 129 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1004, + 1009 + ] + } + ], + "range": [ + 1004, + 1009 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1016 + ] + } + ], + "range": [ + 1011, + 1016 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 993, + 1024 + ] + } + ], + "range": [ + 993, + 1025 + ] + } + ], + "hasChanges": false, + "range": [ + 993, + 1025 + ], + "number": 25 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": false, + "range": [ + 129, + 186 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1036, + 1041 + ] + }, + { + "category": "Identifier", + "range": [ + 1044, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1052, + 1057 + ] + }, + { + "category": "Identifier", + "range": [ + 1060, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1068, + 1073 + ] + } + ], + "range": [ + 1068, + 1073 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1025, + 1081 + ] + } + ], + "range": [ + 1025, + 1082 + ] + } + ], + "hasChanges": false, + "range": [ + 1025, + 1082 + ], + "number": 26 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 214 + ] + } + ], + "range": [ + 186, + 215 + ] + } + ], + "range": [ + 186, + 216 + ] + } + ], + "hasChanges": false, + "range": [ + 186, + 216 + ], + "number": 5 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 1097, + 1110 + ] + } + ], + "range": [ + 1082, + 1111 + ] + } + ], + "range": [ + 1082, + 1112 + ] + } + ], + "hasChanges": false, + "range": [ + 1082, + 1112 + ], + "number": 27 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 243, + 246 + ] + } + ], + "range": [ + 231, + 246 + ] + } + ], + "range": [ + 216, + 247 + ] + } + ], + "range": [ + 216, + 248 + ] + } + ], + "hasChanges": false, + "range": [ + 216, + 248 + ], + "number": 6 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 1139, + 1142 + ] + } + ], + "range": [ + 1127, + 1142 + ] + } + ], + "range": [ + 1112, + 1143 + ] + } + ], + "range": [ + 1112, + 1144 + ] + } + ], + "hasChanges": false, + "range": [ + 1112, + 1144 + ], + "number": 28 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 272, + 277 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 280, + 283 + ] + } + ], + "range": [ + 263, + 283 + ] + } + ], + "range": [ + 248, + 284 + ] + } + ], + "range": [ + 248, + 285 + ] + } + ], + "hasChanges": false, + "range": [ + 248, + 285 + ], + "number": 7 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1168, + 1173 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 1176, + 1179 + ] + } + ], + "range": [ + 1159, + 1179 + ] + } + ], + "range": [ + 1144, + 1180 + ] + } + ], + "range": [ + 1144, + 1181 + ] + } + ], + "hasChanges": false, + "range": [ + 1144, + 1181 + ], + "number": 29 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 294, + 299 + ] + }, + { + "category": "Identifier", + "range": [ + 303, + 310 + ] + } + ], + "range": [ + 294, + 310 + ] + } + ], + "range": [ + 285, + 313 + ] + } + ], + "range": [ + 285, + 314 + ] + } + ], + "hasChanges": false, + "range": [ + 285, + 314 + ], + "number": 8 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1190, + 1195 + ] + }, + { + "category": "Identifier", + "range": [ + 1199, + 1206 + ] + } + ], + "range": [ + 1190, + 1206 + ] + } + ], + "range": [ + 1181, + 1209 + ] + } + ], + "range": [ + 1181, + 1210 + ] + } + ], + "hasChanges": false, + "range": [ + 1181, + 1210 + ], + "number": 30 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 328, + 333 + ] + } + ], + "range": [ + 314, + 334 + ] + } + ], + "range": [ + 314, + 335 + ] + } + ], + "hasChanges": false, + "range": [ + 314, + 335 + ], + "number": 9 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1224, + 1229 + ] + } + ], + "range": [ + 1210, + 1230 + ] + } + ], + "range": [ + 1210, + 1231 + ] + } + ], + "hasChanges": false, + "range": [ + 1210, + 1231 + ], + "number": 31 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 344, + 349 + ] + } + ], + "range": [ + 344, + 349 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 351, + 356 + ] + } + ], + "range": [ + 351, + 356 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 358, + 363 + ] + } + ], + "range": [ + 358, + 363 + ] + }, + { + "category": "StringLiteral", + "range": [ + 371, + 376 + ] + } + ], + "range": [ + 335, + 377 + ] + } + ], + "range": [ + 335, + 378 + ] + } + ], + "hasChanges": false, + "range": [ + 335, + 378 + ], + "number": 10 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1240, + 1245 + ] + } + ], + "range": [ + 1240, + 1245 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1247, + 1252 + ] + } + ], + "range": [ + 1247, + 1252 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1254, + 1259 + ] + } + ], + "range": [ + 1254, + 1259 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1267, + 1272 + ] + } + ], + "range": [ + 1231, + 1273 + ] + } + ], + "range": [ + 1231, + 1274 + ] + } + ], + "hasChanges": false, + "range": [ + 1231, + 1274 + ], + "number": 32 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 394 + ] + }, + { + "category": "Identifier", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 387, + 403 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 405, + 412 + ] + }, + { + "category": "Identifier", + "range": [ + 416, + 421 + ] + } + ], + "range": [ + 405, + 421 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 423, + 428 + ] + } + ], + "range": [ + 423, + 428 + ] + }, + { + "category": "StringLiteral", + "range": [ + 436, + 441 + ] + } + ], + "range": [ + 378, + 442 + ] + } + ], + "range": [ + 378, + 443 + ] + } + ], + "hasChanges": false, + "range": [ + 378, + 443 + ], + "number": 11 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1283, + 1290 + ] + }, + { + "category": "Identifier", + "range": [ + 1294, + 1299 + ] + } + ], + "range": [ + 1283, + 1299 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1301, + 1308 + ] + }, + { + "category": "Identifier", + "range": [ + 1312, + 1317 + ] + } + ], + "range": [ + 1301, + 1317 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1319, + 1324 + ] + } + ], + "range": [ + 1319, + 1324 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1332, + 1337 + ] + } + ], + "range": [ + 1274, + 1338 + ] + } + ], + "range": [ + 1274, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1274, + 1339 + ], + "number": 33 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 443, + 443 + ] + } + ], + "hasChanges": false, + "range": [ + 443, + 443 + ], + "number": 12 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1339, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1339, + 1339 + ], + "number": 34 + } + ] + ], + "paths": [ + "export.js", + "export.js" + ], + "oids": [ + "dcd9320b8ffae85ce7a088ddfe4f68bb07c094f1", + "c8b53ff3b2b7c29c2bcdc40c98608cf8b3d12134" + ] + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index dcd9320..c8b53ff 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,3 +1,25 @@", + "+export { name4, name5, name6, nameZ };", + "+export { variable2 as name2, variable3 as name3, nameY };", + "+export let name3, name4, nameT;", + "+export let name2 = value2, name3 = value3, name4, nameO;", + "+export default otherNamedFunction;", + "+export default function newName1() {};", + "+export default function () {};", + "+export { name2 as statement };", + "+export * from 'baz';", + "+export { name7, name8, nameP } from 'buzz';", + "+export { import6 as name6, import7 as name7, nameB } from 'fizz';", + "+export { name1, name2, name3, nameN };", + "+export { variable1 as name1, variable2 as name2, nameN };", + "+export let name1, name2, nameN;", + "+export let name1 = value1, name2 = value2, name3, nameN;", + "+export default namedFunction;", + "+export default function () { };", + "+export default function name1() { };", + "+export { name1 as default };", + "+export * from 'foo';", + "+export { name1, name2, nameN } from 'foo';", + "+export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3d34a0f856d545b0a728805cb18bb843d66b31ef..14555cd2f315cd841f9d581c0dda879f1f3d2dd7" +} +,{ + "testCaseDescription": "javascript-export-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 201, + 219 + ] + } + ], + "range": [ + 186, + 220 + ] + } + ], + "range": [ + 186, + 221 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 221 + ], + "number": 5 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 201, + 214 + ] + } + ], + "range": [ + 186, + 215 + ] + } + ], + "range": [ + 186, + 216 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 216 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 243, + 246 + ] + } + ], + "range": [ + 231, + 246 + ] + } + ], + "patch": "insert", + "range": [ + 216, + 247 + ] + } + ], + "range": [ + 216, + 248 + ] + } + ], + "hasChanges": true, + "range": [ + 216, + 248 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 245, + 253 + ] + }, + { + "category": "ExpressionStatements", + "patch": "replace", + "range": [ + 256, + 258 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "range": [ + 221, + 259 + ] + } + ], + "range": [ + 221, + 260 + ] + } + ], + "hasChanges": true, + "range": [ + 221, + 260 + ], + "number": 6 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 272, + 277 + ] + }, + { + "category": "ExpressionStatements", + "patch": "replace", + "range": [ + 280, + 283 + ] + } + ], + "range": [ + 263, + 283 + ] + } + ], + "range": [ + 248, + 284 + ] + } + ], + "range": [ + 248, + 285 + ] + } + ], + "hasChanges": true, + "range": [ + 248, + 285 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 287, + 289 + ] + } + ], + "range": [ + 275, + 289 + ] + } + ], + "patch": "delete", + "range": [ + 260, + 290 + ] + } + ], + "range": [ + 260, + 291 + ] + } + ], + "hasChanges": true, + "range": [ + 260, + 291 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 300, + 305 + ] + }, + { + "category": "Identifier", + "range": [ + 309, + 318 + ] + } + ], + "range": [ + 300, + 318 + ] + } + ], + "patch": "delete", + "range": [ + 291, + 321 + ] + } + ], + "range": [ + 291, + 322 + ] + } + ], + "hasChanges": true, + "range": [ + 291, + 322 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 336, + 341 + ] + } + ], + "patch": "delete", + "range": [ + 322, + 342 + ] + } + ], + "range": [ + 322, + 343 + ] + } + ], + "hasChanges": true, + "range": [ + 322, + 343 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 352, + 357 + ] + } + ], + "range": [ + 352, + 357 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 359, + 364 + ] + } + ], + "range": [ + 359, + 364 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 366, + 371 + ] + } + ], + "range": [ + 366, + 371 + ] + }, + { + "category": "StringLiteral", + "range": [ + 379, + 385 + ] + } + ], + "patch": "delete", + "range": [ + 343, + 386 + ] + } + ], + "range": [ + 343, + 387 + ] + } + ], + "hasChanges": true, + "range": [ + 343, + 387 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 396, + 403 + ] + }, + { + "category": "Identifier", + "range": [ + 407, + 412 + ] + } + ], + "range": [ + 396, + 412 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 414, + 421 + ] + }, + { + "category": "Identifier", + "range": [ + 425, + 430 + ] + } + ], + "range": [ + 414, + 430 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 432, + 437 + ] + }, + { + "category": "StringLiteral", + "range": [ + 445, + 451 + ] + } + ], + "patch": "delete", + "range": [ + 387, + 452 + ] + } + ], + "range": [ + 387, + 453 + ] + } + ], + "hasChanges": true, + "range": [ + 387, + 453 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 294, + 299 + ] + }, + { + "category": "Identifier", + "range": [ + 303, + 310 + ] + } + ], + "range": [ + 294, + 310 + ] + } + ], + "patch": "insert", + "range": [ + 285, + 313 + ] + } + ], + "range": [ + 285, + 314 + ] + } + ], + "hasChanges": true, + "range": [ + 285, + 314 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 328, + 333 + ] + } + ], + "patch": "insert", + "range": [ + 314, + 334 + ] + } + ], + "range": [ + 314, + 335 + ] + } + ], + "hasChanges": true, + "range": [ + 314, + 335 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 344, + 349 + ] + } + ], + "range": [ + 344, + 349 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 351, + 356 + ] + } + ], + "range": [ + 351, + 356 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 358, + 363 + ] + } + ], + "range": [ + 358, + 363 + ] + }, + { + "category": "StringLiteral", + "range": [ + 371, + 376 + ] + } + ], + "patch": "insert", + "range": [ + 335, + 377 + ] + } + ], + "range": [ + 335, + 378 + ] + } + ], + "hasChanges": true, + "range": [ + 335, + 378 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 394 + ] + }, + { + "category": "Identifier", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 387, + 403 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 405, + 412 + ] + }, + { + "category": "Identifier", + "range": [ + 416, + 421 + ] + } + ], + "range": [ + 405, + 421 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 423, + 428 + ] + } + ], + "range": [ + 423, + 428 + ] + }, + { + "category": "StringLiteral", + "range": [ + 436, + 441 + ] + } + ], + "patch": "insert", + "range": [ + 378, + 442 + ] + } + ], + "range": [ + 378, + 443 + ] + } + ], + "hasChanges": true, + "range": [ + 378, + 443 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 462, + 467 + ] + } + ], + "range": [ + 462, + 467 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 469, + 474 + ] + } + ], + "range": [ + 469, + 474 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 476, + 481 + ] + } + ], + "range": [ + 476, + 481 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 483, + 488 + ] + } + ], + "range": [ + 483, + 488 + ] + } + ], + "range": [ + 453, + 491 + ] + } + ], + "range": [ + 453, + 492 + ] + } + ], + "hasChanges": false, + "range": [ + 453, + 492 + ], + "number": 12 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 452, + 457 + ] + } + ], + "range": [ + 452, + 457 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 459, + 464 + ] + } + ], + "range": [ + 459, + 464 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 466, + 471 + ] + } + ], + "range": [ + 466, + 471 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 473, + 478 + ] + } + ], + "range": [ + 473, + 478 + ] + } + ], + "range": [ + 443, + 481 + ] + } + ], + "range": [ + 443, + 482 + ] + } + ], + "hasChanges": false, + "range": [ + 443, + 482 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 501, + 510 + ] + }, + { + "category": "Identifier", + "range": [ + 514, + 519 + ] + } + ], + "range": [ + 501, + 519 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 521, + 530 + ] + }, + { + "category": "Identifier", + "range": [ + 534, + 539 + ] + } + ], + "range": [ + 521, + 539 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 541, + 546 + ] + } + ], + "range": [ + 541, + 546 + ] + } + ], + "range": [ + 492, + 549 + ] + } + ], + "range": [ + 492, + 550 + ] + } + ], + "hasChanges": false, + "range": [ + 492, + 550 + ], + "number": 13 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 491, + 500 + ] + }, + { + "category": "Identifier", + "range": [ + 504, + 509 + ] + } + ], + "range": [ + 491, + 509 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 511, + 520 + ] + }, + { + "category": "Identifier", + "range": [ + 524, + 529 + ] + } + ], + "range": [ + 511, + 529 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 531, + 536 + ] + } + ], + "range": [ + 531, + 536 + ] + } + ], + "range": [ + 482, + 539 + ] + } + ], + "range": [ + 482, + 540 + ] + } + ], + "hasChanges": false, + "range": [ + 482, + 540 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 561, + 566 + ] + } + ], + "range": [ + 561, + 566 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 568, + 573 + ] + } + ], + "range": [ + 568, + 573 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 575, + 580 + ] + } + ], + "range": [ + 575, + 580 + ] + } + ], + "range": [ + 550, + 581 + ] + } + ], + "range": [ + 550, + 582 + ] + } + ], + "hasChanges": false, + "range": [ + 550, + 582 + ], + "number": 14 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 551, + 556 + ] + } + ], + "range": [ + 551, + 556 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 558, + 563 + ] + } + ], + "range": [ + 558, + 563 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 565, + 570 + ] + } + ], + "range": [ + 565, + 570 + ] + } + ], + "range": [ + 540, + 571 + ] + } + ], + "range": [ + 540, + 572 + ] + } + ], + "hasChanges": false, + "range": [ + 540, + 572 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 593, + 598 + ] + }, + { + "category": "Identifier", + "range": [ + 601, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 609, + 614 + ] + }, + { + "category": "Identifier", + "range": [ + 617, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 625, + 630 + ] + } + ], + "range": [ + 625, + 630 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 632, + 637 + ] + } + ], + "range": [ + 632, + 637 + ] + } + ], + "range": [ + 582, + 638 + ] + } + ], + "range": [ + 582, + 639 + ] + } + ], + "hasChanges": false, + "range": [ + 582, + 639 + ], + "number": 15 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 583, + 588 + ] + }, + { + "category": "Identifier", + "range": [ + 591, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 599, + 604 + ] + }, + { + "category": "Identifier", + "range": [ + 607, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 615, + 620 + ] + } + ], + "range": [ + 615, + 620 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 622, + 627 + ] + } + ], + "range": [ + 622, + 627 + ] + } + ], + "range": [ + 572, + 628 + ] + } + ], + "range": [ + 572, + 629 + ] + } + ], + "hasChanges": false, + "range": [ + 572, + 629 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 654, + 667 + ] + } + ], + "range": [ + 639, + 668 + ] + } + ], + "range": [ + 639, + 669 + ] + } + ], + "hasChanges": false, + "range": [ + 639, + 669 + ], + "number": 16 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 644, + 657 + ] + } + ], + "range": [ + 629, + 658 + ] + } + ], + "range": [ + 629, + 659 + ] + } + ], + "hasChanges": false, + "range": [ + 629, + 659 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 696, + 699 + ] + } + ], + "range": [ + 684, + 699 + ] + } + ], + "range": [ + 669, + 700 + ] + } + ], + "range": [ + 669, + 701 + ] + } + ], + "hasChanges": false, + "range": [ + 669, + 701 + ], + "number": 17 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 686, + 689 + ] + } + ], + "range": [ + 674, + 689 + ] + } + ], + "range": [ + 659, + 690 + ] + } + ], + "range": [ + 659, + 691 + ] + } + ], + "hasChanges": false, + "range": [ + 659, + 691 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 725, + 730 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 733, + 736 + ] + } + ], + "range": [ + 716, + 736 + ] + } + ], + "range": [ + 701, + 737 + ] + } + ], + "range": [ + 701, + 738 + ] + } + ], + "hasChanges": false, + "range": [ + 701, + 738 + ], + "number": 18 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 715, + 720 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 723, + 726 + ] + } + ], + "range": [ + 706, + 726 + ] + } + ], + "range": [ + 691, + 727 + ] + } + ], + "range": [ + 691, + 728 + ] + } + ], + "hasChanges": false, + "range": [ + 691, + 728 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 747, + 752 + ] + }, + { + "category": "Identifier", + "range": [ + 756, + 763 + ] + } + ], + "range": [ + 747, + 763 + ] + } + ], + "range": [ + 738, + 766 + ] + } + ], + "range": [ + 738, + 767 + ] + } + ], + "hasChanges": false, + "range": [ + 738, + 767 + ], + "number": 19 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 737, + 742 + ] + }, + { + "category": "Identifier", + "range": [ + 746, + 753 + ] + } + ], + "range": [ + 737, + 753 + ] + } + ], + "range": [ + 728, + 756 + ] + } + ], + "range": [ + 728, + 757 + ] + } + ], + "hasChanges": false, + "range": [ + 728, + 757 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 781, + 786 + ] + } + ], + "range": [ + 767, + 787 + ] + } + ], + "range": [ + 767, + 788 + ] + } + ], + "hasChanges": false, + "range": [ + 767, + 788 + ], + "number": 20 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 771, + 776 + ] + } + ], + "range": [ + 757, + 777 + ] + } + ], + "range": [ + 757, + 778 + ] + } + ], + "hasChanges": false, + "range": [ + 757, + 778 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 797, + 802 + ] + } + ], + "range": [ + 797, + 802 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 804, + 809 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 811, + 816 + ] + } + ], + "range": [ + 811, + 816 + ] + }, + { + "category": "StringLiteral", + "range": [ + 824, + 829 + ] + } + ], + "range": [ + 788, + 830 + ] + } + ], + "range": [ + 788, + 831 + ] + } + ], + "hasChanges": false, + "range": [ + 788, + 831 + ], + "number": 21 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 787, + 792 + ] + } + ], + "range": [ + 787, + 792 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 794, + 799 + ] + } + ], + "range": [ + 794, + 799 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 801, + 806 + ] + } + ], + "range": [ + 801, + 806 + ] + }, + { + "category": "StringLiteral", + "range": [ + 814, + 819 + ] + } + ], + "range": [ + 778, + 820 + ] + } + ], + "range": [ + 778, + 821 + ] + } + ], + "hasChanges": false, + "range": [ + 778, + 821 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 840, + 847 + ] + }, + { + "category": "Identifier", + "range": [ + 851, + 856 + ] + } + ], + "range": [ + 840, + 856 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 858, + 865 + ] + }, + { + "category": "Identifier", + "range": [ + 869, + 874 + ] + } + ], + "range": [ + 858, + 874 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 881 + ] + } + ], + "range": [ + 876, + 881 + ] + }, + { + "category": "StringLiteral", + "range": [ + 889, + 894 + ] + } + ], + "range": [ + 831, + 895 + ] + } + ], + "range": [ + 831, + 896 + ] + } + ], + "hasChanges": false, + "range": [ + 831, + 896 + ], + "number": 22 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 830, + 837 + ] + }, + { + "category": "Identifier", + "range": [ + 841, + 846 + ] + } + ], + "range": [ + 830, + 846 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 848, + 855 + ] + }, + { + "category": "Identifier", + "range": [ + 859, + 864 + ] + } + ], + "range": [ + 848, + 864 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 866, + 871 + ] + } + ], + "range": [ + 866, + 871 + ] + }, + { + "category": "StringLiteral", + "range": [ + 879, + 884 + ] + } + ], + "range": [ + 821, + 885 + ] + } + ], + "range": [ + 821, + 886 + ] + } + ], + "hasChanges": false, + "range": [ + 821, + 886 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 905, + 910 + ] + } + ], + "range": [ + 905, + 910 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 912, + 917 + ] + } + ], + "range": [ + 912, + 917 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 919, + 924 + ] + } + ], + "range": [ + 919, + 924 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 896, + 934 + ] + } + ], + "range": [ + 896, + 935 + ] + } + ], + "hasChanges": false, + "range": [ + 896, + 935 + ], + "number": 23 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 895, + 900 + ] + } + ], + "range": [ + 895, + 900 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 902, + 907 + ] + } + ], + "range": [ + 902, + 907 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 909, + 914 + ] + } + ], + "range": [ + 909, + 914 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 916, + 921 + ] + } + ], + "range": [ + 916, + 921 + ] + } + ], + "range": [ + 886, + 924 + ] + } + ], + "range": [ + 886, + 925 + ] + } + ], + "hasChanges": false, + "range": [ + 886, + 925 + ], + "number": 23 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 944, + 953 + ] + }, + { + "category": "Identifier", + "range": [ + 957, + 962 + ] + } + ], + "range": [ + 944, + 962 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 964, + 973 + ] + }, + { + "category": "Identifier", + "range": [ + 977, + 982 + ] + } + ], + "range": [ + 964, + 982 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 935, + 992 + ] + } + ], + "range": [ + 935, + 993 + ] + } + ], + "hasChanges": false, + "range": [ + 935, + 993 + ], + "number": 24 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 934, + 943 + ] + }, + { + "category": "Identifier", + "range": [ + 947, + 952 + ] + } + ], + "range": [ + 934, + 952 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 954, + 963 + ] + }, + { + "category": "Identifier", + "range": [ + 967, + 972 + ] + } + ], + "range": [ + 954, + 972 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 974, + 979 + ] + } + ], + "range": [ + 974, + 979 + ] + } + ], + "range": [ + 925, + 982 + ] + } + ], + "range": [ + 925, + 983 + ] + } + ], + "hasChanges": false, + "range": [ + 925, + 983 + ], + "number": 24 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1004, + 1009 + ] + } + ], + "range": [ + 1004, + 1009 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1016 + ] + } + ], + "range": [ + 1011, + 1016 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 993, + 1024 + ] + } + ], + "range": [ + 993, + 1025 + ] + } + ], + "hasChanges": false, + "range": [ + 993, + 1025 + ], + "number": 25 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 994, + 999 + ] + } + ], + "range": [ + 994, + 999 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1001, + 1006 + ] + } + ], + "range": [ + 1001, + 1006 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1008, + 1013 + ] + } + ], + "range": [ + 1008, + 1013 + ] + } + ], + "range": [ + 983, + 1014 + ] + } + ], + "range": [ + 983, + 1015 + ] + } + ], + "hasChanges": false, + "range": [ + 983, + 1015 + ], + "number": 25 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1036, + 1041 + ] + }, + { + "category": "Identifier", + "range": [ + 1044, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1052, + 1057 + ] + }, + { + "category": "Identifier", + "range": [ + 1060, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1068, + 1073 + ] + } + ], + "range": [ + 1068, + 1073 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1025, + 1081 + ] + } + ], + "range": [ + 1025, + 1082 + ] + } + ], + "hasChanges": false, + "range": [ + 1025, + 1082 + ], + "number": 26 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1026, + 1031 + ] + }, + { + "category": "Identifier", + "range": [ + 1034, + 1040 + ] + } + ], + "range": [ + 1026, + 1040 + ] + } + ], + "range": [ + 1026, + 1040 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1042, + 1047 + ] + }, + { + "category": "Identifier", + "range": [ + 1050, + 1056 + ] + } + ], + "range": [ + 1042, + 1056 + ] + } + ], + "range": [ + 1042, + 1056 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1058, + 1063 + ] + } + ], + "range": [ + 1058, + 1063 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1065, + 1070 + ] + } + ], + "range": [ + 1065, + 1070 + ] + } + ], + "range": [ + 1015, + 1071 + ] + } + ], + "range": [ + 1015, + 1072 + ] + } + ], + "hasChanges": false, + "range": [ + 1015, + 1072 + ], + "number": 26 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 1097, + 1110 + ] + } + ], + "range": [ + 1082, + 1111 + ] + } + ], + "range": [ + 1082, + 1112 + ] + } + ], + "hasChanges": false, + "range": [ + 1082, + 1112 + ], + "number": 27 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 1087, + 1100 + ] + } + ], + "range": [ + 1072, + 1101 + ] + } + ], + "range": [ + 1072, + 1102 + ] + } + ], + "hasChanges": false, + "range": [ + 1072, + 1102 + ], + "number": 27 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 1139, + 1142 + ] + } + ], + "range": [ + 1127, + 1142 + ] + } + ], + "range": [ + 1112, + 1143 + ] + } + ], + "range": [ + 1112, + 1144 + ] + } + ], + "hasChanges": false, + "range": [ + 1112, + 1144 + ], + "number": 28 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 1129, + 1132 + ] + } + ], + "range": [ + 1117, + 1132 + ] + } + ], + "range": [ + 1102, + 1133 + ] + } + ], + "range": [ + 1102, + 1134 + ] + } + ], + "hasChanges": false, + "range": [ + 1102, + 1134 + ], + "number": 28 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1168, + 1173 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 1176, + 1179 + ] + } + ], + "range": [ + 1159, + 1179 + ] + } + ], + "range": [ + 1144, + 1180 + ] + } + ], + "range": [ + 1144, + 1181 + ] + } + ], + "hasChanges": false, + "range": [ + 1144, + 1181 + ], + "number": 29 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1158, + 1163 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 1166, + 1169 + ] + } + ], + "range": [ + 1149, + 1169 + ] + } + ], + "range": [ + 1134, + 1170 + ] + } + ], + "range": [ + 1134, + 1171 + ] + } + ], + "hasChanges": false, + "range": [ + 1134, + 1171 + ], + "number": 29 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1190, + 1195 + ] + }, + { + "category": "Identifier", + "range": [ + 1199, + 1206 + ] + } + ], + "range": [ + 1190, + 1206 + ] + } + ], + "range": [ + 1181, + 1209 + ] + } + ], + "range": [ + 1181, + 1210 + ] + } + ], + "hasChanges": false, + "range": [ + 1181, + 1210 + ], + "number": 30 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1180, + 1185 + ] + }, + { + "category": "Identifier", + "range": [ + 1189, + 1196 + ] + } + ], + "range": [ + 1180, + 1196 + ] + } + ], + "range": [ + 1171, + 1199 + ] + } + ], + "range": [ + 1171, + 1200 + ] + } + ], + "hasChanges": false, + "range": [ + 1171, + 1200 + ], + "number": 30 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1224, + 1229 + ] + } + ], + "range": [ + 1210, + 1230 + ] + } + ], + "range": [ + 1210, + 1231 + ] + } + ], + "hasChanges": false, + "range": [ + 1210, + 1231 + ], + "number": 31 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1214, + 1219 + ] + } + ], + "range": [ + 1200, + 1220 + ] + } + ], + "range": [ + 1200, + 1221 + ] + } + ], + "hasChanges": false, + "range": [ + 1200, + 1221 + ], + "number": 31 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1240, + 1245 + ] + } + ], + "range": [ + 1240, + 1245 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1247, + 1252 + ] + } + ], + "range": [ + 1247, + 1252 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1254, + 1259 + ] + } + ], + "range": [ + 1254, + 1259 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1267, + 1272 + ] + } + ], + "range": [ + 1231, + 1273 + ] + } + ], + "range": [ + 1231, + 1274 + ] + } + ], + "hasChanges": false, + "range": [ + 1231, + 1274 + ], + "number": 32 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1230, + 1235 + ] + } + ], + "range": [ + 1230, + 1235 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1237, + 1242 + ] + } + ], + "range": [ + 1237, + 1242 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1244, + 1249 + ] + } + ], + "range": [ + 1244, + 1249 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1257, + 1262 + ] + } + ], + "range": [ + 1221, + 1263 + ] + } + ], + "range": [ + 1221, + 1264 + ] + } + ], + "hasChanges": false, + "range": [ + 1221, + 1264 + ], + "number": 32 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1283, + 1290 + ] + }, + { + "category": "Identifier", + "range": [ + 1294, + 1299 + ] + } + ], + "range": [ + 1283, + 1299 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1301, + 1308 + ] + }, + { + "category": "Identifier", + "range": [ + 1312, + 1317 + ] + } + ], + "range": [ + 1301, + 1317 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1319, + 1324 + ] + } + ], + "range": [ + 1319, + 1324 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1332, + 1337 + ] + } + ], + "range": [ + 1274, + 1338 + ] + } + ], + "range": [ + 1274, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1274, + 1339 + ], + "number": 33 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1273, + 1280 + ] + }, + { + "category": "Identifier", + "range": [ + 1284, + 1289 + ] + } + ], + "range": [ + 1273, + 1289 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1291, + 1298 + ] + }, + { + "category": "Identifier", + "range": [ + 1302, + 1307 + ] + } + ], + "range": [ + 1291, + 1307 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1309, + 1314 + ] + } + ], + "range": [ + 1309, + 1314 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1322, + 1327 + ] + } + ], + "range": [ + 1264, + 1328 + ] + } + ], + "range": [ + 1264, + 1329 + ] + } + ], + "hasChanges": false, + "range": [ + 1264, + 1329 + ], + "number": 33 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1339, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1339, + 1339 + ], + "number": 34 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1329, + 1329 + ] + } + ], + "hasChanges": false, + "range": [ + 1329, + 1329 + ], + "number": 34 + } + ] + ], + "paths": [ + "export.js", + "export.js" + ], + "oids": [ + "c8b53ff3b2b7c29c2bcdc40c98608cf8b3d12134", + "ad3f21a7fe9774273122870974fe3b901777e880" + ] + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index c8b53ff..ad3f21a 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,14 +1,14 @@", + "-export { name4, name5, name6, nameZ };", + "-export { variable2 as name2, variable3 as name3, nameY };", + "-export let name3, name4, nameT;", + "-export let name2 = value2, name3 = value3, name4, nameO;", + "-export default otherNamedFunction;", + "-export default function newName1() {};", + "-export default function () {};", + "-export { name2 as statement };", + "-export * from 'baz';", + "-export { name7, name8, nameP } from 'buzz';", + "-export { import6 as name6, import7 as name7, nameB } from 'fizz';", + "+export { name1, name2, name3, nameN };", + "+export { variable1 as name1, variable2 as name2, nameN };", + "+export let name1, name2, nameN;", + "+export let name1 = value1, name2 = value2, name3, nameN;", + "+export default namedFunction;", + "+export default function () { };", + "+export default function name1() { };", + "+export { name1 as default };", + "+export * from 'foo';", + "+export { name1, name2, nameN } from 'foo';", + "+export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "14555cd2f315cd841f9d581c0dda879f1f3d2dd7..db45ffdca40149b2a8ab65cef948169930779ced" +} +,{ + "testCaseDescription": "javascript-export-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "patch": "delete", + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "patch": "delete", + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "patch": "delete", + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 214 + ] + } + ], + "patch": "delete", + "range": [ + 186, + 215 + ] + } + ], + "range": [ + 186, + 216 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 216 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 243, + 246 + ] + } + ], + "range": [ + 231, + 246 + ] + } + ], + "patch": "delete", + "range": [ + 216, + 247 + ] + } + ], + "range": [ + 216, + 248 + ] + } + ], + "hasChanges": true, + "range": [ + 216, + 248 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 272, + 277 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 280, + 283 + ] + } + ], + "range": [ + 263, + 283 + ] + } + ], + "patch": "delete", + "range": [ + 248, + 284 + ] + } + ], + "range": [ + 248, + 285 + ] + } + ], + "hasChanges": true, + "range": [ + 248, + 285 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 294, + 299 + ] + }, + { + "category": "Identifier", + "range": [ + 303, + 310 + ] + } + ], + "range": [ + 294, + 310 + ] + } + ], + "patch": "delete", + "range": [ + 285, + 313 + ] + } + ], + "range": [ + 285, + 314 + ] + } + ], + "hasChanges": true, + "range": [ + 285, + 314 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 328, + 333 + ] + } + ], + "patch": "delete", + "range": [ + 314, + 334 + ] + } + ], + "range": [ + 314, + 335 + ] + } + ], + "hasChanges": true, + "range": [ + 314, + 335 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 344, + 349 + ] + } + ], + "range": [ + 344, + 349 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 351, + 356 + ] + } + ], + "range": [ + 351, + 356 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 358, + 363 + ] + } + ], + "range": [ + 358, + 363 + ] + }, + { + "category": "StringLiteral", + "range": [ + 371, + 376 + ] + } + ], + "patch": "delete", + "range": [ + 335, + 377 + ] + } + ], + "range": [ + 335, + 378 + ] + } + ], + "hasChanges": true, + "range": [ + 335, + 378 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 394 + ] + }, + { + "category": "Identifier", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 387, + 403 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 405, + 412 + ] + }, + { + "category": "Identifier", + "range": [ + 416, + 421 + ] + } + ], + "range": [ + 405, + 421 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 423, + 428 + ] + } + ], + "range": [ + 423, + 428 + ] + }, + { + "category": "StringLiteral", + "range": [ + 436, + 441 + ] + } + ], + "patch": "delete", + "range": [ + 378, + 442 + ] + } + ], + "range": [ + 378, + 443 + ] + } + ], + "hasChanges": true, + "range": [ + 378, + 443 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "patch": "insert", + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "patch": "insert", + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "patch": "insert", + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 219 + ] + } + ], + "patch": "insert", + "range": [ + 186, + 220 + ] + } + ], + "range": [ + 186, + 221 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 221 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 245, + 253 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 256, + 258 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "patch": "insert", + "range": [ + 221, + 259 + ] + } + ], + "range": [ + 221, + 260 + ] + } + ], + "hasChanges": true, + "range": [ + 221, + 260 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 287, + 289 + ] + } + ], + "range": [ + 275, + 289 + ] + } + ], + "patch": "insert", + "range": [ + 260, + 290 + ] + } + ], + "range": [ + 260, + 291 + ] + } + ], + "hasChanges": true, + "range": [ + 260, + 291 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 300, + 305 + ] + }, + { + "category": "Identifier", + "range": [ + 309, + 318 + ] + } + ], + "range": [ + 300, + 318 + ] + } + ], + "patch": "insert", + "range": [ + 291, + 321 + ] + } + ], + "range": [ + 291, + 322 + ] + } + ], + "hasChanges": true, + "range": [ + 291, + 322 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 336, + 341 + ] + } + ], + "patch": "insert", + "range": [ + 322, + 342 + ] + } + ], + "range": [ + 322, + 343 + ] + } + ], + "hasChanges": true, + "range": [ + 322, + 343 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 352, + 357 + ] + } + ], + "range": [ + 352, + 357 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 359, + 364 + ] + } + ], + "range": [ + 359, + 364 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 366, + 371 + ] + } + ], + "range": [ + 366, + 371 + ] + }, + { + "category": "StringLiteral", + "range": [ + 379, + 385 + ] + } + ], + "patch": "insert", + "range": [ + 343, + 386 + ] + } + ], + "range": [ + 343, + 387 + ] + } + ], + "hasChanges": true, + "range": [ + 343, + 387 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 396, + 403 + ] + }, + { + "category": "Identifier", + "range": [ + 407, + 412 + ] + } + ], + "range": [ + 396, + 412 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 414, + 421 + ] + }, + { + "category": "Identifier", + "range": [ + 425, + 430 + ] + } + ], + "range": [ + 414, + 430 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 432, + 437 + ] + }, + { + "category": "StringLiteral", + "range": [ + 445, + 451 + ] + } + ], + "patch": "insert", + "range": [ + 387, + 452 + ] + } + ], + "range": [ + 387, + 453 + ] + } + ], + "hasChanges": true, + "range": [ + 387, + 453 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 452, + 457 + ] + } + ], + "range": [ + 452, + 457 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 459, + 464 + ] + } + ], + "range": [ + 459, + 464 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 466, + 471 + ] + } + ], + "range": [ + 466, + 471 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 473, + 478 + ] + } + ], + "range": [ + 473, + 478 + ] + } + ], + "range": [ + 443, + 481 + ] + } + ], + "range": [ + 443, + 482 + ] + } + ], + "hasChanges": false, + "range": [ + 443, + 482 + ], + "number": 12 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 462, + 467 + ] + } + ], + "range": [ + 462, + 467 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 469, + 474 + ] + } + ], + "range": [ + 469, + 474 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 476, + 481 + ] + } + ], + "range": [ + 476, + 481 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 483, + 488 + ] + } + ], + "range": [ + 483, + 488 + ] + } + ], + "range": [ + 453, + 491 + ] + } + ], + "range": [ + 453, + 492 + ] + } + ], + "hasChanges": false, + "range": [ + 453, + 492 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 491, + 500 + ] + }, + { + "category": "Identifier", + "range": [ + 504, + 509 + ] + } + ], + "range": [ + 491, + 509 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 511, + 520 + ] + }, + { + "category": "Identifier", + "range": [ + 524, + 529 + ] + } + ], + "range": [ + 511, + 529 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 531, + 536 + ] + } + ], + "range": [ + 531, + 536 + ] + } + ], + "range": [ + 482, + 539 + ] + } + ], + "range": [ + 482, + 540 + ] + } + ], + "hasChanges": false, + "range": [ + 482, + 540 + ], + "number": 13 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 501, + 510 + ] + }, + { + "category": "Identifier", + "range": [ + 514, + 519 + ] + } + ], + "range": [ + 501, + 519 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 521, + 530 + ] + }, + { + "category": "Identifier", + "range": [ + 534, + 539 + ] + } + ], + "range": [ + 521, + 539 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 541, + 546 + ] + } + ], + "range": [ + 541, + 546 + ] + } + ], + "range": [ + 492, + 549 + ] + } + ], + "range": [ + 492, + 550 + ] + } + ], + "hasChanges": false, + "range": [ + 492, + 550 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 551, + 556 + ] + } + ], + "range": [ + 551, + 556 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 558, + 563 + ] + } + ], + "range": [ + 558, + 563 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 565, + 570 + ] + } + ], + "range": [ + 565, + 570 + ] + } + ], + "range": [ + 540, + 571 + ] + } + ], + "range": [ + 540, + 572 + ] + } + ], + "hasChanges": false, + "range": [ + 540, + 572 + ], + "number": 14 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 561, + 566 + ] + } + ], + "range": [ + 561, + 566 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 568, + 573 + ] + } + ], + "range": [ + 568, + 573 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 575, + 580 + ] + } + ], + "range": [ + 575, + 580 + ] + } + ], + "range": [ + 550, + 581 + ] + } + ], + "range": [ + 550, + 582 + ] + } + ], + "hasChanges": false, + "range": [ + 550, + 582 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 583, + 588 + ] + }, + { + "category": "Identifier", + "range": [ + 591, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 599, + 604 + ] + }, + { + "category": "Identifier", + "range": [ + 607, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 615, + 620 + ] + } + ], + "range": [ + 615, + 620 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 622, + 627 + ] + } + ], + "range": [ + 622, + 627 + ] + } + ], + "range": [ + 572, + 628 + ] + } + ], + "range": [ + 572, + 629 + ] + } + ], + "hasChanges": false, + "range": [ + 572, + 629 + ], + "number": 15 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 593, + 598 + ] + }, + { + "category": "Identifier", + "range": [ + 601, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 609, + 614 + ] + }, + { + "category": "Identifier", + "range": [ + 617, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 625, + 630 + ] + } + ], + "range": [ + 625, + 630 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 632, + 637 + ] + } + ], + "range": [ + 632, + 637 + ] + } + ], + "range": [ + 582, + 638 + ] + } + ], + "range": [ + 582, + 639 + ] + } + ], + "hasChanges": false, + "range": [ + 582, + 639 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 644, + 657 + ] + } + ], + "range": [ + 629, + 658 + ] + } + ], + "range": [ + 629, + 659 + ] + } + ], + "hasChanges": false, + "range": [ + 629, + 659 + ], + "number": 16 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 654, + 667 + ] + } + ], + "range": [ + 639, + 668 + ] + } + ], + "range": [ + 639, + 669 + ] + } + ], + "hasChanges": false, + "range": [ + 639, + 669 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 686, + 689 + ] + } + ], + "range": [ + 674, + 689 + ] + } + ], + "range": [ + 659, + 690 + ] + } + ], + "range": [ + 659, + 691 + ] + } + ], + "hasChanges": false, + "range": [ + 659, + 691 + ], + "number": 17 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 696, + 699 + ] + } + ], + "range": [ + 684, + 699 + ] + } + ], + "range": [ + 669, + 700 + ] + } + ], + "range": [ + 669, + 701 + ] + } + ], + "hasChanges": false, + "range": [ + 669, + 701 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 715, + 720 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 723, + 726 + ] + } + ], + "range": [ + 706, + 726 + ] + } + ], + "range": [ + 691, + 727 + ] + } + ], + "range": [ + 691, + 728 + ] + } + ], + "hasChanges": false, + "range": [ + 691, + 728 + ], + "number": 18 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 725, + 730 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 733, + 736 + ] + } + ], + "range": [ + 716, + 736 + ] + } + ], + "range": [ + 701, + 737 + ] + } + ], + "range": [ + 701, + 738 + ] + } + ], + "hasChanges": false, + "range": [ + 701, + 738 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 737, + 742 + ] + }, + { + "category": "Identifier", + "range": [ + 746, + 753 + ] + } + ], + "range": [ + 737, + 753 + ] + } + ], + "range": [ + 728, + 756 + ] + } + ], + "range": [ + 728, + 757 + ] + } + ], + "hasChanges": false, + "range": [ + 728, + 757 + ], + "number": 19 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 747, + 752 + ] + }, + { + "category": "Identifier", + "range": [ + 756, + 763 + ] + } + ], + "range": [ + 747, + 763 + ] + } + ], + "range": [ + 738, + 766 + ] + } + ], + "range": [ + 738, + 767 + ] + } + ], + "hasChanges": false, + "range": [ + 738, + 767 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 771, + 776 + ] + } + ], + "range": [ + 757, + 777 + ] + } + ], + "range": [ + 757, + 778 + ] + } + ], + "hasChanges": false, + "range": [ + 757, + 778 + ], + "number": 20 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 781, + 786 + ] + } + ], + "range": [ + 767, + 787 + ] + } + ], + "range": [ + 767, + 788 + ] + } + ], + "hasChanges": false, + "range": [ + 767, + 788 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 787, + 792 + ] + } + ], + "range": [ + 787, + 792 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 794, + 799 + ] + } + ], + "range": [ + 794, + 799 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 801, + 806 + ] + } + ], + "range": [ + 801, + 806 + ] + }, + { + "category": "StringLiteral", + "range": [ + 814, + 819 + ] + } + ], + "range": [ + 778, + 820 + ] + } + ], + "range": [ + 778, + 821 + ] + } + ], + "hasChanges": false, + "range": [ + 778, + 821 + ], + "number": 21 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 797, + 802 + ] + } + ], + "range": [ + 797, + 802 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 804, + 809 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 811, + 816 + ] + } + ], + "range": [ + 811, + 816 + ] + }, + { + "category": "StringLiteral", + "range": [ + 824, + 829 + ] + } + ], + "range": [ + 788, + 830 + ] + } + ], + "range": [ + 788, + 831 + ] + } + ], + "hasChanges": false, + "range": [ + 788, + 831 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 830, + 837 + ] + }, + { + "category": "Identifier", + "range": [ + 841, + 846 + ] + } + ], + "range": [ + 830, + 846 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 848, + 855 + ] + }, + { + "category": "Identifier", + "range": [ + 859, + 864 + ] + } + ], + "range": [ + 848, + 864 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 866, + 871 + ] + } + ], + "range": [ + 866, + 871 + ] + }, + { + "category": "StringLiteral", + "range": [ + 879, + 884 + ] + } + ], + "range": [ + 821, + 885 + ] + } + ], + "range": [ + 821, + 886 + ] + } + ], + "hasChanges": false, + "range": [ + 821, + 886 + ], + "number": 22 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 840, + 847 + ] + }, + { + "category": "Identifier", + "range": [ + 851, + 856 + ] + } + ], + "range": [ + 840, + 856 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 858, + 865 + ] + }, + { + "category": "Identifier", + "range": [ + 869, + 874 + ] + } + ], + "range": [ + 858, + 874 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 881 + ] + } + ], + "range": [ + 876, + 881 + ] + }, + { + "category": "StringLiteral", + "range": [ + 889, + 894 + ] + } + ], + "range": [ + 831, + 895 + ] + } + ], + "range": [ + 831, + 896 + ] + } + ], + "hasChanges": false, + "range": [ + 831, + 896 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 895, + 900 + ] + } + ], + "range": [ + 895, + 900 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 902, + 907 + ] + } + ], + "range": [ + 902, + 907 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 909, + 914 + ] + } + ], + "range": [ + 909, + 914 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 916, + 921 + ] + } + ], + "range": [ + 916, + 921 + ] + } + ], + "range": [ + 886, + 924 + ] + } + ], + "range": [ + 886, + 925 + ] + } + ], + "hasChanges": false, + "range": [ + 886, + 925 + ], + "number": 23 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 905, + 910 + ] + } + ], + "range": [ + 905, + 910 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 912, + 917 + ] + } + ], + "range": [ + 912, + 917 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 919, + 924 + ] + } + ], + "range": [ + 919, + 924 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 896, + 934 + ] + } + ], + "range": [ + 896, + 935 + ] + } + ], + "hasChanges": false, + "range": [ + 896, + 935 + ], + "number": 23 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 934, + 943 + ] + }, + { + "category": "Identifier", + "range": [ + 947, + 952 + ] + } + ], + "range": [ + 934, + 952 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 954, + 963 + ] + }, + { + "category": "Identifier", + "range": [ + 967, + 972 + ] + } + ], + "range": [ + 954, + 972 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 974, + 979 + ] + } + ], + "range": [ + 974, + 979 + ] + } + ], + "range": [ + 925, + 982 + ] + } + ], + "range": [ + 925, + 983 + ] + } + ], + "hasChanges": false, + "range": [ + 925, + 983 + ], + "number": 24 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 944, + 953 + ] + }, + { + "category": "Identifier", + "range": [ + 957, + 962 + ] + } + ], + "range": [ + 944, + 962 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 964, + 973 + ] + }, + { + "category": "Identifier", + "range": [ + 977, + 982 + ] + } + ], + "range": [ + 964, + 982 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 935, + 992 + ] + } + ], + "range": [ + 935, + 993 + ] + } + ], + "hasChanges": false, + "range": [ + 935, + 993 + ], + "number": 24 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 994, + 999 + ] + } + ], + "range": [ + 994, + 999 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1001, + 1006 + ] + } + ], + "range": [ + 1001, + 1006 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1008, + 1013 + ] + } + ], + "range": [ + 1008, + 1013 + ] + } + ], + "range": [ + 983, + 1014 + ] + } + ], + "range": [ + 983, + 1015 + ] + } + ], + "hasChanges": false, + "range": [ + 983, + 1015 + ], + "number": 25 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1004, + 1009 + ] + } + ], + "range": [ + 1004, + 1009 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1016 + ] + } + ], + "range": [ + 1011, + 1016 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 993, + 1024 + ] + } + ], + "range": [ + 993, + 1025 + ] + } + ], + "hasChanges": false, + "range": [ + 993, + 1025 + ], + "number": 25 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1026, + 1031 + ] + }, + { + "category": "Identifier", + "range": [ + 1034, + 1040 + ] + } + ], + "range": [ + 1026, + 1040 + ] + } + ], + "range": [ + 1026, + 1040 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1042, + 1047 + ] + }, + { + "category": "Identifier", + "range": [ + 1050, + 1056 + ] + } + ], + "range": [ + 1042, + 1056 + ] + } + ], + "range": [ + 1042, + 1056 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1058, + 1063 + ] + } + ], + "range": [ + 1058, + 1063 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1065, + 1070 + ] + } + ], + "range": [ + 1065, + 1070 + ] + } + ], + "range": [ + 1015, + 1071 + ] + } + ], + "range": [ + 1015, + 1072 + ] + } + ], + "hasChanges": false, + "range": [ + 1015, + 1072 + ], + "number": 26 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1036, + 1041 + ] + }, + { + "category": "Identifier", + "range": [ + 1044, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1052, + 1057 + ] + }, + { + "category": "Identifier", + "range": [ + 1060, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1068, + 1073 + ] + } + ], + "range": [ + 1068, + 1073 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1025, + 1081 + ] + } + ], + "range": [ + 1025, + 1082 + ] + } + ], + "hasChanges": false, + "range": [ + 1025, + 1082 + ], + "number": 26 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 1087, + 1100 + ] + } + ], + "range": [ + 1072, + 1101 + ] + } + ], + "range": [ + 1072, + 1102 + ] + } + ], + "hasChanges": false, + "range": [ + 1072, + 1102 + ], + "number": 27 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 1097, + 1110 + ] + } + ], + "range": [ + 1082, + 1111 + ] + } + ], + "range": [ + 1082, + 1112 + ] + } + ], + "hasChanges": false, + "range": [ + 1082, + 1112 + ], + "number": 27 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 1129, + 1132 + ] + } + ], + "range": [ + 1117, + 1132 + ] + } + ], + "range": [ + 1102, + 1133 + ] + } + ], + "range": [ + 1102, + 1134 + ] + } + ], + "hasChanges": false, + "range": [ + 1102, + 1134 + ], + "number": 28 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 1139, + 1142 + ] + } + ], + "range": [ + 1127, + 1142 + ] + } + ], + "range": [ + 1112, + 1143 + ] + } + ], + "range": [ + 1112, + 1144 + ] + } + ], + "hasChanges": false, + "range": [ + 1112, + 1144 + ], + "number": 28 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1158, + 1163 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 1166, + 1169 + ] + } + ], + "range": [ + 1149, + 1169 + ] + } + ], + "range": [ + 1134, + 1170 + ] + } + ], + "range": [ + 1134, + 1171 + ] + } + ], + "hasChanges": false, + "range": [ + 1134, + 1171 + ], + "number": 29 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1168, + 1173 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 1176, + 1179 + ] + } + ], + "range": [ + 1159, + 1179 + ] + } + ], + "range": [ + 1144, + 1180 + ] + } + ], + "range": [ + 1144, + 1181 + ] + } + ], + "hasChanges": false, + "range": [ + 1144, + 1181 + ], + "number": 29 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1180, + 1185 + ] + }, + { + "category": "Identifier", + "range": [ + 1189, + 1196 + ] + } + ], + "range": [ + 1180, + 1196 + ] + } + ], + "range": [ + 1171, + 1199 + ] + } + ], + "range": [ + 1171, + 1200 + ] + } + ], + "hasChanges": false, + "range": [ + 1171, + 1200 + ], + "number": 30 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1190, + 1195 + ] + }, + { + "category": "Identifier", + "range": [ + 1199, + 1206 + ] + } + ], + "range": [ + 1190, + 1206 + ] + } + ], + "range": [ + 1181, + 1209 + ] + } + ], + "range": [ + 1181, + 1210 + ] + } + ], + "hasChanges": false, + "range": [ + 1181, + 1210 + ], + "number": 30 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1214, + 1219 + ] + } + ], + "range": [ + 1200, + 1220 + ] + } + ], + "range": [ + 1200, + 1221 + ] + } + ], + "hasChanges": false, + "range": [ + 1200, + 1221 + ], + "number": 31 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1224, + 1229 + ] + } + ], + "range": [ + 1210, + 1230 + ] + } + ], + "range": [ + 1210, + 1231 + ] + } + ], + "hasChanges": false, + "range": [ + 1210, + 1231 + ], + "number": 31 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1230, + 1235 + ] + } + ], + "range": [ + 1230, + 1235 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1237, + 1242 + ] + } + ], + "range": [ + 1237, + 1242 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1244, + 1249 + ] + } + ], + "range": [ + 1244, + 1249 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1257, + 1262 + ] + } + ], + "range": [ + 1221, + 1263 + ] + } + ], + "range": [ + 1221, + 1264 + ] + } + ], + "hasChanges": false, + "range": [ + 1221, + 1264 + ], + "number": 32 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1240, + 1245 + ] + } + ], + "range": [ + 1240, + 1245 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1247, + 1252 + ] + } + ], + "range": [ + 1247, + 1252 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1254, + 1259 + ] + } + ], + "range": [ + 1254, + 1259 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1267, + 1272 + ] + } + ], + "range": [ + 1231, + 1273 + ] + } + ], + "range": [ + 1231, + 1274 + ] + } + ], + "hasChanges": false, + "range": [ + 1231, + 1274 + ], + "number": 32 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1273, + 1280 + ] + }, + { + "category": "Identifier", + "range": [ + 1284, + 1289 + ] + } + ], + "range": [ + 1273, + 1289 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1291, + 1298 + ] + }, + { + "category": "Identifier", + "range": [ + 1302, + 1307 + ] + } + ], + "range": [ + 1291, + 1307 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1309, + 1314 + ] + } + ], + "range": [ + 1309, + 1314 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1322, + 1327 + ] + } + ], + "range": [ + 1264, + 1328 + ] + } + ], + "range": [ + 1264, + 1329 + ] + } + ], + "hasChanges": false, + "range": [ + 1264, + 1329 + ], + "number": 33 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1283, + 1290 + ] + }, + { + "category": "Identifier", + "range": [ + 1294, + 1299 + ] + } + ], + "range": [ + 1283, + 1299 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1301, + 1308 + ] + }, + { + "category": "Identifier", + "range": [ + 1312, + 1317 + ] + } + ], + "range": [ + 1301, + 1317 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1319, + 1324 + ] + } + ], + "range": [ + 1319, + 1324 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1332, + 1337 + ] + } + ], + "range": [ + 1274, + 1338 + ] + } + ], + "range": [ + 1274, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1274, + 1339 + ], + "number": 33 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1329, + 1329 + ] + } + ], + "hasChanges": false, + "range": [ + 1329, + 1329 + ], + "number": 34 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1339, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1339, + 1339 + ], + "number": 34 + } + ] + ], + "paths": [ + "export.js", + "export.js" + ], + "oids": [ + "ad3f21a7fe9774273122870974fe3b901777e880", + "c8b53ff3b2b7c29c2bcdc40c98608cf8b3d12134" + ] + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index ad3f21a..c8b53ff 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,14 +1,14 @@", + "-export { name1, name2, name3, nameN };", + "-export { variable1 as name1, variable2 as name2, nameN };", + "-export let name1, name2, nameN;", + "-export let name1 = value1, name2 = value2, name3, nameN;", + "-export default namedFunction;", + "-export default function () { };", + "-export default function name1() { };", + "-export { name1 as default };", + "-export * from 'foo';", + "-export { name1, name2, nameN } from 'foo';", + "-export { import1 as name1, import2 as name2, nameN } from 'bar';", + "+export { name4, name5, name6, nameZ };", + "+export { variable2 as name2, variable3 as name3, nameY };", + "+export let name3, name4, nameT;", + "+export let name2 = value2, name3 = value3, name4, nameO;", + "+export default otherNamedFunction;", + "+export default function newName1() {};", + "+export default function () {};", + "+export { name2 as statement };", + "+export * from 'baz';", + "+export { name7, name8, nameP } from 'buzz';", + "+export { import6 as name6, import7 as name7, nameB } from 'fizz';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "db45ffdca40149b2a8ab65cef948169930779ced..a7d8a8c67df112242870b85873789fcd84c93dc4" +} +,{ + "testCaseDescription": "javascript-export-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "patch": "delete", + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "patch": "delete", + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "patch": "delete", + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 219 + ] + } + ], + "patch": "delete", + "range": [ + 186, + 220 + ] + } + ], + "range": [ + 186, + 221 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 221 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 245, + 253 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 256, + 258 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "patch": "delete", + "range": [ + 221, + 259 + ] + } + ], + "range": [ + 221, + 260 + ] + } + ], + "hasChanges": true, + "range": [ + 221, + 260 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 287, + 289 + ] + } + ], + "range": [ + 275, + 289 + ] + } + ], + "patch": "delete", + "range": [ + 260, + 290 + ] + } + ], + "range": [ + 260, + 291 + ] + } + ], + "hasChanges": true, + "range": [ + 260, + 291 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 300, + 305 + ] + }, + { + "category": "Identifier", + "range": [ + 309, + 318 + ] + } + ], + "range": [ + 300, + 318 + ] + } + ], + "patch": "delete", + "range": [ + 291, + 321 + ] + } + ], + "range": [ + 291, + 322 + ] + } + ], + "hasChanges": true, + "range": [ + 291, + 322 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 336, + 341 + ] + } + ], + "patch": "delete", + "range": [ + 322, + 342 + ] + } + ], + "range": [ + 322, + 343 + ] + } + ], + "hasChanges": true, + "range": [ + 322, + 343 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 352, + 357 + ] + } + ], + "range": [ + 352, + 357 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 359, + 364 + ] + } + ], + "range": [ + 359, + 364 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 366, + 371 + ] + } + ], + "range": [ + 366, + 371 + ] + }, + { + "category": "StringLiteral", + "range": [ + 379, + 385 + ] + } + ], + "patch": "delete", + "range": [ + 343, + 386 + ] + } + ], + "range": [ + 343, + 387 + ] + } + ], + "hasChanges": true, + "range": [ + 343, + 387 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 396, + 403 + ] + }, + { + "category": "Identifier", + "range": [ + 407, + 412 + ] + } + ], + "range": [ + 396, + 412 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 414, + 421 + ] + }, + { + "category": "Identifier", + "range": [ + 425, + 430 + ] + } + ], + "range": [ + 414, + 430 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 432, + 437 + ] + }, + { + "category": "StringLiteral", + "range": [ + 445, + 451 + ] + } + ], + "patch": "delete", + "range": [ + 387, + 452 + ] + } + ], + "range": [ + 387, + 453 + ] + } + ], + "hasChanges": true, + "range": [ + 387, + 453 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 462, + 467 + ] + } + ], + "range": [ + 462, + 467 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 469, + 474 + ] + } + ], + "range": [ + 469, + 474 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 476, + 481 + ] + } + ], + "range": [ + 476, + 481 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 483, + 488 + ] + } + ], + "range": [ + 483, + 488 + ] + } + ], + "patch": "delete", + "range": [ + 453, + 491 + ] + } + ], + "range": [ + 453, + 492 + ] + } + ], + "hasChanges": true, + "range": [ + 453, + 492 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 501, + 510 + ] + }, + { + "category": "Identifier", + "range": [ + 514, + 519 + ] + } + ], + "range": [ + 501, + 519 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 521, + 530 + ] + }, + { + "category": "Identifier", + "range": [ + 534, + 539 + ] + } + ], + "range": [ + 521, + 539 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 541, + 546 + ] + } + ], + "range": [ + 541, + 546 + ] + } + ], + "patch": "delete", + "range": [ + 492, + 549 + ] + } + ], + "range": [ + 492, + 550 + ] + } + ], + "hasChanges": true, + "range": [ + 492, + 550 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 561, + 566 + ] + } + ], + "range": [ + 561, + 566 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 568, + 573 + ] + } + ], + "range": [ + 568, + 573 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 575, + 580 + ] + } + ], + "range": [ + 575, + 580 + ] + } + ], + "patch": "delete", + "range": [ + 550, + 581 + ] + } + ], + "range": [ + 550, + 582 + ] + } + ], + "hasChanges": true, + "range": [ + 550, + 582 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 593, + 598 + ] + }, + { + "category": "Identifier", + "range": [ + 601, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + } + ], + "range": [ + 593, + 607 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 609, + 614 + ] + }, + { + "category": "Identifier", + "range": [ + 617, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + } + ], + "range": [ + 609, + 623 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 625, + 630 + ] + } + ], + "range": [ + 625, + 630 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 632, + 637 + ] + } + ], + "range": [ + 632, + 637 + ] + } + ], + "patch": "delete", + "range": [ + 582, + 638 + ] + } + ], + "range": [ + 582, + 639 + ] + } + ], + "hasChanges": true, + "range": [ + 582, + 639 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 654, + 667 + ] + } + ], + "patch": "delete", + "range": [ + 639, + 668 + ] + } + ], + "range": [ + 639, + 669 + ] + } + ], + "hasChanges": true, + "range": [ + 639, + 669 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 696, + 699 + ] + } + ], + "range": [ + 684, + 699 + ] + } + ], + "patch": "delete", + "range": [ + 669, + 700 + ] + } + ], + "range": [ + 669, + 701 + ] + } + ], + "hasChanges": true, + "range": [ + 669, + 701 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 725, + 730 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 733, + 736 + ] + } + ], + "range": [ + 716, + 736 + ] + } + ], + "patch": "delete", + "range": [ + 701, + 737 + ] + } + ], + "range": [ + 701, + 738 + ] + } + ], + "hasChanges": true, + "range": [ + 701, + 738 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 747, + 752 + ] + }, + { + "category": "Identifier", + "range": [ + 756, + 763 + ] + } + ], + "range": [ + 747, + 763 + ] + } + ], + "patch": "delete", + "range": [ + 738, + 766 + ] + } + ], + "range": [ + 738, + 767 + ] + } + ], + "hasChanges": true, + "range": [ + 738, + 767 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 781, + 786 + ] + } + ], + "patch": "delete", + "range": [ + 767, + 787 + ] + } + ], + "range": [ + 767, + 788 + ] + } + ], + "hasChanges": true, + "range": [ + 767, + 788 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 797, + 802 + ] + } + ], + "range": [ + 797, + 802 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 804, + 809 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 811, + 816 + ] + } + ], + "range": [ + 811, + 816 + ] + }, + { + "category": "StringLiteral", + "range": [ + 824, + 829 + ] + } + ], + "patch": "delete", + "range": [ + 788, + 830 + ] + } + ], + "range": [ + 788, + 831 + ] + } + ], + "hasChanges": true, + "range": [ + 788, + 831 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 840, + 847 + ] + }, + { + "category": "Identifier", + "range": [ + 851, + 856 + ] + } + ], + "range": [ + 840, + 856 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 858, + 865 + ] + }, + { + "category": "Identifier", + "range": [ + 869, + 874 + ] + } + ], + "range": [ + 858, + 874 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 881 + ] + } + ], + "range": [ + 876, + 881 + ] + }, + { + "category": "StringLiteral", + "range": [ + 889, + 894 + ] + } + ], + "patch": "delete", + "range": [ + 831, + 895 + ] + } + ], + "range": [ + 831, + 896 + ] + } + ], + "hasChanges": true, + "range": [ + 831, + 896 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 905, + 910 + ] + } + ], + "range": [ + 905, + 910 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 912, + 917 + ] + } + ], + "range": [ + 912, + 917 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 919, + 924 + ] + } + ], + "range": [ + 919, + 924 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 926, + 931 + ] + } + ], + "range": [ + 896, + 934 + ] + } + ], + "range": [ + 896, + 935 + ] + } + ], + "hasChanges": false, + "range": [ + 896, + 935 + ], + "number": 23 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 944, + 953 + ] + }, + { + "category": "Identifier", + "range": [ + 957, + 962 + ] + } + ], + "range": [ + 944, + 962 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 964, + 973 + ] + }, + { + "category": "Identifier", + "range": [ + 977, + 982 + ] + } + ], + "range": [ + 964, + 982 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 984, + 989 + ] + } + ], + "range": [ + 935, + 992 + ] + } + ], + "range": [ + 935, + 993 + ] + } + ], + "hasChanges": false, + "range": [ + 935, + 993 + ], + "number": 24 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1004, + 1009 + ] + } + ], + "range": [ + 1004, + 1009 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1016 + ] + } + ], + "range": [ + 1011, + 1016 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 1018, + 1023 + ] + } + ], + "range": [ + 993, + 1024 + ] + } + ], + "range": [ + 993, + 1025 + ] + } + ], + "hasChanges": false, + "range": [ + 993, + 1025 + ], + "number": 25 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": false, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1036, + 1041 + ] + }, + { + "category": "Identifier", + "range": [ + 1044, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + } + ], + "range": [ + 1036, + 1050 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 1052, + 1057 + ] + }, + { + "category": "Identifier", + "range": [ + 1060, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + } + ], + "range": [ + 1052, + 1066 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1068, + 1073 + ] + } + ], + "range": [ + 1068, + 1073 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1075, + 1080 + ] + } + ], + "range": [ + 1025, + 1081 + ] + } + ], + "range": [ + 1025, + 1082 + ] + } + ], + "hasChanges": false, + "range": [ + 1025, + 1082 + ], + "number": 26 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": false, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 1097, + 1110 + ] + } + ], + "range": [ + 1082, + 1111 + ] + } + ], + "range": [ + 1082, + 1112 + ] + } + ], + "hasChanges": false, + "range": [ + 1082, + 1112 + ], + "number": 27 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 214 + ] + } + ], + "range": [ + 186, + 215 + ] + } + ], + "range": [ + 186, + 216 + ] + } + ], + "hasChanges": false, + "range": [ + 186, + 216 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 1139, + 1142 + ] + } + ], + "range": [ + 1127, + 1142 + ] + } + ], + "range": [ + 1112, + 1143 + ] + } + ], + "range": [ + 1112, + 1144 + ] + } + ], + "hasChanges": false, + "range": [ + 1112, + 1144 + ], + "number": 28 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 243, + 246 + ] + } + ], + "range": [ + 231, + 246 + ] + } + ], + "range": [ + 216, + 247 + ] + } + ], + "range": [ + 216, + 248 + ] + } + ], + "hasChanges": false, + "range": [ + 216, + 248 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 1168, + 1173 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 1176, + 1179 + ] + } + ], + "range": [ + 1159, + 1179 + ] + } + ], + "range": [ + 1144, + 1180 + ] + } + ], + "range": [ + 1144, + 1181 + ] + } + ], + "hasChanges": false, + "range": [ + 1144, + 1181 + ], + "number": 29 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 272, + 277 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 280, + 283 + ] + } + ], + "range": [ + 263, + 283 + ] + } + ], + "range": [ + 248, + 284 + ] + } + ], + "range": [ + 248, + 285 + ] + } + ], + "hasChanges": false, + "range": [ + 248, + 285 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1190, + 1195 + ] + }, + { + "category": "Identifier", + "range": [ + 1199, + 1206 + ] + } + ], + "range": [ + 1190, + 1206 + ] + } + ], + "range": [ + 1181, + 1209 + ] + } + ], + "range": [ + 1181, + 1210 + ] + } + ], + "hasChanges": false, + "range": [ + 1181, + 1210 + ], + "number": 30 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 294, + 299 + ] + }, + { + "category": "Identifier", + "range": [ + 303, + 310 + ] + } + ], + "range": [ + 294, + 310 + ] + } + ], + "range": [ + 285, + 313 + ] + } + ], + "range": [ + 285, + 314 + ] + } + ], + "hasChanges": false, + "range": [ + 285, + 314 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1224, + 1229 + ] + } + ], + "range": [ + 1210, + 1230 + ] + } + ], + "range": [ + 1210, + 1231 + ] + } + ], + "hasChanges": false, + "range": [ + 1210, + 1231 + ], + "number": 31 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 328, + 333 + ] + } + ], + "range": [ + 314, + 334 + ] + } + ], + "range": [ + 314, + 335 + ] + } + ], + "hasChanges": false, + "range": [ + 314, + 335 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1240, + 1245 + ] + } + ], + "range": [ + 1240, + 1245 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1247, + 1252 + ] + } + ], + "range": [ + 1247, + 1252 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1254, + 1259 + ] + } + ], + "range": [ + 1254, + 1259 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1267, + 1272 + ] + } + ], + "range": [ + 1231, + 1273 + ] + } + ], + "range": [ + 1231, + 1274 + ] + } + ], + "hasChanges": false, + "range": [ + 1231, + 1274 + ], + "number": 32 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 344, + 349 + ] + } + ], + "range": [ + 344, + 349 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 351, + 356 + ] + } + ], + "range": [ + 351, + 356 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 358, + 363 + ] + } + ], + "range": [ + 358, + 363 + ] + }, + { + "category": "StringLiteral", + "range": [ + 371, + 376 + ] + } + ], + "range": [ + 335, + 377 + ] + } + ], + "range": [ + 335, + 378 + ] + } + ], + "hasChanges": false, + "range": [ + 335, + 378 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1283, + 1290 + ] + }, + { + "category": "Identifier", + "range": [ + 1294, + 1299 + ] + } + ], + "range": [ + 1283, + 1299 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1301, + 1308 + ] + }, + { + "category": "Identifier", + "range": [ + 1312, + 1317 + ] + } + ], + "range": [ + 1301, + 1317 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 1319, + 1324 + ] + } + ], + "range": [ + 1319, + 1324 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1332, + 1337 + ] + } + ], + "range": [ + 1274, + 1338 + ] + } + ], + "range": [ + 1274, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1274, + 1339 + ], + "number": 33 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 394 + ] + }, + { + "category": "Identifier", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 387, + 403 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 405, + 412 + ] + }, + { + "category": "Identifier", + "range": [ + 416, + 421 + ] + } + ], + "range": [ + 405, + 421 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 423, + 428 + ] + } + ], + "range": [ + 423, + 428 + ] + }, + { + "category": "StringLiteral", + "range": [ + 436, + 441 + ] + } + ], + "range": [ + 378, + 442 + ] + } + ], + "range": [ + 378, + 443 + ] + } + ], + "hasChanges": false, + "range": [ + 378, + 443 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 452, + 457 + ] + } + ], + "range": [ + 452, + 457 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 459, + 464 + ] + } + ], + "range": [ + 459, + 464 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 466, + 471 + ] + } + ], + "range": [ + 466, + 471 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 473, + 478 + ] + } + ], + "range": [ + 473, + 478 + ] + } + ], + "patch": "insert", + "range": [ + 443, + 481 + ] + } + ], + "range": [ + 443, + 482 + ] + } + ], + "hasChanges": true, + "range": [ + 443, + 482 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 491, + 500 + ] + }, + { + "category": "Identifier", + "range": [ + 504, + 509 + ] + } + ], + "range": [ + 491, + 509 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 511, + 520 + ] + }, + { + "category": "Identifier", + "range": [ + 524, + 529 + ] + } + ], + "range": [ + 511, + 529 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 531, + 536 + ] + } + ], + "range": [ + 531, + 536 + ] + } + ], + "patch": "insert", + "range": [ + 482, + 539 + ] + } + ], + "range": [ + 482, + 540 + ] + } + ], + "hasChanges": true, + "range": [ + 482, + 540 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 551, + 556 + ] + } + ], + "range": [ + 551, + 556 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 558, + 563 + ] + } + ], + "range": [ + 558, + 563 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 565, + 570 + ] + } + ], + "range": [ + 565, + 570 + ] + } + ], + "patch": "insert", + "range": [ + 540, + 571 + ] + } + ], + "range": [ + 540, + 572 + ] + } + ], + "hasChanges": true, + "range": [ + 540, + 572 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 583, + 588 + ] + }, + { + "category": "Identifier", + "range": [ + 591, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 599, + 604 + ] + }, + { + "category": "Identifier", + "range": [ + 607, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 615, + 620 + ] + } + ], + "range": [ + 615, + 620 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 622, + 627 + ] + } + ], + "range": [ + 622, + 627 + ] + } + ], + "patch": "insert", + "range": [ + 572, + 628 + ] + } + ], + "range": [ + 572, + 629 + ] + } + ], + "hasChanges": true, + "range": [ + 572, + 629 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 644, + 662 + ] + } + ], + "patch": "insert", + "range": [ + 629, + 663 + ] + } + ], + "range": [ + 629, + 664 + ] + } + ], + "hasChanges": true, + "range": [ + 629, + 664 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 688, + 696 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 699, + 701 + ] + } + ], + "range": [ + 679, + 701 + ] + } + ], + "patch": "insert", + "range": [ + 664, + 702 + ] + } + ], + "range": [ + 664, + 703 + ] + } + ], + "hasChanges": true, + "range": [ + 664, + 703 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 730, + 732 + ] + } + ], + "range": [ + 718, + 732 + ] + } + ], + "patch": "insert", + "range": [ + 703, + 733 + ] + } + ], + "range": [ + 703, + 734 + ] + } + ], + "hasChanges": true, + "range": [ + 703, + 734 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 743, + 748 + ] + }, + { + "category": "Identifier", + "range": [ + 752, + 761 + ] + } + ], + "range": [ + 743, + 761 + ] + } + ], + "patch": "insert", + "range": [ + 734, + 764 + ] + } + ], + "range": [ + 734, + 765 + ] + } + ], + "hasChanges": true, + "range": [ + 734, + 765 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 779, + 784 + ] + } + ], + "patch": "insert", + "range": [ + 765, + 785 + ] + } + ], + "range": [ + 765, + 786 + ] + } + ], + "hasChanges": true, + "range": [ + 765, + 786 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 795, + 800 + ] + } + ], + "range": [ + 795, + 800 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 802, + 807 + ] + } + ], + "range": [ + 802, + 807 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 809, + 814 + ] + } + ], + "range": [ + 809, + 814 + ] + }, + { + "category": "StringLiteral", + "range": [ + 822, + 828 + ] + } + ], + "patch": "insert", + "range": [ + 786, + 829 + ] + } + ], + "range": [ + 786, + 830 + ] + } + ], + "hasChanges": true, + "range": [ + 786, + 830 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 839, + 846 + ] + }, + { + "category": "Identifier", + "range": [ + 850, + 855 + ] + } + ], + "range": [ + 839, + 855 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 857, + 864 + ] + }, + { + "category": "Identifier", + "range": [ + 868, + 873 + ] + } + ], + "range": [ + 857, + 873 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 875, + 880 + ] + } + ], + "range": [ + 875, + 880 + ] + }, + { + "category": "StringLiteral", + "range": [ + 888, + 894 + ] + } + ], + "patch": "insert", + "range": [ + 830, + 895 + ] + } + ], + "range": [ + 830, + 896 + ] + } + ], + "hasChanges": true, + "range": [ + 830, + 896 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1339, + 1339 + ] + } + ], + "hasChanges": false, + "range": [ + 1339, + 1339 + ], + "number": 34 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 896, + 896 + ] + } + ], + "hasChanges": false, + "range": [ + 896, + 896 + ], + "number": 23 + } + ] + ], + "paths": [ + "export.js", + "export.js" + ], + "oids": [ + "c8b53ff3b2b7c29c2bcdc40c98608cf8b3d12134", + "281c6726314976cf5957279776a39d6cee11aa46" + ] + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index c8b53ff..281c672 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,25 +1,3 @@", + "-export { name4, name5, name6, nameZ };", + "-export { variable2 as name2, variable3 as name3, nameY };", + "-export let name3, name4, nameT;", + "-export let name2 = value2, name3 = value3, name4, nameO;", + "-export default otherNamedFunction;", + "-export default function newName1() {};", + "-export default function () {};", + "-export { name2 as statement };", + "-export * from 'baz';", + "-export { name7, name8, nameP } from 'buzz';", + "-export { import6 as name6, import7 as name7, nameB } from 'fizz';", + "-export { name1, name2, name3, nameN };", + "-export { variable1 as name1, variable2 as name2, nameN };", + "-export let name1, name2, nameN;", + "-export let name1 = value1, name2 = value2, name3, nameN;", + "-export default namedFunction;", + "-export default function () { };", + "-export default function name1() { };", + "-export { name1 as default };", + "-export * from 'foo';", + "-export { name1, name2, nameN } from 'foo';", + "-export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name1, name2, name3, nameN };", + " export { variable1 as name1, variable2 as name2, nameN };", + " export let name1, name2, nameN;", + "@@ -31,3 +9,14 @@ export { name1 as default };", + " export * from 'foo';", + " export { name1, name2, nameN } from 'foo';", + " export { import1 as name1, import2 as name2, nameN } from 'bar';", + "+export { name4, name5, name6, nameZ };", + "+export { variable2 as name2, variable3 as name3, nameY };", + "+export let name3, name4, nameT;", + "+export let name2 = value2, name3 = value3, name4, nameO;", + "+export default otherNamedFunction;", + "+export default function newName1() {};", + "+export default function () {};", + "+export { name2 as statement };", + "+export * from 'baz';", + "+export { name7, name8, nameP } from 'buzz';", + "+export { import6 as name6, import7 as name7, nameB } from 'fizz';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a7d8a8c67df112242870b85873789fcd84c93dc4..33d58d61e860aaf9d71c3a00aff457cf8c5e7d15" +} +,{ + "testCaseDescription": "javascript-export-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "patch": "delete", + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "patch": "delete", + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "patch": "delete", + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 214 + ] + } + ], + "patch": "delete", + "range": [ + 186, + 215 + ] + } + ], + "range": [ + 186, + 216 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 216 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 243, + 246 + ] + } + ], + "range": [ + 231, + 246 + ] + } + ], + "patch": "delete", + "range": [ + 216, + 247 + ] + } + ], + "range": [ + 216, + 248 + ] + } + ], + "hasChanges": true, + "range": [ + 216, + 248 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 272, + 277 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 280, + 283 + ] + } + ], + "range": [ + 263, + 283 + ] + } + ], + "patch": "delete", + "range": [ + 248, + 284 + ] + } + ], + "range": [ + 248, + 285 + ] + } + ], + "hasChanges": true, + "range": [ + 248, + 285 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 294, + 299 + ] + }, + { + "category": "Identifier", + "range": [ + 303, + 310 + ] + } + ], + "range": [ + 294, + 310 + ] + } + ], + "patch": "delete", + "range": [ + 285, + 313 + ] + } + ], + "range": [ + 285, + 314 + ] + } + ], + "hasChanges": true, + "range": [ + 285, + 314 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 328, + 333 + ] + } + ], + "patch": "delete", + "range": [ + 314, + 334 + ] + } + ], + "range": [ + 314, + 335 + ] + } + ], + "hasChanges": true, + "range": [ + 314, + 335 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 344, + 349 + ] + } + ], + "range": [ + 344, + 349 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 351, + 356 + ] + } + ], + "range": [ + 351, + 356 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 358, + 363 + ] + } + ], + "range": [ + 358, + 363 + ] + }, + { + "category": "StringLiteral", + "range": [ + 371, + 376 + ] + } + ], + "patch": "delete", + "range": [ + 335, + 377 + ] + } + ], + "range": [ + 335, + 378 + ] + } + ], + "hasChanges": true, + "range": [ + 335, + 378 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 394 + ] + }, + { + "category": "Identifier", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 387, + 403 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 405, + 412 + ] + }, + { + "category": "Identifier", + "range": [ + 416, + 421 + ] + } + ], + "range": [ + 405, + 421 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 423, + 428 + ] + } + ], + "range": [ + 423, + 428 + ] + }, + { + "category": "StringLiteral", + "range": [ + 436, + 441 + ] + } + ], + "patch": "delete", + "range": [ + 378, + 442 + ] + } + ], + "range": [ + 378, + 443 + ] + } + ], + "hasChanges": true, + "range": [ + 378, + 443 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 452, + 457 + ] + } + ], + "range": [ + 452, + 457 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 459, + 464 + ] + } + ], + "range": [ + 459, + 464 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 466, + 471 + ] + } + ], + "range": [ + 466, + 471 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 473, + 478 + ] + } + ], + "range": [ + 473, + 478 + ] + } + ], + "range": [ + 443, + 481 + ] + } + ], + "range": [ + 443, + 482 + ] + } + ], + "hasChanges": false, + "range": [ + 443, + 482 + ], + "number": 12 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 491, + 500 + ] + }, + { + "category": "Identifier", + "range": [ + 504, + 509 + ] + } + ], + "range": [ + 491, + 509 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 511, + 520 + ] + }, + { + "category": "Identifier", + "range": [ + 524, + 529 + ] + } + ], + "range": [ + 511, + 529 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 531, + 536 + ] + } + ], + "range": [ + 531, + 536 + ] + } + ], + "range": [ + 482, + 539 + ] + } + ], + "range": [ + 482, + 540 + ] + } + ], + "hasChanges": false, + "range": [ + 482, + 540 + ], + "number": 13 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 39, + 96 + ] + } + ], + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 551, + 556 + ] + } + ], + "range": [ + 551, + 556 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 558, + 563 + ] + } + ], + "range": [ + 558, + 563 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 565, + 570 + ] + } + ], + "range": [ + 565, + 570 + ] + } + ], + "range": [ + 540, + 571 + ] + } + ], + "range": [ + 540, + 572 + ] + } + ], + "hasChanges": false, + "range": [ + 540, + 572 + ], + "number": 14 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 97, + 128 + ] + } + ], + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": false, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 583, + 588 + ] + }, + { + "category": "Identifier", + "range": [ + 591, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + } + ], + "range": [ + 583, + 597 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 599, + 604 + ] + }, + { + "category": "Identifier", + "range": [ + 607, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + } + ], + "range": [ + 599, + 613 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 615, + 620 + ] + } + ], + "range": [ + 615, + 620 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 622, + 627 + ] + } + ], + "range": [ + 622, + 627 + ] + } + ], + "range": [ + 572, + 628 + ] + } + ], + "range": [ + 572, + 629 + ] + } + ], + "hasChanges": false, + "range": [ + 572, + 629 + ], + "number": 15 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 129, + 185 + ] + } + ], + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": false, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 644, + 662 + ] + } + ], + "range": [ + 629, + 663 + ] + } + ], + "range": [ + 629, + 664 + ] + } + ], + "hasChanges": false, + "range": [ + 629, + 664 + ], + "number": 16 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 219 + ] + } + ], + "range": [ + 186, + 220 + ] + } + ], + "range": [ + 186, + 221 + ] + } + ], + "hasChanges": false, + "range": [ + 186, + 221 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 688, + 696 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 699, + 701 + ] + } + ], + "range": [ + 679, + 701 + ] + } + ], + "range": [ + 664, + 702 + ] + } + ], + "range": [ + 664, + 703 + ] + } + ], + "hasChanges": false, + "range": [ + 664, + 703 + ], + "number": 17 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 245, + 253 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 256, + 258 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "range": [ + 221, + 259 + ] + } + ], + "range": [ + 221, + 260 + ] + } + ], + "hasChanges": false, + "range": [ + 221, + 260 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 730, + 732 + ] + } + ], + "range": [ + 718, + 732 + ] + } + ], + "range": [ + 703, + 733 + ] + } + ], + "range": [ + 703, + 734 + ] + } + ], + "hasChanges": false, + "range": [ + 703, + 734 + ], + "number": 18 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 287, + 289 + ] + } + ], + "range": [ + 275, + 289 + ] + } + ], + "range": [ + 260, + 290 + ] + } + ], + "range": [ + 260, + 291 + ] + } + ], + "hasChanges": false, + "range": [ + 260, + 291 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 743, + 748 + ] + }, + { + "category": "Identifier", + "range": [ + 752, + 761 + ] + } + ], + "range": [ + 743, + 761 + ] + } + ], + "range": [ + 734, + 764 + ] + } + ], + "range": [ + 734, + 765 + ] + } + ], + "hasChanges": false, + "range": [ + 734, + 765 + ], + "number": 19 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 300, + 305 + ] + }, + { + "category": "Identifier", + "range": [ + 309, + 318 + ] + } + ], + "range": [ + 300, + 318 + ] + } + ], + "range": [ + 291, + 321 + ] + } + ], + "range": [ + 291, + 322 + ] + } + ], + "hasChanges": false, + "range": [ + 291, + 322 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 779, + 784 + ] + } + ], + "range": [ + 765, + 785 + ] + } + ], + "range": [ + 765, + 786 + ] + } + ], + "hasChanges": false, + "range": [ + 765, + 786 + ], + "number": 20 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 336, + 341 + ] + } + ], + "range": [ + 322, + 342 + ] + } + ], + "range": [ + 322, + 343 + ] + } + ], + "hasChanges": false, + "range": [ + 322, + 343 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 795, + 800 + ] + } + ], + "range": [ + 795, + 800 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 802, + 807 + ] + } + ], + "range": [ + 802, + 807 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 809, + 814 + ] + } + ], + "range": [ + 809, + 814 + ] + }, + { + "category": "StringLiteral", + "range": [ + 822, + 828 + ] + } + ], + "range": [ + 786, + 829 + ] + } + ], + "range": [ + 786, + 830 + ] + } + ], + "hasChanges": false, + "range": [ + 786, + 830 + ], + "number": 21 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 352, + 357 + ] + } + ], + "range": [ + 352, + 357 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 359, + 364 + ] + } + ], + "range": [ + 359, + 364 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 366, + 371 + ] + } + ], + "range": [ + 366, + 371 + ] + }, + { + "category": "StringLiteral", + "range": [ + 379, + 385 + ] + } + ], + "range": [ + 343, + 386 + ] + } + ], + "range": [ + 343, + 387 + ] + } + ], + "hasChanges": false, + "range": [ + 343, + 387 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 839, + 846 + ] + }, + { + "category": "Identifier", + "range": [ + 850, + 855 + ] + } + ], + "range": [ + 839, + 855 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 857, + 864 + ] + }, + { + "category": "Identifier", + "range": [ + 868, + 873 + ] + } + ], + "range": [ + 857, + 873 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 875, + 880 + ] + } + ], + "range": [ + 875, + 880 + ] + }, + { + "category": "StringLiteral", + "range": [ + 888, + 894 + ] + } + ], + "range": [ + 830, + 895 + ] + } + ], + "range": [ + 830, + 896 + ] + } + ], + "hasChanges": false, + "range": [ + 830, + 896 + ], + "number": 22 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 396, + 403 + ] + }, + { + "category": "Identifier", + "range": [ + 407, + 412 + ] + } + ], + "range": [ + 396, + 412 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 414, + 421 + ] + }, + { + "category": "Identifier", + "range": [ + 425, + 430 + ] + } + ], + "range": [ + 414, + 430 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 432, + 437 + ] + }, + { + "category": "StringLiteral", + "range": [ + 445, + 451 + ] + } + ], + "range": [ + 387, + 452 + ] + } + ], + "range": [ + 387, + 453 + ] + } + ], + "hasChanges": false, + "range": [ + 387, + 453 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 896, + 896 + ] + } + ], + "hasChanges": false, + "range": [ + 896, + 896 + ], + "number": 23 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 453, + 453 + ] + } + ], + "hasChanges": false, + "range": [ + 453, + 453 + ], + "number": 12 + } + ] + ], + "paths": [ + "export.js", + "export.js" + ], + "oids": [ + "281c6726314976cf5957279776a39d6cee11aa46", + "e105ba78571fac3ca34034c112646c0548b33b11" + ] + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index 281c672..e105ba7 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,14 +1,3 @@", + "-export { name1, name2, name3, nameN };", + "-export { variable1 as name1, variable2 as name2, nameN };", + "-export let name1, name2, nameN;", + "-export let name1 = value1, name2 = value2, name3, nameN;", + "-export default namedFunction;", + "-export default function () { };", + "-export default function name1() { };", + "-export { name1 as default };", + "-export * from 'foo';", + "-export { name1, name2, nameN } from 'foo';", + "-export { import1 as name1, import2 as name2, nameN } from 'bar';", + " export { name4, name5, name6, nameZ };", + " export { variable2 as name2, variable3 as name3, nameY };", + " export let name3, name4, nameT;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "33d58d61e860aaf9d71c3a00aff457cf8c5e7d15..52b3a9b592646247d5884c136733a12cb2971479" +} +,{ + "testCaseDescription": "javascript-export-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + } + ], + "range": [ + 9, + 14 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 21 + ] + } + ], + "range": [ + 16, + 21 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 39 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 48, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + } + ], + "range": [ + 48, + 66 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 86 + ] + } + ], + "range": [ + 68, + 86 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 39, + 96 + ] + } + ], + "patch": "delete", + "range": [ + 39, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 39, + 97 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + } + ], + "range": [ + 108, + 113 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 120 + ] + } + ], + "range": [ + 115, + 120 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 122, + 127 + ] + } + ], + "range": [ + 97, + 128 + ] + } + ], + "patch": "delete", + "range": [ + 97, + 129 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 140, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + } + ], + "range": [ + 140, + 154 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 156, + 161 + ] + }, + { + "category": "Identifier", + "range": [ + 164, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + } + ], + "range": [ + 156, + 170 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 177 + ] + } + ], + "range": [ + 172, + 177 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 179, + 184 + ] + } + ], + "range": [ + 129, + 185 + ] + } + ], + "patch": "delete", + "range": [ + 129, + 186 + ] + } + ], + "hasChanges": true, + "range": [ + 129, + 186 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Identifier", + "range": [ + 201, + 219 + ] + } + ], + "range": [ + 186, + 220 + ] + } + ], + "patch": "delete", + "range": [ + 186, + 221 + ] + } + ], + "hasChanges": true, + "range": [ + 186, + 221 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 245, + 253 + ] + }, + { + "category": "ExpressionStatements", + "range": [ + 256, + 258 + ] + } + ], + "range": [ + 236, + 258 + ] + } + ], + "range": [ + 221, + 259 + ] + } + ], + "patch": "delete", + "range": [ + 221, + 260 + ] + } + ], + "hasChanges": true, + "range": [ + 221, + 260 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "ExpressionStatements", + "range": [ + 287, + 289 + ] + } + ], + "range": [ + 275, + 289 + ] + } + ], + "range": [ + 260, + 290 + ] + } + ], + "patch": "delete", + "range": [ + 260, + 291 + ] + } + ], + "hasChanges": true, + "range": [ + 260, + 291 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 300, + 305 + ] + }, + { + "category": "Identifier", + "range": [ + 309, + 318 + ] + } + ], + "range": [ + 300, + 318 + ] + } + ], + "range": [ + 291, + 321 + ] + } + ], + "patch": "delete", + "range": [ + 291, + 322 + ] + } + ], + "hasChanges": true, + "range": [ + 291, + 322 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "StringLiteral", + "range": [ + 336, + 341 + ] + } + ], + "range": [ + 322, + 342 + ] + } + ], + "patch": "delete", + "range": [ + 322, + 343 + ] + } + ], + "hasChanges": true, + "range": [ + 322, + 343 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 352, + 357 + ] + } + ], + "range": [ + 352, + 357 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 359, + 364 + ] + } + ], + "range": [ + 359, + 364 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 366, + 371 + ] + } + ], + "range": [ + 366, + 371 + ] + }, + { + "category": "StringLiteral", + "range": [ + 379, + 385 + ] + } + ], + "range": [ + 343, + 386 + ] + } + ], + "patch": "delete", + "range": [ + 343, + 387 + ] + } + ], + "hasChanges": true, + "range": [ + 343, + 387 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Export", + "children": [ + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 396, + 403 + ] + }, + { + "category": "Identifier", + "range": [ + 407, + 412 + ] + } + ], + "range": [ + 396, + 412 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 414, + 421 + ] + }, + { + "category": "Identifier", + "range": [ + 425, + 430 + ] + } + ], + "range": [ + 414, + 430 + ] + }, + { + "category": "export_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 432, + 437 + ] + }, + { + "category": "StringLiteral", + "range": [ + 445, + 451 + ] + } + ], + "range": [ + 387, + 452 + ] + } + ], + "patch": "delete", + "range": [ + 387, + 453 + ] + } + ], + "hasChanges": true, + "range": [ + 387, + 453 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 453, + 453 + ] + } + ], + "hasChanges": true, + "range": [ + 453, + 453 + ], + "number": 12 + } + ] + ], + "paths": [ + "export.js", + "export.js" + ], + "oids": [ + "e105ba78571fac3ca34034c112646c0548b33b11", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "export.js" + ], + "patch": [ + "diff --git a/export.js b/export.js", + "index e105ba7..e69de29 100644", + "--- a/export.js", + "+++ b/export.js", + "@@ -1,11 +0,0 @@", + "-export { name4, name5, name6, nameZ };", + "-export { variable2 as name2, variable3 as name3, nameY };", + "-export let name3, name4, nameT;", + "-export let name2 = value2, name3 = value3, name4, nameO;", + "-export default otherNamedFunction;", + "-export default function newName1() {};", + "-export default function () {};", + "-export { name2 as statement };", + "-export * from 'baz';", + "-export { name7, name8, nameP } from 'buzz';", + "-export { import6 as name6, import7 as name7, nameB } from 'fizz';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "52b3a9b592646247d5884c136733a12cb2971479..5dede241573c8e353a4d8c662194e8e3b750e01a" +}] diff --git a/test/corpus/json/javascript/false.json b/test/corpus/json/javascript/false.json new file mode 100644 index 000000000..3fa10e9de --- /dev/null +++ b/test/corpus/json/javascript/false.json @@ -0,0 +1,1400 @@ +[{ + "testCaseDescription": "javascript-false-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 7 + ], + "number": 2 + } + ] + ], + "paths": [ + "false.js", + "false.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "8a63946258eddc17ba51e2165b17aa50e3ebc9fa" + ] + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index e69de29..8a63946 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -0,0 +1 @@", + "+false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "163b832af7eb86fe2d319810d137565e70a924f4..534e91d885497e33f825d5c9e7e90ef4986e83b6" +} +,{ + "testCaseDescription": "javascript-false-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "patch": "insert", + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 14, + 21 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 21, + 27 + ] + } + ], + "range": [ + 21, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 28 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 7 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + } + ] + ], + "paths": [ + "false.js", + "false.js" + ], + "oids": [ + "8a63946258eddc17ba51e2165b17aa50e3ebc9fa", + "86574b160b9b16b2cac96835fe478e05aa257d42" + ] + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 8a63946..86574b1 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1 +1,3 @@", + "+return false;", + "+false;", + " false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "534e91d885497e33f825d5c9e7e90ef4986e83b6..f57bd598b66633b00684cbdb1b4d9ee81148d197" +} +,{ + "testCaseDescription": "javascript-false-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 5 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 21, + 27 + ] + } + ], + "range": [ + 21, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 28 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + } + ] + ], + "paths": [ + "false.js", + "false.js" + ], + "oids": [ + "86574b160b9b16b2cac96835fe478e05aa257d42", + "7bae7c53c216d4d18782c027934c3d80e003de0e" + ] + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 86574b1..7bae7c5 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,3 +1,3 @@", + "-return false;", + "+false;", + " false;", + " false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f57bd598b66633b00684cbdb1b4d9ee81148d197..09585d310062f9fe315c2a400c69cb13cf67675a" +} +,{ + "testCaseDescription": "javascript-false-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 5 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 21, + 27 + ] + } + ], + "range": [ + 21, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 28 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + } + ] + ], + "paths": [ + "false.js", + "false.js" + ], + "oids": [ + "7bae7c53c216d4d18782c027934c3d80e003de0e", + "86574b160b9b16b2cac96835fe478e05aa257d42" + ] + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 7bae7c5..86574b1 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,3 +1,3 @@", + "-false;", + "+return false;", + " false;", + " false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "09585d310062f9fe315c2a400c69cb13cf67675a..ed00e5f614db396d4d52c2bacefb89580ad7fbba" +} +,{ + "testCaseDescription": "javascript-false-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "patch": "delete", + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 14, + 21 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 21, + 27 + ] + } + ], + "range": [ + 21, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 28 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "patch": "insert", + "range": [ + 7, + 20 + ] + } + ], + "range": [ + 7, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 21 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 3 + } + ] + ], + "paths": [ + "false.js", + "false.js" + ], + "oids": [ + "86574b160b9b16b2cac96835fe478e05aa257d42", + "85b5be918c88b57b1186a126d787a5e8971480d5" + ] + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 86574b1..85b5be9 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,3 +1,2 @@", + "-return false;", + "-false;", + " false;", + "+return false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ed00e5f614db396d4d52c2bacefb89580ad7fbba..d8c0287cc65dc125d283d6aa0e6cd32a3d5e1e31" +} +,{ + "testCaseDescription": "javascript-false-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 5 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 7, + 20 + ] + } + ], + "range": [ + 7, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 21 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 14, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 14 + ], + "number": 2 + } + ] + ], + "paths": [ + "false.js", + "false.js" + ], + "oids": [ + "85b5be918c88b57b1186a126d787a5e8971480d5", + "1f328b3bd0042696e3a2181ff33dd4abb9103b2d" + ] + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 85b5be9..1f328b3 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1,2 +1 @@", + "-false;", + " return false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d8c0287cc65dc125d283d6aa0e6cd32a3d5e1e31..cd36fb39c2618d389cd4fd7511eded4aa0bdccf2" +} +,{ + "testCaseDescription": "javascript-false-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 14 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 14, + 14 + ] + } + ], + "hasChanges": true, + "range": [ + 14, + 14 + ], + "number": 2 + } + ] + ], + "paths": [ + "false.js", + "false.js" + ], + "oids": [ + "1f328b3bd0042696e3a2181ff33dd4abb9103b2d", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "false.js" + ], + "patch": [ + "diff --git a/false.js b/false.js", + "index 1f328b3..e69de29 100644", + "--- a/false.js", + "+++ b/false.js", + "@@ -1 +0,0 @@", + "-return false;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cd36fb39c2618d389cd4fd7511eded4aa0bdccf2..025ac2dcb7ae8e622fb5a7f0508e2ec9e15604f8" +}] diff --git a/test/corpus/json/javascript/for-in-statement.json b/test/corpus/json/javascript/for-in-statement.json new file mode 100644 index 000000000..5cd87ed3a --- /dev/null +++ b/test/corpus/json/javascript/for-in-statement.json @@ -0,0 +1,2470 @@ +[{ + "testCaseDescription": "javascript-for-in-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 29 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 0, + 34 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 35 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 35, + 35 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-in-statement.js", + "for-in-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "f92828765c7f00f13d387e5109c36665975b2c1f" + ] + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index e69de29..f928287 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -0,0 +1 @@", + "+for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "52f50b42f461e7840a4f2f57f62530561ab97768..d9d09d76031e48a29cbb2b4bd6ac915db7faf669" +} +,{ + "testCaseDescription": "javascript-for-in-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + } + ], + "range": [ + 22, + 29 + ] + } + ], + "range": [ + 20, + 31 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 52 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 61 + ] + } + ], + "range": [ + 56, + 63 + ] + } + ], + "range": [ + 56, + 64 + ] + } + ], + "range": [ + 54, + 66 + ] + } + ], + "patch": "insert", + "range": [ + 32, + 66 + ] + } + ], + "range": [ + 32, + 67 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 29 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 0, + 34 + ] + } + ], + "range": [ + 0, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 35 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 87 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + } + ], + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 91, + 99 + ] + } + ], + "range": [ + 89, + 101 + ] + } + ], + "range": [ + 67, + 101 + ] + } + ], + "range": [ + 67, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 102 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 35 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 102, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 102, + 102 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-in-statement.js", + "for-in-statement.js" + ], + "oids": [ + "f92828765c7f00f13d387e5109c36665975b2c1f", + "4a482e9e7259c51224cdf4d79f539924321a7f2e" + ] + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index f928287..4a482e9 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1 +1,3 @@", + "+for (item in items) { item(); }", + "+for (thing in things) { thing(); }", + " for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d9d09d76031e48a29cbb2b4bd6ac915db7faf669..7a879f58e1b410f3863c826bb925b05cb7473957" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 9 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 13, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 22, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + } + ], + "range": [ + 22, + 29 + ] + } + ], + "range": [ + 20, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 10 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 14, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 24, + 29 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 0, + 34 + ] + } + ], + "range": [ + 0, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 35 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 52 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 61 + ] + } + ], + "range": [ + 56, + 63 + ] + } + ], + "range": [ + 56, + 64 + ] + } + ], + "range": [ + 54, + 66 + ] + } + ], + "range": [ + 32, + 66 + ] + } + ], + "range": [ + 32, + 67 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 67 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 49, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 59, + 66 + ] + } + ], + "range": [ + 59, + 67 + ] + } + ], + "range": [ + 57, + 69 + ] + } + ], + "range": [ + 35, + 69 + ] + } + ], + "range": [ + 35, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 70 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 87 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + } + ], + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 91, + 99 + ] + } + ], + "range": [ + 89, + 101 + ] + } + ], + "range": [ + 67, + 101 + ] + } + ], + "range": [ + 67, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 102 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 75, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 94, + 99 + ] + } + ], + "range": [ + 94, + 101 + ] + } + ], + "range": [ + 94, + 102 + ] + } + ], + "range": [ + 92, + 104 + ] + } + ], + "range": [ + 70, + 104 + ] + } + ], + "range": [ + 70, + 105 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 105 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 102, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 102, + 102 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 105, + 105 + ] + } + ], + "hasChanges": false, + "range": [ + 105, + 105 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-in-statement.js", + "for-in-statement.js" + ], + "oids": [ + "4a482e9e7259c51224cdf4d79f539924321a7f2e", + "e949bafba01f1eeb4e22252ceb779f6a555c9e65" + ] + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index 4a482e9..e949baf 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (item in items) { item(); }", + "+for (thing in things) { thing(); }", + " for (thing in things) { thing(); }", + " for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7a879f58e1b410f3863c826bb925b05cb7473957..67b08f6c17669e3f8340b3ac65173960a248bb4b" +} +,{ + "testCaseDescription": "javascript-for-in-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 10 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 14, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 24, + 29 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 0, + 34 + ] + } + ], + "range": [ + 0, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 35 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 9 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 13, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 22, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + } + ], + "range": [ + 22, + 29 + ] + } + ], + "range": [ + 20, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 49, + 55 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 59, + 66 + ] + } + ], + "range": [ + 59, + 67 + ] + } + ], + "range": [ + 57, + 69 + ] + } + ], + "range": [ + 35, + 69 + ] + } + ], + "range": [ + 35, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 70 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 52 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 61 + ] + } + ], + "range": [ + 56, + 63 + ] + } + ], + "range": [ + 56, + 64 + ] + } + ], + "range": [ + 54, + 66 + ] + } + ], + "range": [ + 32, + 66 + ] + } + ], + "range": [ + 32, + 67 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 75, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 94, + 99 + ] + } + ], + "range": [ + 94, + 101 + ] + } + ], + "range": [ + 94, + 102 + ] + } + ], + "range": [ + 92, + 104 + ] + } + ], + "range": [ + 70, + 104 + ] + } + ], + "range": [ + 70, + 105 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 105 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 87 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + } + ], + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 91, + 99 + ] + } + ], + "range": [ + 89, + 101 + ] + } + ], + "range": [ + 67, + 101 + ] + } + ], + "range": [ + 67, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 102 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 105, + 105 + ] + } + ], + "hasChanges": false, + "range": [ + 105, + 105 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 102, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 102, + 102 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-in-statement.js", + "for-in-statement.js" + ], + "oids": [ + "e949bafba01f1eeb4e22252ceb779f6a555c9e65", + "4a482e9e7259c51224cdf4d79f539924321a7f2e" + ] + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index e949baf..4a482e9 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (thing in things) { thing(); }", + "+for (item in items) { item(); }", + " for (thing in things) { thing(); }", + " for (thing in things) { thing(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "67b08f6c17669e3f8340b3ac65173960a248bb4b..fd3d006a8e9e4c4d7d89911c4bf9d52271d6bfc5" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + } + ], + "range": [ + 22, + 29 + ] + } + ], + "range": [ + 20, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 42 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 52 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 61 + ] + } + ], + "range": [ + 56, + 63 + ] + } + ], + "range": [ + 56, + 64 + ] + } + ], + "range": [ + 54, + 66 + ] + } + ], + "patch": "delete", + "range": [ + 32, + 66 + ] + } + ], + "range": [ + 32, + 67 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 87 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + } + ], + "range": [ + 91, + 98 + ] + } + ], + "range": [ + 91, + 99 + ] + } + ], + "range": [ + 89, + 101 + ] + } + ], + "range": [ + 67, + 101 + ] + } + ], + "range": [ + 67, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 102 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 29 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 0, + 34 + ] + } + ], + "range": [ + 0, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 35 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 48, + 53 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 57, + 64 + ] + } + ], + "range": [ + 55, + 66 + ] + } + ], + "patch": "insert", + "range": [ + 35, + 66 + ] + } + ], + "range": [ + 35, + 67 + ] + } + ], + "hasChanges": true, + "range": [ + 35, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 102, + 102 + ] + } + ], + "hasChanges": false, + "range": [ + 102, + 102 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 67, + 67 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 67 + ], + "number": 3 + } + ] + ], + "paths": [ + "for-in-statement.js", + "for-in-statement.js" + ], + "oids": [ + "4a482e9e7259c51224cdf4d79f539924321a7f2e", + "6b5f12aec92911efcd84b7bc364d7b347e3b2806" + ] + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index 4a482e9..6b5f12a 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,3 +1,2 @@", + "-for (item in items) { item(); }", + "-for (thing in things) { thing(); }", + " for (thing in things) { thing(); }", + "+for (item in items) { item(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fd3d006a8e9e4c4d7d89911c4bf9d52271d6bfc5..6c112e115ba5ab522314b492040a7e80499a9933" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 29 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "range": [ + 22, + 34 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 34 + ] + } + ], + "range": [ + 0, + 35 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 35 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 48, + 53 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 57, + 64 + ] + } + ], + "range": [ + 55, + 66 + ] + } + ], + "range": [ + 35, + 66 + ] + } + ], + "range": [ + 35, + 67 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 67 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + } + ], + "range": [ + 22, + 29 + ] + } + ], + "range": [ + 20, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 67, + 67 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 67 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-in-statement.js", + "for-in-statement.js" + ], + "oids": [ + "6b5f12aec92911efcd84b7bc364d7b347e3b2806", + "a3d8882d036008901653a5d1c36e76df2e5f77b5" + ] + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index 6b5f12a..a3d8882 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1,2 +1 @@", + "-for (thing in things) { thing(); }", + " for (item in items) { item(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6c112e115ba5ab522314b492040a7e80499a9933..11445e23388ee5f53f07b1df875ecb65f30beafc" +} +,{ + "testCaseDescription": "javascript-for-in-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + } + ], + "range": [ + 22, + 29 + ] + } + ], + "range": [ + 20, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-in-statement.js", + "for-in-statement.js" + ], + "oids": [ + "a3d8882d036008901653a5d1c36e76df2e5f77b5", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "for-in-statement.js" + ], + "patch": [ + "diff --git a/for-in-statement.js b/for-in-statement.js", + "index a3d8882..e69de29 100644", + "--- a/for-in-statement.js", + "+++ b/for-in-statement.js", + "@@ -1 +0,0 @@", + "-for (item in items) { item(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "11445e23388ee5f53f07b1df875ecb65f30beafc..790f317cf635d64f5798d63a5b58483fd6bad99f" +}] diff --git a/test/corpus/json/javascript/for-loop-with-in-statement.json b/test/corpus/json/javascript/for-loop-with-in-statement.json new file mode 100644 index 000000000..12c6a7aa5 --- /dev/null +++ b/test/corpus/json/javascript/for-loop-with-in-statement.json @@ -0,0 +1,4546 @@ +[{ + "testCaseDescription": "javascript-for-loop-with-in-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 5, + 21 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 25, + 30 + ] + } + ], + "range": [ + 5, + 30 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 32, + 37 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 39, + 42 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 57 + ] + } + ], + "range": [ + 46, + 59 + ] + } + ], + "range": [ + 46, + 60 + ] + } + ], + "range": [ + 44, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 63, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 63, + 63 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-loop-with-in-statement.js", + "for-loop-with-in-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "c467478aec217a5b0911a4123d649479f2ec1975" + ] + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index e69de29..c467478 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -0,0 +1 @@", + "+for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8dd4d424eeae076b657c04fb290058c4635ae818..9811288bc6b350e349973dec14748a359efedc76" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 26 + ] + } + ], + "range": [ + 5, + 26 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 5, + 35 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 37, + 42 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 44, + 47 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 67 + ] + } + ], + "range": [ + 51, + 69 + ] + } + ], + "range": [ + 51, + 70 + ] + } + ], + "range": [ + 49, + 72 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 72 + ] + } + ], + "range": [ + 0, + 73 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 73 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 81 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 78, + 94 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 99 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 102, + 103 + ] + } + ], + "range": [ + 98, + 103 + ] + } + ], + "range": [ + 78, + 103 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 105, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 110 + ] + } + ], + "range": [ + 105, + 110 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + } + ], + "range": [ + 112, + 115 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 130 + ] + } + ], + "range": [ + 119, + 132 + ] + } + ], + "range": [ + 119, + 133 + ] + } + ], + "range": [ + 117, + 135 + ] + } + ], + "patch": "insert", + "range": [ + 73, + 135 + ] + } + ], + "range": [ + 73, + 136 + ] + } + ], + "hasChanges": true, + "range": [ + 73, + 136 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 5, + 21 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 25, + 30 + ] + } + ], + "range": [ + 5, + 30 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 32, + 37 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 39, + 42 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 57 + ] + } + ], + "range": [ + 46, + 59 + ] + } + ], + "range": [ + 46, + 60 + ] + } + ], + "range": [ + 44, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 63 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 141, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 157 + ] + } + ], + "range": [ + 141, + 157 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 162 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 161, + 166 + ] + } + ], + "range": [ + 141, + 166 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 173 + ] + } + ], + "range": [ + 168, + 173 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 175, + 176 + ] + } + ], + "range": [ + 175, + 178 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 182, + 193 + ] + } + ], + "range": [ + 182, + 195 + ] + } + ], + "range": [ + 182, + 196 + ] + } + ], + "range": [ + 180, + 198 + ] + } + ], + "range": [ + 136, + 198 + ] + } + ], + "range": [ + 136, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 199 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 63, + 63 + ] + } + ], + "hasChanges": false, + "range": [ + 63, + 63 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 199, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 199, + 199 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-loop-with-in-statement.js", + "for-loop-with-in-statement.js" + ], + "oids": [ + "c467478aec217a5b0911a4123d649479f2ec1975", + "0147d3180bc89a8f7f7722ebe9ba1ee53fbeeb87" + ] + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index c467478..0147d31 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1 +1,3 @@", + "+for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + "+for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9811288bc6b350e349973dec14748a359efedc76..63fc9f47c0b135eec17ac28e315a58a052f21fc8" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 26 + ] + } + ], + "range": [ + 5, + 26 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 5, + 35 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 37, + 42 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 44, + 47 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 51, + 67 + ] + } + ], + "range": [ + 51, + 69 + ] + } + ], + "range": [ + 51, + 70 + ] + } + ], + "range": [ + 49, + 72 + ] + } + ], + "range": [ + 0, + 72 + ] + } + ], + "range": [ + 0, + 73 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 73 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 5, + 21 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 25, + 30 + ] + } + ], + "range": [ + 5, + 30 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 32, + 37 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 39, + 42 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 46, + 57 + ] + } + ], + "range": [ + 46, + 59 + ] + } + ], + "range": [ + 46, + 60 + ] + } + ], + "range": [ + 44, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 81 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 78, + 94 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 99 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 102, + 103 + ] + } + ], + "range": [ + 98, + 103 + ] + } + ], + "range": [ + 78, + 103 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 105, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 110 + ] + } + ], + "range": [ + 105, + 110 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + } + ], + "range": [ + 112, + 115 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 130 + ] + } + ], + "range": [ + 119, + 132 + ] + } + ], + "range": [ + 119, + 133 + ] + } + ], + "range": [ + 117, + 135 + ] + } + ], + "range": [ + 73, + 135 + ] + } + ], + "range": [ + 73, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 73, + 136 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 84 + ] + } + ], + "range": [ + 68, + 84 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 89 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 68, + 93 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 95, + 100 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 102, + 103 + ] + } + ], + "range": [ + 102, + 105 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 109, + 120 + ] + } + ], + "range": [ + 109, + 122 + ] + } + ], + "range": [ + 109, + 123 + ] + } + ], + "range": [ + 107, + 125 + ] + } + ], + "range": [ + 63, + 125 + ] + } + ], + "range": [ + 63, + 126 + ] + } + ], + "hasChanges": false, + "range": [ + 63, + 126 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 141, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 157 + ] + } + ], + "range": [ + 141, + 157 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 162 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 161, + 166 + ] + } + ], + "range": [ + 141, + 166 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 173 + ] + } + ], + "range": [ + 168, + 173 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 175, + 176 + ] + } + ], + "range": [ + 175, + 178 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 182, + 193 + ] + } + ], + "range": [ + 182, + 195 + ] + } + ], + "range": [ + 182, + 196 + ] + } + ], + "range": [ + 180, + 198 + ] + } + ], + "range": [ + 136, + 198 + ] + } + ], + "range": [ + 136, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 199 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 131, + 134 + ] + }, + { + "category": "Identifier", + "range": [ + 138, + 147 + ] + } + ], + "range": [ + 131, + 147 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 151, + 152 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 155, + 156 + ] + } + ], + "range": [ + 151, + 156 + ] + } + ], + "range": [ + 131, + 156 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 158, + 159 + ] + }, + { + "category": "Identifier", + "range": [ + 162, + 163 + ] + } + ], + "range": [ + 158, + 163 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 165, + 168 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 183 + ] + } + ], + "range": [ + 172, + 185 + ] + } + ], + "range": [ + 172, + 186 + ] + } + ], + "range": [ + 170, + 188 + ] + } + ], + "range": [ + 126, + 188 + ] + } + ], + "range": [ + 126, + 189 + ] + } + ], + "hasChanges": false, + "range": [ + 126, + 189 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 199, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 199, + 199 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 189, + 189 + ] + } + ], + "hasChanges": false, + "range": [ + 189, + 189 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-loop-with-in-statement.js", + "for-loop-with-in-statement.js" + ], + "oids": [ + "0147d3180bc89a8f7f7722ebe9ba1ee53fbeeb87", + "306fa88ad3746b62c1be13a704052205e59fa345" + ] + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index 0147d31..306fa88 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + "+for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "63fc9f47c0b135eec17ac28e315a58a052f21fc8..2cd005d0e852939bc0e1af4e0de6d3fba1855845" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 5, + 21 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 25, + 30 + ] + } + ], + "range": [ + 5, + 30 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 32, + 37 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 39, + 42 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 46, + 57 + ] + } + ], + "range": [ + 46, + 59 + ] + } + ], + "range": [ + 46, + 60 + ] + } + ], + "range": [ + 44, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 26 + ] + } + ], + "range": [ + 5, + 26 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 5, + 35 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 37, + 42 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 44, + 47 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 51, + 67 + ] + } + ], + "range": [ + 51, + 69 + ] + } + ], + "range": [ + 51, + 70 + ] + } + ], + "range": [ + 49, + 72 + ] + } + ], + "range": [ + 0, + 72 + ] + } + ], + "range": [ + 0, + 73 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 73 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 84 + ] + } + ], + "range": [ + 68, + 84 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 88, + 89 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 88, + 93 + ] + } + ], + "range": [ + 68, + 93 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 95, + 100 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 102, + 103 + ] + } + ], + "range": [ + 102, + 105 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 109, + 120 + ] + } + ], + "range": [ + 109, + 122 + ] + } + ], + "range": [ + 109, + 123 + ] + } + ], + "range": [ + 107, + 125 + ] + } + ], + "range": [ + 63, + 125 + ] + } + ], + "range": [ + 63, + 126 + ] + } + ], + "hasChanges": false, + "range": [ + 63, + 126 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 81 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 78, + 94 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 99 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 102, + 103 + ] + } + ], + "range": [ + 98, + 103 + ] + } + ], + "range": [ + 78, + 103 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 105, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 110 + ] + } + ], + "range": [ + 105, + 110 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + } + ], + "range": [ + 112, + 115 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 130 + ] + } + ], + "range": [ + 119, + 132 + ] + } + ], + "range": [ + 119, + 133 + ] + } + ], + "range": [ + 117, + 135 + ] + } + ], + "range": [ + 73, + 135 + ] + } + ], + "range": [ + 73, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 73, + 136 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 131, + 134 + ] + }, + { + "category": "Identifier", + "range": [ + 138, + 147 + ] + } + ], + "range": [ + 131, + 147 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 151, + 152 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 155, + 156 + ] + } + ], + "range": [ + 151, + 156 + ] + } + ], + "range": [ + 131, + 156 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 158, + 159 + ] + }, + { + "category": "Identifier", + "range": [ + 162, + 163 + ] + } + ], + "range": [ + 158, + 163 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 165, + 168 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 172, + 183 + ] + } + ], + "range": [ + 172, + 185 + ] + } + ], + "range": [ + 172, + 186 + ] + } + ], + "range": [ + 170, + 188 + ] + } + ], + "range": [ + 126, + 188 + ] + } + ], + "range": [ + 126, + 189 + ] + } + ], + "hasChanges": false, + "range": [ + 126, + 189 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 141, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 157 + ] + } + ], + "range": [ + 141, + 157 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 162 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 161, + 166 + ] + } + ], + "range": [ + 141, + 166 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 173 + ] + } + ], + "range": [ + 168, + 173 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 175, + 176 + ] + } + ], + "range": [ + 175, + 178 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 182, + 193 + ] + } + ], + "range": [ + 182, + 195 + ] + } + ], + "range": [ + 182, + 196 + ] + } + ], + "range": [ + 180, + 198 + ] + } + ], + "range": [ + 136, + 198 + ] + } + ], + "range": [ + 136, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 199 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 189, + 189 + ] + } + ], + "hasChanges": false, + "range": [ + 189, + 189 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 199, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 199, + 199 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-loop-with-in-statement.js", + "for-loop-with-in-statement.js" + ], + "oids": [ + "306fa88ad3746b62c1be13a704052205e59fa345", + "0147d3180bc89a8f7f7722ebe9ba1ee53fbeeb87" + ] + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index 306fa88..0147d31 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,3 +1,3 @@", + "-for (key in something && i = 0; i < n; i++) { doSomething(); }", + "+for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2cd005d0e852939bc0e1af4e0de6d3fba1855845..a0f7c8fd3b681499414c0eb241efb7d677d12d93" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 26 + ] + } + ], + "range": [ + 5, + 26 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 5, + 35 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 37, + 42 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 44, + 47 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 67 + ] + } + ], + "range": [ + 51, + 69 + ] + } + ], + "range": [ + 51, + 70 + ] + } + ], + "range": [ + 49, + 72 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 72 + ] + } + ], + "range": [ + 0, + 73 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 73 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 78, + 81 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 78, + 94 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 99 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 102, + 103 + ] + } + ], + "range": [ + 98, + 103 + ] + } + ], + "range": [ + 78, + 103 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 105, + 106 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 110 + ] + } + ], + "range": [ + 105, + 110 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + } + ], + "range": [ + 112, + 115 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 130 + ] + } + ], + "range": [ + 119, + 132 + ] + } + ], + "range": [ + 119, + 133 + ] + } + ], + "range": [ + 117, + 135 + ] + } + ], + "patch": "delete", + "range": [ + 73, + 135 + ] + } + ], + "range": [ + 73, + 136 + ] + } + ], + "hasChanges": true, + "range": [ + 73, + 136 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 141, + 144 + ] + }, + { + "category": "Identifier", + "range": [ + 148, + 157 + ] + } + ], + "range": [ + 141, + 157 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 162 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 165, + 166 + ] + } + ], + "range": [ + 161, + 166 + ] + } + ], + "range": [ + 141, + 166 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 173 + ] + } + ], + "range": [ + 168, + 173 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 175, + 176 + ] + } + ], + "range": [ + 175, + 178 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 182, + 193 + ] + } + ], + "range": [ + 182, + 195 + ] + } + ], + "range": [ + 182, + 196 + ] + } + ], + "range": [ + 180, + 198 + ] + } + ], + "range": [ + 136, + 198 + ] + } + ], + "range": [ + 136, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 199 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 5, + 21 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 25, + 30 + ] + } + ], + "range": [ + 5, + 30 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 32, + 37 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 39, + 42 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 57 + ] + } + ], + "range": [ + 46, + 59 + ] + } + ], + "range": [ + 46, + 60 + ] + } + ], + "range": [ + 44, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 76 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 89 + ] + } + ], + "range": [ + 68, + 89 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 93, + 94 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 97, + 98 + ] + } + ], + "range": [ + 93, + 98 + ] + } + ], + "range": [ + 68, + 98 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "Identifier", + "range": [ + 104, + 105 + ] + } + ], + "range": [ + 100, + 105 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 108 + ] + } + ], + "range": [ + 107, + 110 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 130 + ] + } + ], + "range": [ + 114, + 132 + ] + } + ], + "range": [ + 114, + 133 + ] + } + ], + "range": [ + 112, + 135 + ] + } + ], + "patch": "insert", + "range": [ + 63, + 135 + ] + } + ], + "range": [ + 63, + 136 + ] + } + ], + "hasChanges": true, + "range": [ + 63, + 136 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 199, + 199 + ] + } + ], + "hasChanges": false, + "range": [ + 199, + 199 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 136, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 136 + ], + "number": 3 + } + ] + ], + "paths": [ + "for-loop-with-in-statement.js", + "for-loop-with-in-statement.js" + ], + "oids": [ + "0147d3180bc89a8f7f7722ebe9ba1ee53fbeeb87", + "f23fa3166fa271818ae890675d03b9089c15fc17" + ] + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index 0147d31..f23fa31 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,3 +1,2 @@", + "-for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }", + "-for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (key in something && i = 0; i < n; i++) { doSomething(); }", + "+for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a0f7c8fd3b681499414c0eb241efb7d677d12d93..6b7a2fd51ee8f4d50b6694c613e614f365ae5043" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 21 + ] + } + ], + "range": [ + 5, + 21 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 25, + 30 + ] + } + ], + "range": [ + 5, + 30 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + } + ], + "range": [ + 32, + 37 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 39, + 42 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 57 + ] + } + ], + "range": [ + 46, + 59 + ] + } + ], + "range": [ + 46, + 60 + ] + } + ], + "range": [ + 44, + 62 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 76 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 89 + ] + } + ], + "range": [ + 68, + 89 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 93, + 94 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 97, + 98 + ] + } + ], + "range": [ + 93, + 98 + ] + } + ], + "range": [ + 68, + 98 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "Identifier", + "range": [ + 104, + 105 + ] + } + ], + "range": [ + 100, + 105 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 108 + ] + } + ], + "range": [ + 107, + 110 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 130 + ] + } + ], + "range": [ + 114, + 132 + ] + } + ], + "range": [ + 114, + 133 + ] + } + ], + "range": [ + 112, + 135 + ] + } + ], + "range": [ + 63, + 135 + ] + } + ], + "range": [ + 63, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 63, + 136 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 26 + ] + } + ], + "range": [ + 5, + 26 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 5, + 35 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 37, + 42 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 44, + 47 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 67 + ] + } + ], + "range": [ + 51, + 69 + ] + } + ], + "range": [ + 51, + 70 + ] + } + ], + "range": [ + 49, + 72 + ] + } + ], + "range": [ + 0, + 72 + ] + } + ], + "range": [ + 0, + 73 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 73 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 136, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 136 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 73, + 73 + ] + } + ], + "hasChanges": false, + "range": [ + 73, + 73 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-loop-with-in-statement.js", + "for-loop-with-in-statement.js" + ], + "oids": [ + "f23fa3166fa271818ae890675d03b9089c15fc17", + "e968160740d6cbcaed6e64dc2052d267099690fb" + ] + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index f23fa31..e968160 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1,2 +1 @@", + "-for (key in something && i = 0; i < n; i++) { doSomething(); }", + " for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6b7a2fd51ee8f4d50b6694c613e614f365ae5043..1ae61c25b593a57731d6b465c56186922d43a9be" +} +,{ + "testCaseDescription": "javascript-for-loop-with-in-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "BooleanOperator", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 26 + ] + } + ], + "range": [ + 5, + 26 + ] + }, + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 35 + ] + } + ], + "range": [ + 5, + 35 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 37, + 42 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 44, + 47 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 67 + ] + } + ], + "range": [ + 51, + 69 + ] + } + ], + "range": [ + 51, + 70 + ] + } + ], + "range": [ + 49, + 72 + ] + } + ], + "range": [ + 0, + 72 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 73 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 73 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 73, + 73 + ] + } + ], + "hasChanges": true, + "range": [ + 73, + 73 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-loop-with-in-statement.js", + "for-loop-with-in-statement.js" + ], + "oids": [ + "e968160740d6cbcaed6e64dc2052d267099690fb", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "for-loop-with-in-statement.js" + ], + "patch": [ + "diff --git a/for-loop-with-in-statement.js b/for-loop-with-in-statement.js", + "index e968160..e69de29 100644", + "--- a/for-loop-with-in-statement.js", + "+++ b/for-loop-with-in-statement.js", + "@@ -1 +0,0 @@", + "-for (otherKey in something && i = 0; i < n; i++) { doOtherSomething(); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1ae61c25b593a57731d6b465c56186922d43a9be..d86b209de9dedc4b2f245fbfc5ea1497b4f94189" +}] diff --git a/test/corpus/json/javascript/for-of-statement.json b/test/corpus/json/javascript/for-of-statement.json new file mode 100644 index 000000000..e28c116e8 --- /dev/null +++ b/test/corpus/json/javascript/for-of-statement.json @@ -0,0 +1,2652 @@ +[{ + "testCaseDescription": "javascript-for-of-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 22 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 26, + 40 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 44 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 44 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 44, + 44 + ] + } + ], + "hasChanges": true, + "range": [ + 44, + 44 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-of-statement.js", + "for-of-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "1ed27542482af4551036f276b4644b7b72beea4e" + ] + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index e69de29..1ed2754 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -0,0 +1 @@", + "+for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d86b209de9dedc4b2f245fbfc5ea1497b4f94189..692134aa403abb6b6144648a7fdae4867d7a6f24" +} +,{ + "testCaseDescription": "javascript-for-of-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "range": [ + 28, + 43 + ] + } + ], + "range": [ + 26, + 45 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 47 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + } + ], + "range": [ + 73, + 86 + ] + } + ], + "range": [ + 73, + 87 + ] + } + ], + "range": [ + 71, + 89 + ] + } + ], + "patch": "insert", + "range": [ + 47, + 89 + ] + } + ], + "range": [ + 47, + 91 + ] + } + ], + "hasChanges": true, + "range": [ + 47, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 22 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 26, + 40 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 44 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 117, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 117, + 130 + ] + } + ], + "range": [ + 117, + 131 + ] + } + ], + "range": [ + 115, + 133 + ] + } + ], + "range": [ + 91, + 133 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 135 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 44, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 44 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 135, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 135, + 135 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-of-statement.js", + "for-of-statement.js" + ], + "oids": [ + "1ed27542482af4551036f276b4644b7b72beea4e", + "ab20ded2247c4bd145588cd68edd6e54cffb2013" + ] + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 1ed2754..ab20ded 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1 +1,3 @@", + "+for (let thing of things) { process(thing); };", + "+for (let item of items) { process(item); };", + " for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "692134aa403abb6b6144648a7fdae4867d7a6f24..59fdc2a48434656b3b264103f12ec958666dd913" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 14 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 18, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 35 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "range": [ + 28, + 43 + ] + } + ], + "range": [ + 26, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 47 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 17, + 22 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 33 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 26, + 40 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 44 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + } + ], + "range": [ + 73, + 86 + ] + } + ], + "range": [ + 73, + 87 + ] + } + ], + "range": [ + 71, + 89 + ] + } + ], + "range": [ + 47, + 89 + ] + } + ], + "range": [ + 47, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 47, + 91 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 78, + 82 + ] + } + ], + "range": [ + 70, + 83 + ] + } + ], + "range": [ + 70, + 84 + ] + } + ], + "range": [ + 68, + 86 + ] + } + ], + "range": [ + 44, + 86 + ] + } + ], + "range": [ + 44, + 88 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 88 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 117, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 117, + 130 + ] + } + ], + "range": [ + 117, + 131 + ] + } + ], + "range": [ + 115, + 133 + ] + } + ], + "range": [ + 91, + 133 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 135 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 97, + 101 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 110 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 121 + ] + }, + { + "category": "Identifier", + "range": [ + 122, + 126 + ] + } + ], + "range": [ + 114, + 127 + ] + } + ], + "range": [ + 114, + 128 + ] + } + ], + "range": [ + 112, + 130 + ] + } + ], + "range": [ + 88, + 130 + ] + } + ], + "range": [ + 88, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 88, + 132 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 135, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 135, + 135 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-of-statement.js", + "for-of-statement.js" + ], + "oids": [ + "ab20ded2247c4bd145588cd68edd6e54cffb2013", + "19561a3e5504134247b0b31a3d5cf95fb6ec3d2f" + ] + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index ab20ded..19561a3 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,3 +1,3 @@", + "-for (let thing of things) { process(thing); };", + "+for (let item of items) { process(item); };", + " for (let item of items) { process(item); };", + " for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "59fdc2a48434656b3b264103f12ec958666dd913..34c9a61a59c6337de1d9f3dd811b6d2d7fb227e4" +} +,{ + "testCaseDescription": "javascript-for-of-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 17, + 22 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 33 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 26, + 40 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 44 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 14 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 18, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 35 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "range": [ + 28, + 43 + ] + } + ], + "range": [ + 26, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 47 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "Identifier", + "range": [ + 61, + 66 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 78, + 82 + ] + } + ], + "range": [ + 70, + 83 + ] + } + ], + "range": [ + 70, + 84 + ] + } + ], + "range": [ + 68, + 86 + ] + } + ], + "range": [ + 44, + 86 + ] + } + ], + "range": [ + 44, + 88 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 88 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + } + ], + "range": [ + 73, + 86 + ] + } + ], + "range": [ + 73, + 87 + ] + } + ], + "range": [ + 71, + 89 + ] + } + ], + "range": [ + 47, + 89 + ] + } + ], + "range": [ + 47, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 47, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 97, + 101 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 110 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 121 + ] + }, + { + "category": "Identifier", + "range": [ + 122, + 126 + ] + } + ], + "range": [ + 114, + 127 + ] + } + ], + "range": [ + 114, + 128 + ] + } + ], + "range": [ + 112, + 130 + ] + } + ], + "range": [ + 88, + 130 + ] + } + ], + "range": [ + 88, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 88, + 132 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 117, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 117, + 130 + ] + } + ], + "range": [ + 117, + 131 + ] + } + ], + "range": [ + 115, + 133 + ] + } + ], + "range": [ + 91, + 133 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 135 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 135, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 135, + 135 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-of-statement.js", + "for-of-statement.js" + ], + "oids": [ + "19561a3e5504134247b0b31a3d5cf95fb6ec3d2f", + "ab20ded2247c4bd145588cd68edd6e54cffb2013" + ] + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 19561a3..ab20ded 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,3 +1,3 @@", + "-for (let item of items) { process(item); };", + "+for (let thing of things) { process(thing); };", + " for (let item of items) { process(item); };", + " for (let item of items) { process(item); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "34c9a61a59c6337de1d9f3dd811b6d2d7fb227e4..38d929287ed0d1fba0a0472cb2867bc8a36ed9f3" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "range": [ + 28, + 43 + ] + } + ], + "range": [ + 26, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 47 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 81, + 85 + ] + } + ], + "range": [ + 73, + 86 + ] + } + ], + "range": [ + 73, + 87 + ] + } + ], + "range": [ + 71, + 89 + ] + } + ], + "patch": "delete", + "range": [ + 47, + 89 + ] + } + ], + "range": [ + 47, + 91 + ] + } + ], + "hasChanges": true, + "range": [ + 47, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 108, + 113 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 117, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 125, + 129 + ] + } + ], + "range": [ + 117, + 130 + ] + } + ], + "range": [ + 117, + 131 + ] + } + ], + "range": [ + 115, + 133 + ] + } + ], + "range": [ + 91, + 133 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 135 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 22 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 26, + 40 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 44 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 62, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 72, + 79 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 85 + ] + } + ], + "range": [ + 72, + 86 + ] + } + ], + "range": [ + 72, + 87 + ] + } + ], + "range": [ + 70, + 89 + ] + } + ], + "patch": "insert", + "range": [ + 44, + 89 + ] + } + ], + "range": [ + 44, + 91 + ] + } + ], + "hasChanges": true, + "range": [ + 44, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 135, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 135, + 135 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 91, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 91 + ], + "number": 3 + } + ] + ], + "paths": [ + "for-of-statement.js", + "for-of-statement.js" + ], + "oids": [ + "ab20ded2247c4bd145588cd68edd6e54cffb2013", + "62db34f82c7cb3465c1b7526c2213607eb848b9b" + ] + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index ab20ded..62db34f 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,3 +1,2 @@", + "-for (let thing of things) { process(thing); };", + "-for (let item of items) { process(item); };", + " for (let item of items) { process(item); };", + "+for (let thing of things) { process(thing); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "38d929287ed0d1fba0a0472cb2867bc8a36ed9f3..7be620405c8ed9315f8d781a4e0f70af4ddf7661" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 22 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 26, + 40 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 44 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 62, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 72, + 79 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 85 + ] + } + ], + "range": [ + 72, + 86 + ] + } + ], + "range": [ + 72, + 87 + ] + } + ], + "range": [ + 70, + 89 + ] + } + ], + "range": [ + 44, + 89 + ] + } + ], + "range": [ + 44, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 91 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "range": [ + 28, + 43 + ] + } + ], + "range": [ + 26, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 47 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 91, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 91 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 47, + 47 + ] + } + ], + "hasChanges": false, + "range": [ + 47, + 47 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-of-statement.js", + "for-of-statement.js" + ], + "oids": [ + "62db34f82c7cb3465c1b7526c2213607eb848b9b", + "5170ce4ba5327700b8e57faa7b8b229b03609eac" + ] + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 62db34f..5170ce4 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1,2 +1 @@", + "-for (let item of items) { process(item); };", + " for (let thing of things) { process(thing); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7be620405c8ed9315f8d781a4e0f70af4ddf7661..0b04e915606b848351ed5a2a6d7cbd1b17dd624d" +} +,{ + "testCaseDescription": "javascript-for-of-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "range": [ + 28, + 43 + ] + } + ], + "range": [ + 26, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 47 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 47 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 47, + 47 + ] + } + ], + "hasChanges": true, + "range": [ + 47, + 47 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-of-statement.js", + "for-of-statement.js" + ], + "oids": [ + "5170ce4ba5327700b8e57faa7b8b229b03609eac", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "for-of-statement.js" + ], + "patch": [ + "diff --git a/for-of-statement.js b/for-of-statement.js", + "index 5170ce4..e69de29 100644", + "--- a/for-of-statement.js", + "+++ b/for-of-statement.js", + "@@ -1 +0,0 @@", + "-for (let thing of things) { process(thing); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0b04e915606b848351ed5a2a6d7cbd1b17dd624d..02fd2e5dc8f8de3c7dfdb7fc35ffa79ecc5a9711" +}] diff --git a/test/corpus/json/javascript/for-statement.json b/test/corpus/json/javascript/for-statement.json new file mode 100644 index 000000000..41870c942 --- /dev/null +++ b/test/corpus/json/javascript/for-statement.json @@ -0,0 +1,4308 @@ +[{ + "testCaseDescription": "javascript-for-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 20, + 26 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 28, + 31 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 35, + 42 + ] + } + ], + "range": [ + 33, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 45 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 45 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 45, + 45 + ] + } + ], + "hasChanges": true, + "range": [ + 45, + 45 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-statement.js", + "for-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "2f51258ee05f7e8b9c3daa021cdedf2ff7a29c58" + ] + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index e69de29..2f51258 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -0,0 +1 @@", + "+for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6ca5e77d4063360bcd0a90d891c3e81e09835b84..67d8ed44c8d2d20d1e580881d6c0700961468d34" +} +,{ + "testCaseDescription": "javascript-for-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 27 + ] + } + ], + "range": [ + 20, + 27 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 29, + 32 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + } + ], + "range": [ + 36, + 42 + ] + } + ], + "range": [ + 36, + 43 + ] + } + ], + "range": [ + 34, + 45 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 55, + 56 + ] + } + ], + "range": [ + 51, + 56 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 62 + ] + } + ], + "range": [ + 58, + 64 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 66, + 72 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 77 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 84 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 86 + ] + } + ], + "range": [ + 81, + 87 + ] + } + ], + "range": [ + 81, + 88 + ] + } + ], + "range": [ + 79, + 90 + ] + } + ], + "patch": "insert", + "range": [ + 46, + 90 + ] + } + ], + "range": [ + 46, + 91 + ] + } + ], + "hasChanges": true, + "range": [ + 46, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 20, + 26 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 28, + 31 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 35, + 42 + ] + } + ], + "range": [ + 33, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 45 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 100, + 101 + ] + } + ], + "range": [ + 96, + 101 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 103, + 107 + ] + } + ], + "range": [ + 103, + 109 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 115, + 117 + ] + } + ], + "range": [ + 111, + 117 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 122 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 126, + 132 + ] + } + ], + "range": [ + 126, + 133 + ] + } + ], + "range": [ + 124, + 135 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "range": [ + 91, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 136 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 45, + 45 + ] + } + ], + "hasChanges": false, + "range": [ + 45, + 45 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 136, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 136 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-statement.js", + "for-statement.js" + ], + "oids": [ + "2f51258ee05f7e8b9c3daa021cdedf2ff7a29c58", + "095241f1377bd981220d93eacab9975e9efd42ee" + ] + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 2f51258..095241f 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1 +1,3 @@", + "+for (i = 0, init(); i < 100; i++) { log(i); }", + "+for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "67d8ed44c8d2d20d1e580881d6c0700961468d34..b2b93708ee067b6893c94f3728896489a9ac3c4a" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 24, + 27 + ] + } + ], + "range": [ + 20, + 27 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 29, + 32 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + } + ], + "range": [ + 36, + 42 + ] + } + ], + "range": [ + 36, + 43 + ] + } + ], + "range": [ + 34, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 20, + 26 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 28, + 31 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 35, + 42 + ] + } + ], + "range": [ + 33, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 45 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 55, + 56 + ] + } + ], + "range": [ + 51, + 56 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 62 + ] + } + ], + "range": [ + 58, + 64 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 66, + 72 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 77 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 84 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 86 + ] + } + ], + "range": [ + 81, + 87 + ] + } + ], + "range": [ + 81, + 88 + ] + } + ], + "range": [ + 79, + 90 + ] + } + ], + "range": [ + 46, + 90 + ] + } + ], + "range": [ + 46, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 46, + 91 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 69, + 71 + ] + } + ], + "range": [ + 65, + 71 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + } + ], + "range": [ + 73, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 85 + ] + } + ], + "range": [ + 80, + 86 + ] + } + ], + "range": [ + 80, + 87 + ] + } + ], + "range": [ + 78, + 89 + ] + } + ], + "range": [ + 45, + 89 + ] + } + ], + "range": [ + 45, + 90 + ] + } + ], + "hasChanges": false, + "range": [ + 45, + 90 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 100, + 101 + ] + } + ], + "range": [ + 96, + 101 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 103, + 107 + ] + } + ], + "range": [ + 103, + 109 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 115, + 117 + ] + } + ], + "range": [ + 111, + 117 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 122 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 126, + 132 + ] + } + ], + "range": [ + 126, + 133 + ] + } + ], + "range": [ + 124, + 135 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "range": [ + 91, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 136 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 96 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 95, + 100 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 102, + 106 + ] + } + ], + "range": [ + 102, + 108 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 110, + 111 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 110, + 116 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 119 + ] + } + ], + "range": [ + 118, + 121 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 125, + 128 + ] + }, + { + "category": "Identifier", + "range": [ + 129, + 130 + ] + } + ], + "range": [ + 125, + 131 + ] + } + ], + "range": [ + 125, + 132 + ] + } + ], + "range": [ + 123, + 134 + ] + } + ], + "range": [ + 90, + 134 + ] + } + ], + "range": [ + 90, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 135 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 136, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 136 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 135, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 135, + 135 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-statement.js", + "for-statement.js" + ], + "oids": [ + "095241f1377bd981220d93eacab9975e9efd42ee", + "9b0e26d472ddac99038ae86981d46a37f76db7eb" + ] + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 095241f..9b0e26d 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,3 +1,3 @@", + "-for (i = 0, init(); i < 100; i++) { log(i); }", + "+for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b2b93708ee067b6893c94f3728896489a9ac3c4a..f4c615d37eccfcad119e8743f398fe72f12e2119" +} +,{ + "testCaseDescription": "javascript-for-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 20, + 26 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 28, + 31 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 35, + 42 + ] + } + ], + "range": [ + 33, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 45 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 24, + 27 + ] + } + ], + "range": [ + 20, + 27 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 29, + 32 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + } + ], + "range": [ + 36, + 42 + ] + } + ], + "range": [ + 36, + 43 + ] + } + ], + "range": [ + 34, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 69, + 71 + ] + } + ], + "range": [ + 65, + 71 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 74 + ] + } + ], + "range": [ + 73, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 85 + ] + } + ], + "range": [ + 80, + 86 + ] + } + ], + "range": [ + 80, + 87 + ] + } + ], + "range": [ + 78, + 89 + ] + } + ], + "range": [ + 45, + 89 + ] + } + ], + "range": [ + 45, + 90 + ] + } + ], + "hasChanges": false, + "range": [ + 45, + 90 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 55, + 56 + ] + } + ], + "range": [ + 51, + 56 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 62 + ] + } + ], + "range": [ + 58, + 64 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 66, + 72 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 77 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 84 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 86 + ] + } + ], + "range": [ + 81, + 87 + ] + } + ], + "range": [ + 81, + 88 + ] + } + ], + "range": [ + 79, + 90 + ] + } + ], + "range": [ + 46, + 90 + ] + } + ], + "range": [ + 46, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 46, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 96 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 95, + 100 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 102, + 106 + ] + } + ], + "range": [ + 102, + 108 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 110, + 111 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 110, + 116 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 119 + ] + } + ], + "range": [ + 118, + 121 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 125, + 128 + ] + }, + { + "category": "Identifier", + "range": [ + 129, + 130 + ] + } + ], + "range": [ + 125, + 131 + ] + } + ], + "range": [ + 125, + 132 + ] + } + ], + "range": [ + 123, + 134 + ] + } + ], + "range": [ + 90, + 134 + ] + } + ], + "range": [ + 90, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 90, + 135 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 100, + 101 + ] + } + ], + "range": [ + 96, + 101 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 103, + 107 + ] + } + ], + "range": [ + 103, + 109 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 115, + 117 + ] + } + ], + "range": [ + 111, + 117 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 122 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 126, + 132 + ] + } + ], + "range": [ + 126, + 133 + ] + } + ], + "range": [ + 124, + 135 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "range": [ + 91, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 136 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 135, + 135 + ] + } + ], + "hasChanges": false, + "range": [ + 135, + 135 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 136, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 136 + ], + "number": 4 + } + ] + ], + "paths": [ + "for-statement.js", + "for-statement.js" + ], + "oids": [ + "9b0e26d472ddac99038ae86981d46a37f76db7eb", + "095241f1377bd981220d93eacab9975e9efd42ee" + ] + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 9b0e26d..095241f 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,3 +1,3 @@", + "-for (i = 0, init(); i < 10; i++) { log(i); }", + "+for (i = 0, init(); i < 100; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f4c615d37eccfcad119e8743f398fe72f12e2119..e7c088c711503cc6f52aa3307363dd069ef73101" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 27 + ] + } + ], + "range": [ + 20, + 27 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 29, + 32 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + } + ], + "range": [ + 36, + 42 + ] + } + ], + "range": [ + 36, + 43 + ] + } + ], + "range": [ + 34, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 55, + 56 + ] + } + ], + "range": [ + 51, + 56 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 62 + ] + } + ], + "range": [ + 58, + 64 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 66, + 72 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 77 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 84 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 86 + ] + } + ], + "range": [ + 81, + 87 + ] + } + ], + "range": [ + 81, + 88 + ] + } + ], + "range": [ + 79, + 90 + ] + } + ], + "patch": "delete", + "range": [ + 46, + 90 + ] + } + ], + "range": [ + 46, + 91 + ] + } + ], + "hasChanges": true, + "range": [ + 46, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 100, + 101 + ] + } + ], + "range": [ + 96, + 101 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 103, + 107 + ] + } + ], + "range": [ + 103, + 109 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 115, + 117 + ] + } + ], + "range": [ + 111, + 117 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 122 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 126, + 129 + ] + }, + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 126, + 132 + ] + } + ], + "range": [ + 126, + 133 + ] + } + ], + "range": [ + 124, + 135 + ] + } + ], + "range": [ + 91, + 135 + ] + } + ], + "range": [ + 91, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 136 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 20, + 26 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 28, + 31 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 35, + 42 + ] + } + ], + "range": [ + 33, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 45 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 69, + 72 + ] + } + ], + "range": [ + 65, + 72 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 77 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 84 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 86 + ] + } + ], + "range": [ + 81, + 87 + ] + } + ], + "range": [ + 81, + 88 + ] + } + ], + "range": [ + 79, + 90 + ] + } + ], + "patch": "insert", + "range": [ + 45, + 90 + ] + } + ], + "range": [ + 45, + 91 + ] + } + ], + "hasChanges": true, + "range": [ + 45, + 91 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 136, + 136 + ] + } + ], + "hasChanges": false, + "range": [ + 136, + 136 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 91, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 91 + ], + "number": 3 + } + ] + ], + "paths": [ + "for-statement.js", + "for-statement.js" + ], + "oids": [ + "095241f1377bd981220d93eacab9975e9efd42ee", + "39af699a6f85d38d3e18d61ec278a943a01701fa" + ] + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 095241f..39af699 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,3 +1,2 @@", + "-for (i = 0, init(); i < 100; i++) { log(i); }", + "-for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 10; i++) { log(i); }", + "+for (i = 0, init(); i < 100; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e7c088c711503cc6f52aa3307363dd069ef73101..030f6e47ed5f03b21e98c128d8bb398225366bfb" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 20, + 26 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 28, + 31 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + } + ], + "range": [ + 35, + 41 + ] + } + ], + "range": [ + 35, + 42 + ] + } + ], + "range": [ + 33, + 44 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 45 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 57, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 69, + 72 + ] + } + ], + "range": [ + 65, + 72 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 77 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 84 + ] + }, + { + "category": "Identifier", + "range": [ + 85, + 86 + ] + } + ], + "range": [ + 81, + 87 + ] + } + ], + "range": [ + 81, + 88 + ] + } + ], + "range": [ + 79, + 90 + ] + } + ], + "range": [ + 45, + 90 + ] + } + ], + "range": [ + 45, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 45, + 91 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 27 + ] + } + ], + "range": [ + 20, + 27 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 29, + 32 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + } + ], + "range": [ + 36, + 42 + ] + } + ], + "range": [ + 36, + 43 + ] + } + ], + "range": [ + 34, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 91, + 91 + ] + } + ], + "hasChanges": false, + "range": [ + 91, + 91 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 46, + 46 + ] + } + ], + "hasChanges": false, + "range": [ + 46, + 46 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-statement.js", + "for-statement.js" + ], + "oids": [ + "39af699a6f85d38d3e18d61ec278a943a01701fa", + "de8ae87b20aeb3e55c4cf6fd9f1fe5249118a0db" + ] + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index 39af699..de8ae87 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1,2 +1 @@", + "-for (i = 0, init(); i < 10; i++) { log(i); }", + " for (i = 0, init(); i < 100; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "030f6e47ed5f03b21e98c128d8bb398225366bfb..79269d7c37a4237b15a1cb4aa014c4f54e72faaf" +} +,{ + "testCaseDescription": "javascript-for-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "For", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 5, + 10 + ] + }, + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 27 + ] + } + ], + "range": [ + 20, + 27 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 29, + 32 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + } + ], + "range": [ + 36, + 42 + ] + } + ], + "range": [ + 36, + 43 + ] + } + ], + "range": [ + 34, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 46, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 46, + 46 + ], + "number": 2 + } + ] + ], + "paths": [ + "for-statement.js", + "for-statement.js" + ], + "oids": [ + "de8ae87b20aeb3e55c4cf6fd9f1fe5249118a0db", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "for-statement.js" + ], + "patch": [ + "diff --git a/for-statement.js b/for-statement.js", + "index de8ae87..e69de29 100644", + "--- a/for-statement.js", + "+++ b/for-statement.js", + "@@ -1 +0,0 @@", + "-for (i = 0, init(); i < 100; i++) { log(i); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "79269d7c37a4237b15a1cb4aa014c4f54e72faaf..aa5f6a7c2031a5c8823a005dffbe948bd997e140" +}] diff --git a/test/corpus/json/javascript/function-call-args.json b/test/corpus/json/javascript/function-call-args.json new file mode 100644 index 000000000..54a786a8e --- /dev/null +++ b/test/corpus/json/javascript/function-call-args.json @@ -0,0 +1,4458 @@ +[{ + "testCaseDescription": "javascript-function-call-args-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 24 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 49 + ] + }, + { + "category": "Identifier", + "range": [ + 50, + 53 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 42, + 56 + ] + } + ], + "range": [ + 42, + 57 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + } + ], + "range": [ + 58, + 67 + ] + } + ], + "range": [ + 40, + 69 + ] + } + ], + "range": [ + 26, + 69 + ] + }, + { + "category": "Boolean", + "range": [ + 71, + 75 + ] + } + ], + "range": [ + 0, + 76 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 77 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 77, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 77, + 77 + ], + "number": 2 + } + ] + ], + "paths": [ + "function-call-args.js", + "function-call-args.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "699333de7b70cb953d61254bd14413214022e0d7" + ] + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index e69de29..699333d 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -0,0 +1 @@", + "+someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fc795a83fff7fcdcadac0ce15ce74b4c24bfcbd5..f0d27ee6b9aad8945ee36251c43edd314201c669" +} +,{ + "testCaseDescription": "javascript-function-call-args-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 29 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + }, + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 47, + 61 + ] + } + ], + "range": [ + 47, + 62 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 63, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + } + ], + "range": [ + 31, + 74 + ] + }, + { + "category": "Boolean", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 0, + 82 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 83 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 83 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 83, + 95 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 96, + 97 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 125, + 132 + ] + }, + { + "category": "Identifier", + "range": [ + 133, + 136 + ] + }, + { + "category": "Identifier", + "range": [ + 137, + 138 + ] + } + ], + "range": [ + 125, + 139 + ] + } + ], + "range": [ + 125, + 140 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 148, + 149 + ] + } + ], + "range": [ + 141, + 150 + ] + } + ], + "range": [ + 123, + 152 + ] + } + ], + "range": [ + 109, + 152 + ] + }, + { + "category": "Boolean", + "range": [ + 154, + 158 + ] + } + ], + "range": [ + 83, + 159 + ] + } + ], + "patch": "insert", + "range": [ + 83, + 160 + ] + } + ], + "range": [ + 83, + 160 + ] + } + ], + "hasChanges": true, + "range": [ + 83, + 160 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 24 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 49 + ] + }, + { + "category": "Identifier", + "range": [ + 50, + 53 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 42, + 56 + ] + } + ], + "range": [ + 42, + 57 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + } + ], + "range": [ + 58, + 67 + ] + } + ], + "range": [ + 40, + 69 + ] + } + ], + "range": [ + 26, + 69 + ] + }, + { + "category": "Boolean", + "range": [ + 71, + 75 + ] + } + ], + "range": [ + 0, + 76 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 77 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 172 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 173, + 174 + ] + }, + { + "category": "StringLiteral", + "range": [ + 176, + 184 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Identifier", + "range": [ + 197, + 198 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 202, + 209 + ] + }, + { + "category": "Identifier", + "range": [ + 210, + 213 + ] + }, + { + "category": "Identifier", + "range": [ + 214, + 215 + ] + } + ], + "range": [ + 202, + 216 + ] + } + ], + "range": [ + 202, + 217 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 225, + 226 + ] + } + ], + "range": [ + 218, + 227 + ] + } + ], + "range": [ + 200, + 229 + ] + } + ], + "range": [ + 186, + 229 + ] + }, + { + "category": "Boolean", + "range": [ + 231, + 235 + ] + } + ], + "range": [ + 160, + 236 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 160, + 237 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 77, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 77 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 237, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 237, + 237 + ], + "number": 4 + } + ] + ], + "paths": [ + "function-call-args.js", + "function-call-args.js" + ], + "oids": [ + "699333de7b70cb953d61254bd14413214022e0d7", + "3f4ee6eff96262b663d39cbd5835360a1f494473" + ] + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 699333d..3f4ee6e 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1 +1,3 @@", + "+someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + "+someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f0d27ee6b9aad8945ee36251c43edd314201c669..d523d6414978750538a5f0db9a039430426a16bd" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 29 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 40, + 41 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 47, + 61 + ] + } + ], + "range": [ + 47, + 62 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 63, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + } + ], + "range": [ + 31, + 74 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 0, + 82 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 83 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 24 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 35, + 36 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 37, + 38 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 49 + ] + }, + { + "category": "Identifier", + "range": [ + 50, + 53 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 42, + 56 + ] + } + ], + "range": [ + 42, + 57 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 65, + 66 + ] + } + ], + "range": [ + 58, + 67 + ] + } + ], + "range": [ + 40, + 69 + ] + } + ], + "range": [ + 26, + 69 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 71, + 75 + ] + } + ], + "range": [ + 0, + 76 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 77 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 83, + 95 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 96, + 97 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 125, + 132 + ] + }, + { + "category": "Identifier", + "range": [ + 133, + 136 + ] + }, + { + "category": "Identifier", + "range": [ + 137, + 138 + ] + } + ], + "range": [ + 125, + 139 + ] + } + ], + "range": [ + 125, + 140 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 148, + 149 + ] + } + ], + "range": [ + 141, + 150 + ] + } + ], + "range": [ + 123, + 152 + ] + } + ], + "range": [ + 109, + 152 + ] + }, + { + "category": "Boolean", + "range": [ + 154, + 158 + ] + } + ], + "range": [ + 83, + 159 + ] + } + ], + "range": [ + 83, + 160 + ] + } + ], + "range": [ + 83, + 160 + ] + } + ], + "hasChanges": false, + "range": [ + 83, + 160 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 89 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 90, + 91 + ] + }, + { + "category": "StringLiteral", + "range": [ + 93, + 101 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 126 + ] + }, + { + "category": "Identifier", + "range": [ + 127, + 130 + ] + }, + { + "category": "Identifier", + "range": [ + 131, + 132 + ] + } + ], + "range": [ + 119, + 133 + ] + } + ], + "range": [ + 119, + 134 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 142, + 143 + ] + } + ], + "range": [ + 135, + 144 + ] + } + ], + "range": [ + 117, + 146 + ] + } + ], + "range": [ + 103, + 146 + ] + }, + { + "category": "Boolean", + "range": [ + 148, + 152 + ] + } + ], + "range": [ + 77, + 153 + ] + } + ], + "range": [ + 77, + 154 + ] + } + ], + "range": [ + 77, + 154 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 154 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 172 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 173, + 174 + ] + }, + { + "category": "StringLiteral", + "range": [ + 176, + 184 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Identifier", + "range": [ + 197, + 198 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 202, + 209 + ] + }, + { + "category": "Identifier", + "range": [ + 210, + 213 + ] + }, + { + "category": "Identifier", + "range": [ + 214, + 215 + ] + } + ], + "range": [ + 202, + 216 + ] + } + ], + "range": [ + 202, + 217 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 225, + 226 + ] + } + ], + "range": [ + 218, + 227 + ] + } + ], + "range": [ + 200, + 229 + ] + } + ], + "range": [ + 186, + 229 + ] + }, + { + "category": "Boolean", + "range": [ + 231, + 235 + ] + } + ], + "range": [ + 160, + 236 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 160, + 237 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 154, + 166 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 167, + 168 + ] + }, + { + "category": "StringLiteral", + "range": [ + 170, + 178 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 189, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 192 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 196, + 203 + ] + }, + { + "category": "Identifier", + "range": [ + 204, + 207 + ] + }, + { + "category": "Identifier", + "range": [ + 208, + 209 + ] + } + ], + "range": [ + 196, + 210 + ] + } + ], + "range": [ + 196, + 211 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 219, + 220 + ] + } + ], + "range": [ + 212, + 221 + ] + } + ], + "range": [ + 194, + 223 + ] + } + ], + "range": [ + 180, + 223 + ] + }, + { + "category": "Boolean", + "range": [ + 225, + 229 + ] + } + ], + "range": [ + 154, + 230 + ] + } + ], + "range": [ + 154, + 231 + ] + } + ], + "range": [ + 154, + 231 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 231 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 237, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 237, + 237 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 231, + 231 + ] + } + ], + "hasChanges": false, + "range": [ + 231, + 231 + ], + "number": 4 + } + ] + ], + "paths": [ + "function-call-args.js", + "function-call-args.js" + ], + "oids": [ + "3f4ee6eff96262b663d39cbd5835360a1f494473", + "dc419cba5721af66b901680ae5608317dc162c81" + ] + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 3f4ee6e..dc419cb 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,3 +1,3 @@", + "-someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + "+someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d523d6414978750538a5f0db9a039430426a16bd..e6ce816b8aef49808b88c148091b0cc5d1b50af7" +} +,{ + "testCaseDescription": "javascript-function-call-args-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 24 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 35, + 36 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 37, + 38 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 49 + ] + }, + { + "category": "Identifier", + "range": [ + 50, + 53 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 42, + 56 + ] + } + ], + "range": [ + 42, + 57 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 65, + 66 + ] + } + ], + "range": [ + 58, + 67 + ] + } + ], + "range": [ + 40, + 69 + ] + } + ], + "range": [ + 26, + 69 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 71, + 75 + ] + } + ], + "range": [ + 0, + 76 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 77 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 29 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 40, + 41 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 47, + 61 + ] + } + ], + "range": [ + 47, + 62 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 63, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + } + ], + "range": [ + 31, + 74 + ] + }, + { + "category": "Boolean", + "patch": "replace", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 0, + 82 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 83 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 89 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 90, + 91 + ] + }, + { + "category": "StringLiteral", + "range": [ + 93, + 101 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 126 + ] + }, + { + "category": "Identifier", + "range": [ + 127, + 130 + ] + }, + { + "category": "Identifier", + "range": [ + 131, + 132 + ] + } + ], + "range": [ + 119, + 133 + ] + } + ], + "range": [ + 119, + 134 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 142, + 143 + ] + } + ], + "range": [ + 135, + 144 + ] + } + ], + "range": [ + 117, + 146 + ] + } + ], + "range": [ + 103, + 146 + ] + }, + { + "category": "Boolean", + "range": [ + 148, + 152 + ] + } + ], + "range": [ + 77, + 153 + ] + } + ], + "range": [ + 77, + 154 + ] + } + ], + "range": [ + 77, + 154 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 154 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 83, + 95 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 96, + 97 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 125, + 132 + ] + }, + { + "category": "Identifier", + "range": [ + 133, + 136 + ] + }, + { + "category": "Identifier", + "range": [ + 137, + 138 + ] + } + ], + "range": [ + 125, + 139 + ] + } + ], + "range": [ + 125, + 140 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 148, + 149 + ] + } + ], + "range": [ + 141, + 150 + ] + } + ], + "range": [ + 123, + 152 + ] + } + ], + "range": [ + 109, + 152 + ] + }, + { + "category": "Boolean", + "range": [ + 154, + 158 + ] + } + ], + "range": [ + 83, + 159 + ] + } + ], + "range": [ + 83, + 160 + ] + } + ], + "range": [ + 83, + 160 + ] + } + ], + "hasChanges": false, + "range": [ + 83, + 160 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 154, + 166 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 167, + 168 + ] + }, + { + "category": "StringLiteral", + "range": [ + 170, + 178 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 189, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 192 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 196, + 203 + ] + }, + { + "category": "Identifier", + "range": [ + 204, + 207 + ] + }, + { + "category": "Identifier", + "range": [ + 208, + 209 + ] + } + ], + "range": [ + 196, + 210 + ] + } + ], + "range": [ + 196, + 211 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 219, + 220 + ] + } + ], + "range": [ + 212, + 221 + ] + } + ], + "range": [ + 194, + 223 + ] + } + ], + "range": [ + 180, + 223 + ] + }, + { + "category": "Boolean", + "range": [ + 225, + 229 + ] + } + ], + "range": [ + 154, + 230 + ] + } + ], + "range": [ + 154, + 231 + ] + } + ], + "range": [ + 154, + 231 + ] + } + ], + "hasChanges": false, + "range": [ + 154, + 231 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 172 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 173, + 174 + ] + }, + { + "category": "StringLiteral", + "range": [ + 176, + 184 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Identifier", + "range": [ + 197, + 198 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 202, + 209 + ] + }, + { + "category": "Identifier", + "range": [ + 210, + 213 + ] + }, + { + "category": "Identifier", + "range": [ + 214, + 215 + ] + } + ], + "range": [ + 202, + 216 + ] + } + ], + "range": [ + 202, + 217 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 225, + 226 + ] + } + ], + "range": [ + 218, + 227 + ] + } + ], + "range": [ + 200, + 229 + ] + } + ], + "range": [ + 186, + 229 + ] + }, + { + "category": "Boolean", + "range": [ + 231, + 235 + ] + } + ], + "range": [ + 160, + 236 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 160, + 237 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 231, + 231 + ] + } + ], + "hasChanges": false, + "range": [ + 231, + 231 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 237, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 237, + 237 + ], + "number": 4 + } + ] + ], + "paths": [ + "function-call-args.js", + "function-call-args.js" + ], + "oids": [ + "dc419cba5721af66b901680ae5608317dc162c81", + "3f4ee6eff96262b663d39cbd5835360a1f494473" + ] + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index dc419cb..3f4ee6e 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,3 +1,3 @@", + "-someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + "+someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e6ce816b8aef49808b88c148091b0cc5d1b50af7..505d2d8e44416f84023a062e474ea5547a9e24ef" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 29 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + }, + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 47, + 61 + ] + } + ], + "range": [ + 47, + 62 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 63, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + } + ], + "range": [ + 31, + 74 + ] + }, + { + "category": "Boolean", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 0, + 82 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 83 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 83 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 83, + 95 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 96, + 97 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 119 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 125, + 132 + ] + }, + { + "category": "Identifier", + "range": [ + 133, + 136 + ] + }, + { + "category": "Identifier", + "range": [ + 137, + 138 + ] + } + ], + "range": [ + 125, + 139 + ] + } + ], + "range": [ + 125, + 140 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 148, + 149 + ] + } + ], + "range": [ + 141, + 150 + ] + } + ], + "range": [ + 123, + 152 + ] + } + ], + "range": [ + 109, + 152 + ] + }, + { + "category": "Boolean", + "range": [ + 154, + 158 + ] + } + ], + "range": [ + 83, + 159 + ] + } + ], + "patch": "delete", + "range": [ + 83, + 160 + ] + } + ], + "range": [ + 83, + 160 + ] + } + ], + "hasChanges": true, + "range": [ + 83, + 160 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 172 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 173, + 174 + ] + }, + { + "category": "StringLiteral", + "range": [ + 176, + 184 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 195, + 196 + ] + }, + { + "category": "Identifier", + "range": [ + 197, + 198 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 202, + 209 + ] + }, + { + "category": "Identifier", + "range": [ + 210, + 213 + ] + }, + { + "category": "Identifier", + "range": [ + 214, + 215 + ] + } + ], + "range": [ + 202, + 216 + ] + } + ], + "range": [ + 202, + 217 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 225, + 226 + ] + } + ], + "range": [ + 218, + 227 + ] + } + ], + "range": [ + 200, + 229 + ] + } + ], + "range": [ + 186, + 229 + ] + }, + { + "category": "Boolean", + "range": [ + 231, + 235 + ] + } + ], + "range": [ + 160, + 236 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "range": [ + 160, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 160, + 237 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 24 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 49 + ] + }, + { + "category": "Identifier", + "range": [ + 50, + 53 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 42, + 56 + ] + } + ], + "range": [ + 42, + 57 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + } + ], + "range": [ + 58, + 67 + ] + } + ], + "range": [ + 40, + 69 + ] + } + ], + "range": [ + 26, + 69 + ] + }, + { + "category": "Boolean", + "range": [ + 71, + 75 + ] + } + ], + "range": [ + 0, + 76 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 77 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 89 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 90, + 91 + ] + }, + { + "category": "StringLiteral", + "range": [ + 93, + 106 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 117, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 124, + 131 + ] + }, + { + "category": "Identifier", + "range": [ + 132, + 135 + ] + }, + { + "category": "Identifier", + "range": [ + 136, + 137 + ] + } + ], + "range": [ + 124, + 138 + ] + } + ], + "range": [ + 124, + 139 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 147, + 148 + ] + } + ], + "range": [ + 140, + 149 + ] + } + ], + "range": [ + 122, + 151 + ] + } + ], + "range": [ + 108, + 151 + ] + }, + { + "category": "Boolean", + "range": [ + 153, + 158 + ] + } + ], + "range": [ + 77, + 159 + ] + } + ], + "patch": "insert", + "range": [ + 77, + 160 + ] + } + ], + "range": [ + 77, + 160 + ] + } + ], + "hasChanges": true, + "range": [ + 77, + 160 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 237, + 237 + ] + } + ], + "hasChanges": false, + "range": [ + 237, + 237 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 160, + 160 + ] + } + ], + "hasChanges": false, + "range": [ + 160, + 160 + ], + "number": 3 + } + ] + ], + "paths": [ + "function-call-args.js", + "function-call-args.js" + ], + "oids": [ + "3f4ee6eff96262b663d39cbd5835360a1f494473", + "cae967b66fad9a3b96bcabe6dcdfd25ae8f70050" + ] + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 3f4ee6e..cae967b 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,3 +1,2 @@", + "-someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)", + "-someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + "+someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "505d2d8e44416f84023a062e474ea5547a9e24ef..3993b0e88ee0edfd98dda259fc787ba4845495d4" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 24 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 49 + ] + }, + { + "category": "Identifier", + "range": [ + 50, + 53 + ] + }, + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 42, + 56 + ] + } + ], + "range": [ + 42, + 57 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 66 + ] + } + ], + "range": [ + 58, + 67 + ] + } + ], + "range": [ + 40, + 69 + ] + } + ], + "range": [ + 26, + 69 + ] + }, + { + "category": "Boolean", + "range": [ + 71, + 75 + ] + } + ], + "range": [ + 0, + 76 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 77 + ] + } + ], + "range": [ + 0, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 77 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 89 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 90, + 91 + ] + }, + { + "category": "StringLiteral", + "range": [ + 93, + 106 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 117, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 124, + 131 + ] + }, + { + "category": "Identifier", + "range": [ + 132, + 135 + ] + }, + { + "category": "Identifier", + "range": [ + 136, + 137 + ] + } + ], + "range": [ + 124, + 138 + ] + } + ], + "range": [ + 124, + 139 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 147, + 148 + ] + } + ], + "range": [ + 140, + 149 + ] + } + ], + "range": [ + 122, + 151 + ] + } + ], + "range": [ + 108, + 151 + ] + }, + { + "category": "Boolean", + "range": [ + 153, + 158 + ] + } + ], + "range": [ + 77, + 159 + ] + } + ], + "range": [ + 77, + 160 + ] + } + ], + "range": [ + 77, + 160 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 160 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 29 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + }, + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 47, + 61 + ] + } + ], + "range": [ + 47, + 62 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 63, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + } + ], + "range": [ + 31, + 74 + ] + }, + { + "category": "Boolean", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 0, + 82 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 83 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 160, + 160 + ] + } + ], + "hasChanges": false, + "range": [ + 160, + 160 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 83, + 83 + ] + } + ], + "hasChanges": false, + "range": [ + 83, + 83 + ], + "number": 2 + } + ] + ], + "paths": [ + "function-call-args.js", + "function-call-args.js" + ], + "oids": [ + "cae967b66fad9a3b96bcabe6dcdfd25ae8f70050", + "0d19573d73190fda4203ba60df4eb7553c5da874" + ] + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index cae967b..0d19573 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1,2 +1 @@", + "-someFunction(1, \"string\", function(a,b) { console.log(a); return b; }, true)", + " someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3993b0e88ee0edfd98dda259fc787ba4845495d4..f89ece40228968ba4db1a434efef2d7dcb2299f1" +} +,{ + "testCaseDescription": "javascript-function-call-args-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 29 + ] + }, + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 41 + ] + }, + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 58 + ] + }, + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 47, + 61 + ] + } + ], + "range": [ + 47, + 62 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 63, + 72 + ] + } + ], + "range": [ + 45, + 74 + ] + } + ], + "range": [ + 31, + 74 + ] + }, + { + "category": "Boolean", + "range": [ + 76, + 81 + ] + } + ], + "range": [ + 0, + 82 + ] + } + ], + "range": [ + 0, + 83 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 83 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 83 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 83, + 83 + ] + } + ], + "hasChanges": true, + "range": [ + 83, + 83 + ], + "number": 2 + } + ] + ], + "paths": [ + "function-call-args.js", + "function-call-args.js" + ], + "oids": [ + "0d19573d73190fda4203ba60df4eb7553c5da874", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "function-call-args.js" + ], + "patch": [ + "diff --git a/function-call-args.js b/function-call-args.js", + "index 0d19573..e69de29 100644", + "--- a/function-call-args.js", + "+++ b/function-call-args.js", + "@@ -1 +0,0 @@", + "-someFunction(1, \"otherString\", function(b,c) { console.log(b); return c; }, false)" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f89ece40228968ba4db1a434efef2d7dcb2299f1..24ed5bdc27489ca788d6784b0385a26f77c8c9d7" +}] diff --git a/test/corpus/json/javascript/function-call.json b/test/corpus/json/javascript/function-call.json new file mode 100644 index 000000000..761c5386f --- /dev/null +++ b/test/corpus/json/javascript/function-call.json @@ -0,0 +1,1994 @@ +[{ + "testCaseDescription": "javascript-function-call-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 28 + ], + "number": 2 + } + ] + ], + "paths": [ + "function-call.js", + "function-call.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "8bd95e09f34bbef6affe8b7121155d5c7688c301" + ] + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index e69de29..8bd95e0 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -0,0 +1 @@", + "+someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2f1a5ed4016f7e817cb5b1b4839bb64deecd8042..25d3ee2d3ff91913572423be561a8318988efc61" +} +,{ + "testCaseDescription": "javascript-function-call-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "patch": "insert", + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 56 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 28 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "StringLiteral", + "range": [ + 75, + 81 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + } + ] + ], + "paths": [ + "function-call.js", + "function-call.js" + ], + "oids": [ + "8bd95e09f34bbef6affe8b7121155d5c7688c301", + "6bb4cf3fca51fafbe16ef8ee82d6e3eaacfa2254" + ] + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 8bd95e0..6bb4cf3 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1 +1,3 @@", + "+someFunction(arg1, \"arg3\");", + "+someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "25d3ee2d3ff91913572423be561a8318988efc61..eaf1c7143170b44b39118ef3cdcd21d5ffea14b3" +} +,{ + "testCaseDescription": "javascript-function-call-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "StringLiteral", + "range": [ + 75, + 81 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "StringLiteral", + "range": [ + 75, + 81 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + } + ] + ], + "paths": [ + "function-call.js", + "function-call.js" + ], + "oids": [ + "6bb4cf3fca51fafbe16ef8ee82d6e3eaacfa2254", + "b38c232b930bd8334195f4ed499c451e9ea8ecdd" + ] + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 6bb4cf3..b38c232 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,3 +1,3 @@", + "-someFunction(arg1, \"arg3\");", + "+someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "eaf1c7143170b44b39118ef3cdcd21d5ffea14b3..a338d8f70dc78ffafe94e2ba9c900cb2df7e8609" +} +,{ + "testCaseDescription": "javascript-function-call-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "StringLiteral", + "range": [ + 75, + 81 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "StringLiteral", + "range": [ + 75, + 81 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + } + ] + ], + "paths": [ + "function-call.js", + "function-call.js" + ], + "oids": [ + "b38c232b930bd8334195f4ed499c451e9ea8ecdd", + "6bb4cf3fca51fafbe16ef8ee82d6e3eaacfa2254" + ] + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index b38c232..6bb4cf3 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,3 +1,3 @@", + "-someFunction(arg1, \"arg2\");", + "+someFunction(arg1, \"arg3\");", + " someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a338d8f70dc78ffafe94e2ba9c900cb2df7e8609..6084db51a20a9a4460c86208fda30bfcd92cb316" +} +,{ + "testCaseDescription": "javascript-function-call-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "patch": "delete", + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 56 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 56, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "StringLiteral", + "range": [ + 75, + 81 + ] + } + ], + "range": [ + 56, + 82 + ] + } + ], + "range": [ + 56, + 83 + ] + } + ], + "range": [ + 56, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 84 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "patch": "insert", + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 56 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 84, + 84 + ] + } + ], + "hasChanges": false, + "range": [ + 84, + 84 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 56, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 56 + ], + "number": 3 + } + ] + ], + "paths": [ + "function-call.js", + "function-call.js" + ], + "oids": [ + "6bb4cf3fca51fafbe16ef8ee82d6e3eaacfa2254", + "3e15c6acfec15cab45af7743b58b6a5d86644de8" + ] + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 6bb4cf3..3e15c6a 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,3 +1,2 @@", + "-someFunction(arg1, \"arg3\");", + "-someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg2\");", + "+someFunction(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6084db51a20a9a4460c86208fda30bfcd92cb316..895672cc7bd62b5e5824ea70785c8f0eccb41d79" +} +,{ + "testCaseDescription": "javascript-function-call-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "StringLiteral", + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 28, + 54 + ] + } + ], + "range": [ + 28, + 55 + ] + } + ], + "range": [ + 28, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 56 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 56, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 56 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 2 + } + ] + ], + "paths": [ + "function-call.js", + "function-call.js" + ], + "oids": [ + "3e15c6acfec15cab45af7743b58b6a5d86644de8", + "1add64b55168fd038e39887fb7239b77b6e7e2ea" + ] + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 3e15c6a..1add64b 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1,2 +1 @@", + "-someFunction(arg1, \"arg2\");", + " someFunction(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "895672cc7bd62b5e5824ea70785c8f0eccb41d79..5698ffbd0ba7c682461b54b92c9036844cf7598e" +} +,{ + "testCaseDescription": "javascript-function-call-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + }, + { + "category": "StringLiteral", + "range": [ + 19, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 28 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": true, + "range": [ + 28, + 28 + ], + "number": 2 + } + ] + ], + "paths": [ + "function-call.js", + "function-call.js" + ], + "oids": [ + "1add64b55168fd038e39887fb7239b77b6e7e2ea", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "function-call.js" + ], + "patch": [ + "diff --git a/function-call.js b/function-call.js", + "index 1add64b..e69de29 100644", + "--- a/function-call.js", + "+++ b/function-call.js", + "@@ -1 +0,0 @@", + "-someFunction(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5698ffbd0ba7c682461b54b92c9036844cf7598e..7aca49a04758f43f9e7c909ee616f33c18cf0e27" +}] diff --git a/test/corpus/json/javascript/function.json b/test/corpus/json/javascript/function.json new file mode 100644 index 000000000..037339f45 --- /dev/null +++ b/test/corpus/json/javascript/function.json @@ -0,0 +1,2462 @@ +[{ + "testCaseDescription": "javascript-function-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "function.js", + "function.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "2d8d739d482e7d7f0d980b6142fc423d75eb3010" + ] + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index e69de29..2d8d739 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -0,0 +1 @@", + "+function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "47efa692005800aae87fccdba3a089c87d9c46f1..f24028d8eb97ae574ac7e8a0ad7a20c08ce93139" +} +,{ + "testCaseDescription": "javascript-function-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "patch": "insert", + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 32 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 79, + 83 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 64, + 94 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + } + ] + ], + "paths": [ + "function.js", + "function.js" + ], + "oids": [ + "2d8d739d482e7d7f0d980b6142fc423d75eb3010", + "43894067640469e6a77901bd079d5d4e5722834b" + ] + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 2d8d739..4389406 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1 +1,3 @@", + "+function(arg1, arg2) { arg1; };", + "+function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f24028d8eb97ae574ac7e8a0ad7a20c08ce93139..88f2dd5809a7bafd96d27ebf18b4daafef783a3b" +} +,{ + "testCaseDescription": "javascript-function-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 79, + 83 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 64, + 94 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 79, + 83 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 64, + 94 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + } + ] + ], + "paths": [ + "function.js", + "function.js" + ], + "oids": [ + "43894067640469e6a77901bd079d5d4e5722834b", + "924c99e8aa9987bfcbda2792c3339981a92b87fe" + ] + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 4389406..924c99e 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,3 +1,3 @@", + "-function(arg1, arg2) { arg1; };", + "+function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "88f2dd5809a7bafd96d27ebf18b4daafef783a3b..74c5830b3ef3429cb69c367c5cc475c65b12ce53" +} +,{ + "testCaseDescription": "javascript-function-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 79, + 83 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 64, + 94 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 79, + 83 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 64, + 94 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + } + ] + ], + "paths": [ + "function.js", + "function.js" + ], + "oids": [ + "924c99e8aa9987bfcbda2792c3339981a92b87fe", + "43894067640469e6a77901bd079d5d4e5722834b" + ] + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 924c99e..4389406 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,3 +1,3 @@", + "-function(arg1, arg2) { arg2; };", + "+function(arg1, arg2) { arg1; };", + " function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "74c5830b3ef3429cb69c367c5cc475c65b12ce53..9b9ec597e957a243d5675aa0b091204ddf2ad7c9" +} +,{ + "testCaseDescription": "javascript-function-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "patch": "delete", + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + }, + { + "category": "Identifier", + "range": [ + 79, + 83 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 85, + 94 + ] + } + ], + "range": [ + 64, + 94 + ] + } + ], + "range": [ + 64, + 95 + ] + } + ], + "range": [ + 64, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 96 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "patch": "insert", + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 64 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 96, + 96 + ] + } + ], + "hasChanges": false, + "range": [ + 96, + 96 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 64, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 64 + ], + "number": 3 + } + ] + ], + "paths": [ + "function.js", + "function.js" + ], + "oids": [ + "43894067640469e6a77901bd079d5d4e5722834b", + "254dbcf8c9097c6baf325a62c8caa89ce4cc988c" + ] + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 4389406..254dbcf 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,3 +1,2 @@", + "-function(arg1, arg2) { arg1; };", + "-function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg2; };", + "+function(arg1, arg2) { arg1; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9b9ec597e957a243d5675aa0b091204ddf2ad7c9..47e9bce142789a8a4d674e20982dce0d8a0c90b5" +} +,{ + "testCaseDescription": "javascript-function-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 55, + 60 + ] + } + ], + "range": [ + 53, + 62 + ] + } + ], + "range": [ + 32, + 62 + ] + } + ], + "range": [ + 32, + 63 + ] + } + ], + "range": [ + 32, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 64 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 64, + 64 + ] + } + ], + "hasChanges": false, + "range": [ + 64, + 64 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "function.js", + "function.js" + ], + "oids": [ + "254dbcf8c9097c6baf325a62c8caa89ce4cc988c", + "b37e8671369086f500640d97788b75427fef8d5b" + ] + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index 254dbcf..b37e867 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1,2 +1 @@", + "-function(arg1, arg2) { arg2; };", + " function(arg1, arg2) { arg1; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "47e9bce142789a8a4d674e20982dce0d8a0c90b5..5781ccafc974bef5785ff1533042f7eccba7ff03" +} +,{ + "testCaseDescription": "javascript-function-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 13 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 0, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 32 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": true, + "range": [ + 32, + 32 + ], + "number": 2 + } + ] + ], + "paths": [ + "function.js", + "function.js" + ], + "oids": [ + "b37e8671369086f500640d97788b75427fef8d5b", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "function.js" + ], + "patch": [ + "diff --git a/function.js b/function.js", + "index b37e867..e69de29 100644", + "--- a/function.js", + "+++ b/function.js", + "@@ -1 +0,0 @@", + "-function(arg1, arg2) { arg1; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5781ccafc974bef5785ff1533042f7eccba7ff03..4a56270744e8c9a123c828e7ab9409789ab51e5b" +}] diff --git a/test/corpus/json/javascript/generator-function.json b/test/corpus/json/javascript/generator-function.json new file mode 100644 index 000000000..3d12c8516 --- /dev/null +++ b/test/corpus/json/javascript/generator-function.json @@ -0,0 +1,2826 @@ +[{ + "testCaseDescription": "javascript-generator-function-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 34 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 38, + 44 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 36, + 58 + ] + } + ], + "range": [ + 0, + 58 + ] + } + ], + "range": [ + 0, + 59 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 60 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 60 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": true, + "range": [ + 60, + 60 + ], + "number": 2 + } + ] + ], + "paths": [ + "generator-function.js", + "generator-function.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "04e8a59bc45444cc298c2142de90af10b8386bf3" + ] + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index e69de29..04e8a59 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -0,0 +1 @@", + "+function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a52e2d614f9e9504970732cbc2d5f9c933eb061f..a4a896cba2216edee62cc9fe96efdbc5408fdb46" +} +,{ + "testCaseDescription": "javascript-generator-function-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 26 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 41, + 47 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 58 + ] + } + ], + "range": [ + 48, + 59 + ] + } + ], + "range": [ + 39, + 61 + ] + } + ], + "range": [ + 0, + 61 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 86 + ] + }, + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 93, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 101, + 107 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 118 + ] + } + ], + "range": [ + 108, + 119 + ] + } + ], + "range": [ + 99, + 121 + ] + } + ], + "range": [ + 63, + 121 + ] + } + ], + "patch": "insert", + "range": [ + 63, + 122 + ] + } + ], + "range": [ + 63, + 123 + ] + } + ], + "hasChanges": true, + "range": [ + 63, + 123 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 34 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 38, + 44 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 36, + 58 + ] + } + ], + "range": [ + 0, + 58 + ] + } + ], + "range": [ + 0, + 59 + ] + } + ], + "range": [ + 0, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 60 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 133, + 146 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 157 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 161, + 167 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 174, + 178 + ] + } + ], + "range": [ + 168, + 179 + ] + } + ], + "range": [ + 159, + 181 + ] + } + ], + "range": [ + 123, + 181 + ] + } + ], + "range": [ + 123, + 182 + ] + } + ], + "range": [ + 123, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 123, + 183 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 183, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 183, + 183 + ], + "number": 4 + } + ] + ], + "paths": [ + "generator-function.js", + "generator-function.js" + ], + "oids": [ + "04e8a59bc45444cc298c2142de90af10b8386bf3", + "ed5c0370f5abc30c2f381fe513447b205647aebc" + ] + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 04e8a59..ed5c037 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1 +1,3 @@", + "+function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a4a896cba2216edee62cc9fe96efdbc5408fdb46..efb9d38a6460f6bac29b03924c33ee9bce0b26d2" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 10, + 26 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 41, + 47 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 58 + ] + } + ], + "range": [ + 48, + 59 + ] + } + ], + "range": [ + 39, + 61 + ] + } + ], + "range": [ + 0, + 61 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 10, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 34 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 38, + 44 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 36, + 58 + ] + } + ], + "range": [ + 0, + 58 + ] + } + ], + "range": [ + 0, + 59 + ] + } + ], + "range": [ + 0, + 60 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 60 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 86 + ] + }, + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 93, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 101, + 107 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 118 + ] + } + ], + "range": [ + 108, + 119 + ] + } + ], + "range": [ + 99, + 121 + ] + } + ], + "range": [ + 63, + 121 + ] + } + ], + "range": [ + 63, + 122 + ] + } + ], + "range": [ + 63, + 123 + ] + } + ], + "hasChanges": false, + "range": [ + 63, + 123 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 90, + 94 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 98, + 104 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 115 + ] + } + ], + "range": [ + 105, + 116 + ] + } + ], + "range": [ + 96, + 118 + ] + } + ], + "range": [ + 60, + 118 + ] + } + ], + "range": [ + 60, + 119 + ] + } + ], + "range": [ + 60, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 120 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 133, + 146 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 157 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 161, + 167 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 174, + 178 + ] + } + ], + "range": [ + 168, + 179 + ] + } + ], + "range": [ + 159, + 181 + ] + } + ], + "range": [ + 123, + 181 + ] + } + ], + "range": [ + 123, + 182 + ] + } + ], + "range": [ + 123, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 123, + 183 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 143 + ] + }, + { + "category": "Identifier", + "range": [ + 144, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 158, + 164 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 171, + 175 + ] + } + ], + "range": [ + 165, + 176 + ] + } + ], + "range": [ + 156, + 178 + ] + } + ], + "range": [ + 120, + 178 + ] + } + ], + "range": [ + 120, + 179 + ] + } + ], + "range": [ + 120, + 180 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 180 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 183, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 183, + 183 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 180, + 180 + ] + } + ], + "hasChanges": false, + "range": [ + 180, + 180 + ], + "number": 4 + } + ] + ], + "paths": [ + "generator-function.js", + "generator-function.js" + ], + "oids": [ + "ed5c0370f5abc30c2f381fe513447b205647aebc", + "0895c3fde3cba1e850e4730eb193f62270215e70" + ] + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index ed5c037..0895c3f 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,3 +1,3 @@", + "-function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "efb9d38a6460f6bac29b03924c33ee9bce0b26d2..129fc139ed29b7d14c49713f6297e118f3691d9c" +} +,{ + "testCaseDescription": "javascript-generator-function-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 10, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 34 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 38, + 44 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 36, + 58 + ] + } + ], + "range": [ + 0, + 58 + ] + } + ], + "range": [ + 0, + 59 + ] + } + ], + "range": [ + 0, + 60 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 60 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 10, + 26 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 41, + 47 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 58 + ] + } + ], + "range": [ + 48, + 59 + ] + } + ], + "range": [ + 39, + 61 + ] + } + ], + "range": [ + 0, + 61 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 90, + 94 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 98, + 104 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 115 + ] + } + ], + "range": [ + 105, + 116 + ] + } + ], + "range": [ + 96, + 118 + ] + } + ], + "range": [ + 60, + 118 + ] + } + ], + "range": [ + 60, + 119 + ] + } + ], + "range": [ + 60, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 120 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 86 + ] + }, + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 93, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 101, + 107 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 118 + ] + } + ], + "range": [ + 108, + 119 + ] + } + ], + "range": [ + 99, + 121 + ] + } + ], + "range": [ + 63, + 121 + ] + } + ], + "range": [ + 63, + 122 + ] + } + ], + "range": [ + 63, + 123 + ] + } + ], + "hasChanges": false, + "range": [ + 63, + 123 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 143 + ] + }, + { + "category": "Identifier", + "range": [ + 144, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 158, + 164 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 171, + 175 + ] + } + ], + "range": [ + 165, + 176 + ] + } + ], + "range": [ + 156, + 178 + ] + } + ], + "range": [ + 120, + 178 + ] + } + ], + "range": [ + 120, + 179 + ] + } + ], + "range": [ + 120, + 180 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 180 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 133, + 146 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 157 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 161, + 167 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 174, + 178 + ] + } + ], + "range": [ + 168, + 179 + ] + } + ], + "range": [ + 159, + 181 + ] + } + ], + "range": [ + 123, + 181 + ] + } + ], + "range": [ + 123, + 182 + ] + } + ], + "range": [ + 123, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 123, + 183 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 180, + 180 + ] + } + ], + "hasChanges": false, + "range": [ + 180, + 180 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 183, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 183, + 183 + ], + "number": 4 + } + ] + ], + "paths": [ + "generator-function.js", + "generator-function.js" + ], + "oids": [ + "0895c3fde3cba1e850e4730eb193f62270215e70", + "ed5c0370f5abc30c2f381fe513447b205647aebc" + ] + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 0895c3f..ed5c037 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,3 +1,3 @@", + "-function *generateStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "129fc139ed29b7d14c49713f6297e118f3691d9c..0360112c551e3312985cfefd8c393f5ee1ea75ba" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 26 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 41, + 47 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 58 + ] + } + ], + "range": [ + 48, + 59 + ] + } + ], + "range": [ + 39, + 61 + ] + } + ], + "range": [ + 0, + 61 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 86 + ] + }, + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 93, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 101, + 107 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 118 + ] + } + ], + "range": [ + 108, + 119 + ] + } + ], + "range": [ + 99, + 121 + ] + } + ], + "range": [ + 63, + 121 + ] + } + ], + "patch": "delete", + "range": [ + 63, + 122 + ] + } + ], + "range": [ + 63, + 123 + ] + } + ], + "hasChanges": true, + "range": [ + 63, + 123 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 133, + 146 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "Identifier", + "range": [ + 153, + 157 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 161, + 167 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 174, + 178 + ] + } + ], + "range": [ + 168, + 179 + ] + } + ], + "range": [ + 159, + 181 + ] + } + ], + "range": [ + 123, + 181 + ] + } + ], + "range": [ + 123, + 182 + ] + } + ], + "range": [ + 123, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 123, + 183 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 34 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 38, + 44 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 36, + 58 + ] + } + ], + "range": [ + 0, + 58 + ] + } + ], + "range": [ + 0, + 59 + ] + } + ], + "range": [ + 0, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 60 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 86 + ] + }, + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 93, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 101, + 107 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 118 + ] + } + ], + "range": [ + 108, + 119 + ] + } + ], + "range": [ + 99, + 121 + ] + } + ], + "range": [ + 60, + 121 + ] + } + ], + "patch": "insert", + "range": [ + 60, + 122 + ] + } + ], + "range": [ + 60, + 123 + ] + } + ], + "hasChanges": true, + "range": [ + 60, + 123 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 183, + 183 + ] + } + ], + "hasChanges": false, + "range": [ + 183, + 183 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 123, + 123 + ] + } + ], + "hasChanges": false, + "range": [ + 123, + 123 + ], + "number": 3 + } + ] + ], + "paths": [ + "generator-function.js", + "generator-function.js" + ], + "oids": [ + "ed5c0370f5abc30c2f381fe513447b205647aebc", + "1dae1059cf36b86fdb5fa7cdf701f28709470b90" + ] + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index ed5c037..1dae105 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,3 +1,2 @@", + "-function *generateNewStuff(arg1, arg2) { yield; yield arg2; };", + "-function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateStuff(arg1, arg2) { yield; yield arg2; };", + "+function *generateNewStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0360112c551e3312985cfefd8c393f5ee1ea75ba..cd60754110e1117c82342762bc3e2f924a91d2f7" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 34 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 38, + 44 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 36, + 58 + ] + } + ], + "range": [ + 0, + 58 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 59 + ] + } + ], + "range": [ + 0, + 60 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 60 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 70, + 86 + ] + }, + { + "category": "Identifier", + "range": [ + 87, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 93, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 101, + 107 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 118 + ] + } + ], + "range": [ + 108, + 119 + ] + } + ], + "range": [ + 99, + 121 + ] + } + ], + "range": [ + 60, + 121 + ] + } + ], + "range": [ + 60, + 122 + ] + } + ], + "range": [ + 60, + 123 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 123 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 26 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 41, + 47 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 58 + ] + } + ], + "range": [ + 48, + 59 + ] + } + ], + "range": [ + 39, + 61 + ] + } + ], + "range": [ + 0, + 61 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 123, + 123 + ] + } + ], + "hasChanges": false, + "range": [ + 123, + 123 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 63, + 63 + ] + } + ], + "hasChanges": false, + "range": [ + 63, + 63 + ], + "number": 2 + } + ] + ], + "paths": [ + "generator-function.js", + "generator-function.js" + ], + "oids": [ + "1dae1059cf36b86fdb5fa7cdf701f28709470b90", + "5846d1c0997bed696b602367f89d69b35822caac" + ] + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 1dae105..5846d1c 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1,2 +1 @@", + "-function *generateStuff(arg1, arg2) { yield; yield arg2; };", + " function *generateNewStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cd60754110e1117c82342762bc3e2f924a91d2f7..99fb44113edd307ee060aa841b283093ac2d6f34" +} +,{ + "testCaseDescription": "javascript-generator-function-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 26 + ] + }, + { + "category": "Identifier", + "range": [ + 27, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "yield_statement", + "range": [ + 41, + 47 + ] + }, + { + "category": "yield_statement", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 58 + ] + } + ], + "range": [ + 48, + 59 + ] + } + ], + "range": [ + 39, + 61 + ] + } + ], + "range": [ + 0, + 61 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 63 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 63, + 63 + ] + } + ], + "hasChanges": true, + "range": [ + 63, + 63 + ], + "number": 2 + } + ] + ], + "paths": [ + "generator-function.js", + "generator-function.js" + ], + "oids": [ + "5846d1c0997bed696b602367f89d69b35822caac", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "generator-function.js" + ], + "patch": [ + "diff --git a/generator-function.js b/generator-function.js", + "index 5846d1c..e69de29 100644", + "--- a/generator-function.js", + "+++ b/generator-function.js", + "@@ -1 +0,0 @@", + "-function *generateNewStuff(arg1, arg2) { yield; yield arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "99fb44113edd307ee060aa841b283093ac2d6f34..e3b9f963811fa510e777ed818a75408691e53555" +}] diff --git a/test/corpus/json/javascript/identifier.json b/test/corpus/json/javascript/identifier.json new file mode 100644 index 000000000..14a895c72 --- /dev/null +++ b/test/corpus/json/javascript/identifier.json @@ -0,0 +1,1396 @@ +[{ + "testCaseDescription": "javascript-identifier-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "identifier.js", + "identifier.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "1cf4ad05ef284fd6411546e5ddfb1938c9151cb1" + ] + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index e69de29..1cf4ad0 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -0,0 +1 @@", + "+theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1b8151602239d34159506d5d6e55de712e8c0d10..b4bc6d6ee5fd674fc9dbc5880f2734283a79c445" +} +,{ + "testCaseDescription": "javascript-identifier-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "identifier.js", + "identifier.js" + ], + "oids": [ + "1cf4ad05ef284fd6411546e5ddfb1938c9151cb1", + "888855ad41100937e0019b87e0a81fb922b040b7" + ] + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 1cf4ad0..888855a 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1 +1,3 @@", + "+theVar2", + "+theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b4bc6d6ee5fd674fc9dbc5880f2734283a79c445..65c8ab30e080fc1e8a7a78a09d9a65ff4d70243d" +} +,{ + "testCaseDescription": "javascript-identifier-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "identifier.js", + "identifier.js" + ], + "oids": [ + "888855ad41100937e0019b87e0a81fb922b040b7", + "60e041c1f5c995232ea415ada7796a8fc59cf50a" + ] + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 888855a..60e041c 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,3 +1,3 @@", + "-theVar2", + "+theVar;", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "65c8ab30e080fc1e8a7a78a09d9a65ff4d70243d..df5af19f39fbf09f64f8cf679e07b2b1020fbe28" +} +,{ + "testCaseDescription": "javascript-identifier-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "identifier.js", + "identifier.js" + ], + "oids": [ + "60e041c1f5c995232ea415ada7796a8fc59cf50a", + "888855ad41100937e0019b87e0a81fb922b040b7" + ] + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 60e041c..888855a 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,3 +1,3 @@", + "-theVar;", + "+theVar2", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "df5af19f39fbf09f64f8cf679e07b2b1020fbe28..935bdc032c3cacf8565bd269fa6c7f525c9a83b7" +} +,{ + "testCaseDescription": "javascript-identifier-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "patch": "delete", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 15 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 16 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + } + ] + ], + "paths": [ + "identifier.js", + "identifier.js" + ], + "oids": [ + "888855ad41100937e0019b87e0a81fb922b040b7", + "fbc7b28e28030a5474633484e56cfb97fbba5102" + ] + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 888855a..fbc7b28 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,3 +1,2 @@", + "-theVar2", + "-theVar;", + " theVar;", + "+theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "935bdc032c3cacf8565bd269fa6c7f525c9a83b7..99a3a4e1f2f45b9d0bd677e3252572fbdd77b297" +} +,{ + "testCaseDescription": "javascript-identifier-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "identifier.js", + "identifier.js" + ], + "oids": [ + "fbc7b28e28030a5474633484e56cfb97fbba5102", + "7276d95d4675eba989693d641b606c19e5c1e6ba" + ] + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index fbc7b28..7276d95 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1,2 +1 @@", + "-theVar;", + " theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "99a3a4e1f2f45b9d0bd677e3252572fbdd77b297..433e03b741975ca0b158e12ddd46c4ade00bf61d" +} +,{ + "testCaseDescription": "javascript-identifier-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "identifier.js", + "identifier.js" + ], + "oids": [ + "7276d95d4675eba989693d641b606c19e5c1e6ba", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "identifier.js" + ], + "patch": [ + "diff --git a/identifier.js b/identifier.js", + "index 7276d95..e69de29 100644", + "--- a/identifier.js", + "+++ b/identifier.js", + "@@ -1 +0,0 @@", + "-theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "433e03b741975ca0b158e12ddd46c4ade00bf61d..de56bb89881ee1f97c710b8447f22a479a373692" +}] diff --git a/test/corpus/json/javascript/if-else.json b/test/corpus/json/javascript/if-else.json new file mode 100644 index 000000000..16cff46f4 --- /dev/null +++ b/test/corpus/json/javascript/if-else.json @@ -0,0 +1,4900 @@ +[{ + "testCaseDescription": "javascript-if-else-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + } + ], + "range": [ + 22, + 24 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 37, + 39 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 49, + 50 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 60, + 61 + ] + } + ], + "range": [ + 60, + 62 + ] + } + ], + "range": [ + 45, + 62 + ] + } + ], + "range": [ + 30, + 62 + ] + } + ], + "range": [ + 15, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 62 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 62 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": true, + "range": [ + 62, + 62 + ], + "number": 2 + } + ] + ], + "paths": [ + "if-else.js", + "if-else.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "d81ebadd53d433754add9258494477aec1954688" + ] + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index e69de29..d81ebad 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -0,0 +1 @@", + "+if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a7c68af9b8e2a95ea64781f7701d616d9831d54b..859101c77238fb0c59826bfa95b840d6ce142fe4" +} +,{ + "testCaseDescription": "javascript-if-else-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 41, + 43 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "range": [ + 58, + 60 + ] + } + ], + "range": [ + 56, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + } + ], + "range": [ + 68, + 70 + ] + } + ], + "range": [ + 49, + 70 + ] + } + ], + "range": [ + 34, + 70 + ] + } + ], + "range": [ + 15, + 70 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 70 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + } + ], + "range": [ + 77, + 79 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 105 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 108 + ] + } + ], + "range": [ + 107, + 109 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 122, + 124 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 115, + 132 + ] + } + ], + "range": [ + 100, + 132 + ] + } + ], + "range": [ + 85, + 132 + ] + } + ], + "patch": "insert", + "range": [ + 70, + 132 + ] + } + ], + "range": [ + 70, + 132 + ] + } + ], + "hasChanges": true, + "range": [ + 70, + 132 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + } + ], + "range": [ + 22, + 24 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 37, + 39 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 49, + 50 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 60, + 61 + ] + } + ], + "range": [ + 60, + 62 + ] + } + ], + "range": [ + 45, + 62 + ] + } + ], + "range": [ + 30, + 62 + ] + } + ], + "range": [ + 15, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 62 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 137 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + } + ], + "range": [ + 139, + 141 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 151, + 152 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 154, + 155 + ] + } + ], + "range": [ + 154, + 156 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 166, + 167 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 169, + 170 + ] + } + ], + "range": [ + 169, + 171 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 181, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 184, + 185 + ] + } + ], + "range": [ + 184, + 186 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 192, + 193 + ] + } + ], + "range": [ + 192, + 194 + ] + } + ], + "range": [ + 177, + 194 + ] + } + ], + "range": [ + 162, + 194 + ] + } + ], + "range": [ + 147, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 194 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 194, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 194, + 194 + ], + "number": 4 + } + ] + ], + "paths": [ + "if-else.js", + "if-else.js" + ], + "oids": [ + "d81ebadd53d433754add9258494477aec1954688", + "6bb0eaa7ec6274091ce5ce960f47c96db97d4620" + ] + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index d81ebad..6bb0eaa 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1 +1,3 @@", + "+if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + "+if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "859101c77238fb0c59826bfa95b840d6ce142fe4..7aa5ca0081c95e390cc3fb383e893ad607d21ac6" +} +,{ + "testCaseDescription": "javascript-if-else-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + } + ], + "patch": "delete", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 38, + 39 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 41, + 43 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 53, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "patch": "delete", + "range": [ + 58, + 60 + ] + } + ], + "range": [ + 56, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 68, + 69 + ] + } + ], + "range": [ + 68, + 70 + ] + } + ], + "range": [ + 49, + 70 + ] + } + ], + "range": [ + 34, + 70 + ] + } + ], + "range": [ + 15, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 70 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "insert", + "range": [ + 22, + 23 + ] + } + ], + "range": [ + 22, + 24 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 37, + 39 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 49, + 50 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "insert", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 60, + 61 + ] + } + ], + "range": [ + 60, + 62 + ] + } + ], + "range": [ + 45, + 62 + ] + } + ], + "range": [ + 30, + 62 + ] + } + ], + "range": [ + 15, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 62 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + } + ], + "range": [ + 77, + 79 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 105 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 108 + ] + } + ], + "range": [ + 107, + 109 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 122, + 124 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 115, + 132 + ] + } + ], + "range": [ + 100, + 132 + ] + } + ], + "range": [ + 85, + 132 + ] + } + ], + "range": [ + 70, + 132 + ] + } + ], + "range": [ + 70, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 132 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 69, + 71 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 82 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 85 + ] + } + ], + "range": [ + 84, + 86 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 122, + 124 + ] + } + ], + "range": [ + 107, + 124 + ] + } + ], + "range": [ + 92, + 124 + ] + } + ], + "range": [ + 77, + 124 + ] + } + ], + "range": [ + 62, + 124 + ] + } + ], + "range": [ + 62, + 124 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 124 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 137 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + } + ], + "range": [ + 139, + 141 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 151, + 152 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 154, + 155 + ] + } + ], + "range": [ + 154, + 156 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 166, + 167 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 169, + 170 + ] + } + ], + "range": [ + 169, + 171 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 181, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 184, + 185 + ] + } + ], + "range": [ + 184, + 186 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 192, + 193 + ] + } + ], + "range": [ + 192, + 194 + ] + } + ], + "range": [ + 177, + 194 + ] + } + ], + "range": [ + 162, + 194 + ] + } + ], + "range": [ + 147, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 194 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 128, + 129 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 131, + 132 + ] + } + ], + "range": [ + 131, + 133 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 144 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 146, + 147 + ] + } + ], + "range": [ + 146, + 148 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 158, + 159 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 162 + ] + } + ], + "range": [ + 161, + 163 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 173, + 174 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 176, + 177 + ] + } + ], + "range": [ + 176, + 178 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 184, + 185 + ] + } + ], + "range": [ + 184, + 186 + ] + } + ], + "range": [ + 169, + 186 + ] + } + ], + "range": [ + 154, + 186 + ] + } + ], + "range": [ + 139, + 186 + ] + } + ], + "range": [ + 124, + 186 + ] + } + ], + "range": [ + 124, + 186 + ] + } + ], + "hasChanges": false, + "range": [ + 124, + 186 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 194, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 194, + 194 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 186, + 186 + ] + } + ], + "hasChanges": false, + "range": [ + 186, + 186 + ], + "number": 4 + } + ] + ], + "paths": [ + "if-else.js", + "if-else.js" + ], + "oids": [ + "6bb0eaa7ec6274091ce5ce960f47c96db97d4620", + "2034be1bb30315b1f005d8a8d6108d49c6cfc57f" + ] + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 6bb0eaa..2034be1 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,3 +1,3 @@", + "-if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + "+if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7aa5ca0081c95e390cc3fb383e893ad607d21ac6..db2dc88faaeca02e77d4d12d5c72988d460da4aa" +} +,{ + "testCaseDescription": "javascript-if-else-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "delete", + "range": [ + 22, + 23 + ] + } + ], + "range": [ + 22, + 24 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 37, + 39 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 49, + 50 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "delete", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 60, + 61 + ] + } + ], + "range": [ + 60, + 62 + ] + } + ], + "range": [ + 45, + 62 + ] + } + ], + "range": [ + 30, + 62 + ] + } + ], + "range": [ + 15, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 62 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + } + ], + "patch": "insert", + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 38, + 39 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 41, + 43 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 53, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "patch": "insert", + "range": [ + 58, + 60 + ] + } + ], + "range": [ + 56, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 68, + 69 + ] + } + ], + "range": [ + 68, + 70 + ] + } + ], + "range": [ + 49, + 70 + ] + } + ], + "range": [ + 34, + 70 + ] + } + ], + "range": [ + 15, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 70 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 69, + 71 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 82 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 85 + ] + } + ], + "range": [ + 84, + 86 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 111, + 112 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 122, + 124 + ] + } + ], + "range": [ + 107, + 124 + ] + } + ], + "range": [ + 92, + 124 + ] + } + ], + "range": [ + 77, + 124 + ] + } + ], + "range": [ + 62, + 124 + ] + } + ], + "range": [ + 62, + 124 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 124 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + } + ], + "range": [ + 77, + 79 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 105 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 108 + ] + } + ], + "range": [ + 107, + 109 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 122, + 124 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 115, + 132 + ] + } + ], + "range": [ + 100, + 132 + ] + } + ], + "range": [ + 85, + 132 + ] + } + ], + "range": [ + 70, + 132 + ] + } + ], + "range": [ + 70, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 132 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 128, + 129 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 131, + 132 + ] + } + ], + "range": [ + 131, + 133 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 144 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 146, + 147 + ] + } + ], + "range": [ + 146, + 148 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 158, + 159 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 161, + 162 + ] + } + ], + "range": [ + 161, + 163 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 173, + 174 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 176, + 177 + ] + } + ], + "range": [ + 176, + 178 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 184, + 185 + ] + } + ], + "range": [ + 184, + 186 + ] + } + ], + "range": [ + 169, + 186 + ] + } + ], + "range": [ + 154, + 186 + ] + } + ], + "range": [ + 139, + 186 + ] + } + ], + "range": [ + 124, + 186 + ] + } + ], + "range": [ + 124, + 186 + ] + } + ], + "hasChanges": false, + "range": [ + 124, + 186 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 137 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + } + ], + "range": [ + 139, + 141 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 151, + 152 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 154, + 155 + ] + } + ], + "range": [ + 154, + 156 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 166, + 167 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 169, + 170 + ] + } + ], + "range": [ + 169, + 171 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 181, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 184, + 185 + ] + } + ], + "range": [ + 184, + 186 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 192, + 193 + ] + } + ], + "range": [ + 192, + 194 + ] + } + ], + "range": [ + 177, + 194 + ] + } + ], + "range": [ + 162, + 194 + ] + } + ], + "range": [ + 147, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 194 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 186, + 186 + ] + } + ], + "hasChanges": false, + "range": [ + 186, + 186 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 194, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 194, + 194 + ], + "number": 4 + } + ] + ], + "paths": [ + "if-else.js", + "if-else.js" + ], + "oids": [ + "2034be1bb30315b1f005d8a8d6108d49c6cfc57f", + "6bb0eaa7ec6274091ce5ce960f47c96db97d4620" + ] + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 2034be1..6bb0eaa 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,3 +1,3 @@", + "-if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + "+if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "db2dc88faaeca02e77d4d12d5c72988d460da4aa..5b0fdc4282d1d7326c122766cb51190a2be1b6bb" +} +,{ + "testCaseDescription": "javascript-if-else-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 41, + 43 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "range": [ + 58, + 60 + ] + } + ], + "range": [ + 56, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + } + ], + "range": [ + 68, + 70 + ] + } + ], + "range": [ + 49, + 70 + ] + } + ], + "range": [ + 34, + 70 + ] + } + ], + "range": [ + 15, + 70 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 70 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + } + ], + "range": [ + 77, + 79 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 104, + 105 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 107, + 108 + ] + } + ], + "range": [ + 107, + 109 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 119, + 120 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 122, + 123 + ] + } + ], + "range": [ + 122, + 124 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 115, + 132 + ] + } + ], + "range": [ + 100, + 132 + ] + } + ], + "range": [ + 85, + 132 + ] + } + ], + "patch": "delete", + "range": [ + 70, + 132 + ] + } + ], + "range": [ + 70, + 132 + ] + } + ], + "hasChanges": true, + "range": [ + 70, + 132 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 136, + 137 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + } + ], + "range": [ + 139, + 141 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 151, + 152 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 154, + 155 + ] + } + ], + "range": [ + 154, + 156 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 166, + 167 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 169, + 170 + ] + } + ], + "range": [ + 169, + 171 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 181, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 184, + 185 + ] + } + ], + "range": [ + 184, + 186 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 192, + 193 + ] + } + ], + "range": [ + 192, + 194 + ] + } + ], + "range": [ + 177, + 194 + ] + } + ], + "range": [ + 162, + 194 + ] + } + ], + "range": [ + 147, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "range": [ + 132, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 194 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + } + ], + "range": [ + 22, + 24 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 37, + 39 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 49, + 50 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 60, + 61 + ] + } + ], + "range": [ + 60, + 62 + ] + } + ], + "range": [ + 45, + 62 + ] + } + ], + "range": [ + 30, + 62 + ] + } + ], + "range": [ + 15, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 62 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 69, + 71 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 82 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 103, + 104 + ] + } + ], + "range": [ + 103, + 105 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 116 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + } + ], + "range": [ + 120, + 122 + ] + } + ], + "range": [ + 118, + 124 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 111, + 132 + ] + } + ], + "range": [ + 96, + 132 + ] + } + ], + "range": [ + 77, + 132 + ] + } + ], + "patch": "insert", + "range": [ + 62, + 132 + ] + } + ], + "range": [ + 62, + 132 + ] + } + ], + "hasChanges": true, + "range": [ + 62, + 132 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 194, + 194 + ] + } + ], + "hasChanges": false, + "range": [ + 194, + 194 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 3 + } + ] + ], + "paths": [ + "if-else.js", + "if-else.js" + ], + "oids": [ + "6bb0eaa7ec6274091ce5ce960f47c96db97d4620", + "e26d6c43872f2810a2aca6432a8fefa636abfe9e" + ] + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 6bb0eaa..e26d6c4 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,3 +1,2 @@", + "-if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o", + "-if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + "+if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5b0fdc4282d1d7326c122766cb51190a2be1b6bb..2f737e139adcdbaeeaf780eb49df2b904642b16b" +} +,{ + "testCaseDescription": "javascript-if-else-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + } + ], + "range": [ + 22, + 24 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 37, + 39 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 49, + 50 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 60, + 61 + ] + } + ], + "range": [ + 60, + 62 + ] + } + ], + "range": [ + 45, + 62 + ] + } + ], + "range": [ + 30, + 62 + ] + } + ], + "range": [ + 15, + 62 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 62 + ] + } + ], + "range": [ + 0, + 62 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 62 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 67 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 69, + 70 + ] + } + ], + "range": [ + 69, + 71 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 81, + 82 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 100, + 101 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 103, + 104 + ] + } + ], + "range": [ + 103, + 105 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 115, + 116 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 121 + ] + } + ], + "range": [ + 120, + 122 + ] + } + ], + "range": [ + 118, + 124 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 111, + 132 + ] + } + ], + "range": [ + 96, + 132 + ] + } + ], + "range": [ + 77, + 132 + ] + } + ], + "range": [ + 62, + 132 + ] + } + ], + "range": [ + 62, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 132 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 41, + 43 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "range": [ + 58, + 60 + ] + } + ], + "range": [ + 56, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + } + ], + "range": [ + 68, + 70 + ] + } + ], + "range": [ + 49, + 70 + ] + } + ], + "range": [ + 34, + 70 + ] + } + ], + "range": [ + 15, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 70 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 70, + 70 + ] + } + ], + "hasChanges": false, + "range": [ + 70, + 70 + ], + "number": 2 + } + ] + ], + "paths": [ + "if-else.js", + "if-else.js" + ], + "oids": [ + "e26d6c43872f2810a2aca6432a8fefa636abfe9e", + "1a55d0bd4e0f601787524953f62c0f621fd96702" + ] + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index e26d6c4..1a55d0b 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1,2 +1 @@", + "-if (x) y; else if (a) b; else if (c) d; else if (e) f; else g", + " if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2f737e139adcdbaeeaf780eb49df2b904642b16b..168b06d356ffd180f13ad8f9c26fa0ed8adfc3eb" +} +,{ + "testCaseDescription": "javascript-if-else-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 7, + 9 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 24, + 26 + ] + } + ], + "range": [ + 22, + 28 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 41, + 42 + ] + } + ], + "range": [ + 41, + 43 + ] + }, + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 53, + 54 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "range": [ + 58, + 60 + ] + } + ], + "range": [ + 56, + 62 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 69 + ] + } + ], + "range": [ + 68, + 70 + ] + } + ], + "range": [ + 49, + 70 + ] + } + ], + "range": [ + 34, + 70 + ] + } + ], + "range": [ + 15, + 70 + ] + } + ], + "range": [ + 0, + 70 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 70 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 70 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 70, + 70 + ] + } + ], + "hasChanges": true, + "range": [ + 70, + 70 + ], + "number": 2 + } + ] + ], + "paths": [ + "if-else.js", + "if-else.js" + ], + "oids": [ + "1a55d0bd4e0f601787524953f62c0f621fd96702", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "if-else.js" + ], + "patch": [ + "diff --git a/if-else.js b/if-else.js", + "index 1a55d0b..e69de29 100644", + "--- a/if-else.js", + "+++ b/if-else.js", + "@@ -1 +0,0 @@", + "-if (g) h; else if (i) { j; } else if (k) l; else if (m) { n; } else o" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "168b06d356ffd180f13ad8f9c26fa0ed8adfc3eb..c32361c31b256ea32638cead8a9639d9d3bb55d4" +}] diff --git a/test/corpus/json/javascript/if.json b/test/corpus/json/javascript/if.json new file mode 100644 index 000000000..8dcfac301 --- /dev/null +++ b/test/corpus/json/javascript/if.json @@ -0,0 +1,2718 @@ +[{ + "testCaseDescription": "javascript-if-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 9, + 15 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 7, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 19, + 19 + ], + "number": 2 + } + ] + ], + "paths": [ + "if.js", + "if.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "52d4b4f029e49c6d3fe0b70fffb8fd7e372b159d" + ] + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index e69de29..52d4b4f 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -0,0 +1 @@", + "+if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1414e435bed741828bc662b2617b65f006198115..f925589600daebd1c530948026f8ca735c3d2295" +} +,{ + "testCaseDescription": "javascript-if-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 4, + 7 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 11, + 17 + ] + } + ], + "range": [ + 11, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 9, + 23 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 39 + ] + } + ], + "range": [ + 33, + 40 + ] + } + ], + "range": [ + 31, + 42 + ] + } + ], + "patch": "insert", + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 24, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 43 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 9, + 15 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 7, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 19 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 55 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 57 + ] + } + ], + "range": [ + 52, + 58 + ] + } + ], + "range": [ + 52, + 59 + ] + } + ], + "range": [ + 50, + 61 + ] + } + ], + "range": [ + 43, + 61 + ] + } + ], + "range": [ + 43, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 62 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + } + ] + ], + "paths": [ + "if.js", + "if.js" + ], + "oids": [ + "52d4b4f029e49c6d3fe0b70fffb8fd7e372b159d", + "ae4ee3281f01d0b2140f61a307913f9d2a58ef60" + ] + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index 52d4b4f..ae4ee32 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1 +1,3 @@", + "+if (a.b) { log(c); d; }", + "+if (x) { log(y); }", + " if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f925589600daebd1c530948026f8ca735c3d2295..953b51e76de53d368e5aaeedb84b46cec9e2ac83" +} +,{ + "testCaseDescription": "javascript-if-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 4, + 7 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 11, + 17 + ] + } + ], + "range": [ + 11, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 9, + 23 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 9, + 15 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 7, + 18 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 39 + ] + } + ], + "range": [ + 33, + 40 + ] + } + ], + "range": [ + 31, + 42 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 24, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 43 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 28, + 34 + ] + } + ], + "range": [ + 28, + 35 + ] + } + ], + "range": [ + 26, + 37 + ] + } + ], + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 55 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 57 + ] + } + ], + "range": [ + 52, + 58 + ] + } + ], + "range": [ + 52, + 59 + ] + } + ], + "range": [ + 50, + 61 + ] + } + ], + "range": [ + 43, + 61 + ] + } + ], + "range": [ + 43, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 62 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + } + ], + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 47, + 54 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + } + ] + ], + "paths": [ + "if.js", + "if.js" + ], + "oids": [ + "ae4ee3281f01d0b2140f61a307913f9d2a58ef60", + "df55832d41035a032304fc955c0e431962b04cb5" + ] + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index ae4ee32..df55832 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,3 +1,3 @@", + "-if (a.b) { log(c); d; }", + "+if (x) { log(y); }", + " if (x) { log(y); }", + " if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "953b51e76de53d368e5aaeedb84b46cec9e2ac83..bed63a4361da46793cece7c3f1370d78fd311348" +} +,{ + "testCaseDescription": "javascript-if-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 9, + 15 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 7, + 18 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 4, + 7 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 11, + 17 + ] + } + ], + "range": [ + 11, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 9, + 23 + ] + } + ], + "patch": "replace", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 31 + ] + }, + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 28, + 34 + ] + } + ], + "range": [ + 28, + 35 + ] + } + ], + "range": [ + 26, + 37 + ] + } + ], + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 38 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 39 + ] + } + ], + "range": [ + 33, + 40 + ] + } + ], + "range": [ + 31, + 42 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 24, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 43 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 52 + ] + } + ], + "range": [ + 47, + 53 + ] + } + ], + "range": [ + 47, + 54 + ] + } + ], + "range": [ + 45, + 56 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 55 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 57 + ] + } + ], + "range": [ + 52, + 58 + ] + } + ], + "range": [ + 52, + 59 + ] + } + ], + "range": [ + 50, + 61 + ] + } + ], + "range": [ + 43, + 61 + ] + } + ], + "range": [ + 43, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 62 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + } + ] + ], + "paths": [ + "if.js", + "if.js" + ], + "oids": [ + "df55832d41035a032304fc955c0e431962b04cb5", + "ae4ee3281f01d0b2140f61a307913f9d2a58ef60" + ] + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index df55832..ae4ee32 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,3 +1,3 @@", + "-if (x) { log(y); }", + "+if (a.b) { log(c); d; }", + " if (x) { log(y); }", + " if (x) { log(y); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "bed63a4361da46793cece7c3f1370d78fd311348..1d1e851c9148d9e8b3e8d6d7ff8e46412e33b7f5" +} +,{ + "testCaseDescription": "javascript-if-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 4, + 7 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 11, + 17 + ] + } + ], + "range": [ + 11, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 9, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 39 + ] + } + ], + "range": [ + 33, + 40 + ] + } + ], + "range": [ + 31, + 42 + ] + } + ], + "patch": "delete", + "range": [ + 24, + 42 + ] + } + ], + "range": [ + 24, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 43 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 55 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 57 + ] + } + ], + "range": [ + 52, + 58 + ] + } + ], + "range": [ + 52, + 59 + ] + } + ], + "range": [ + 50, + 61 + ] + } + ], + "range": [ + 43, + 61 + ] + } + ], + "range": [ + 43, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 62 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 9, + 15 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 7, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 23, + 26 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 36 + ] + } + ], + "range": [ + 30, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + } + ], + "range": [ + 38, + 40 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "patch": "insert", + "range": [ + 19, + 42 + ] + } + ], + "range": [ + 19, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 19, + 43 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 62, + 62 + ] + } + ], + "hasChanges": false, + "range": [ + 62, + 62 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 43, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 43 + ], + "number": 3 + } + ] + ], + "paths": [ + "if.js", + "if.js" + ], + "oids": [ + "ae4ee3281f01d0b2140f61a307913f9d2a58ef60", + "38b83efe7795ac278ad6f742950f313cf761c71e" + ] + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index ae4ee32..38b83ef 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,3 +1,2 @@", + "-if (a.b) { log(c); d; }", + "-if (x) { log(y); }", + " if (x) { log(y); }", + "+if (a.b) { log(c); d; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1d1e851c9148d9e8b3e8d6d7ff8e46412e33b7f5..bfee3fdff9441afb2bfac9650139f2fe3517d1fb" +} +,{ + "testCaseDescription": "javascript-if-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 9, + 15 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 7, + 18 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 23, + 26 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 30, + 36 + ] + } + ], + "range": [ + 30, + 37 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + } + ], + "range": [ + 38, + 40 + ] + } + ], + "range": [ + 28, + 42 + ] + } + ], + "range": [ + 19, + 42 + ] + } + ], + "range": [ + 19, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 43 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 4, + 7 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 11, + 17 + ] + } + ], + "range": [ + 11, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 9, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 43, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 43 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 2 + } + ] + ], + "paths": [ + "if.js", + "if.js" + ], + "oids": [ + "38b83efe7795ac278ad6f742950f313cf761c71e", + "f67163bb3b414d4f572ccb103f91d3722899787f" + ] + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index 38b83ef..f67163b 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1,2 +1 @@", + "-if (x) { log(y); }", + " if (a.b) { log(c); d; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "bfee3fdff9441afb2bfac9650139f2fe3517d1fb..199fb9c9073c557c909722b9586409dc8ca619d7" +} +,{ + "testCaseDescription": "javascript-if-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "If", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 4, + 7 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 14 + ] + }, + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 11, + 17 + ] + } + ], + "range": [ + 11, + 18 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 9, + 23 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 24 + ], + "number": 2 + } + ] + ], + "paths": [ + "if.js", + "if.js" + ], + "oids": [ + "f67163bb3b414d4f572ccb103f91d3722899787f", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "if.js" + ], + "patch": [ + "diff --git a/if.js b/if.js", + "index f67163b..e69de29 100644", + "--- a/if.js", + "+++ b/if.js", + "@@ -1 +0,0 @@", + "-if (a.b) { log(c); d; }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "199fb9c9073c557c909722b9586409dc8ca619d7..a7c68af9b8e2a95ea64781f7701d616d9831d54b" +}] diff --git a/test/corpus/json/javascript/import.json b/test/corpus/json/javascript/import.json new file mode 100644 index 000000000..377430ef4 --- /dev/null +++ b/test/corpus/json/javascript/import.json @@ -0,0 +1,13798 @@ +[{ + "testCaseDescription": "javascript-import-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 49 + ] + } + ], + "range": [ + 40, + 49 + ] + }, + { + "category": "StringLiteral", + "range": [ + 55, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "patch": "insert", + "range": [ + 33, + 67 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 74, + 84 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 95 + ] + } + ], + "range": [ + 67, + 96 + ] + } + ], + "patch": "insert", + "range": [ + 67, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 67, + 97 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 113 + ] + } + ], + "range": [ + 106, + 113 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 104, + 125 + ] + }, + { + "category": "StringLiteral", + "range": [ + 131, + 141 + ] + } + ], + "range": [ + 97, + 142 + ] + } + ], + "patch": "insert", + "range": [ + 97, + 143 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 143 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 152, + 159 + ] + } + ], + "range": [ + 152, + 159 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 162, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 173, + 179 + ] + } + ], + "range": [ + 162, + 179 + ] + } + ], + "range": [ + 150, + 181 + ] + }, + { + "category": "StringLiteral", + "range": [ + 187, + 198 + ] + } + ], + "range": [ + 143, + 199 + ] + } + ], + "patch": "insert", + "range": [ + 143, + 200 + ] + } + ], + "hasChanges": true, + "range": [ + 143, + 200 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 220 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 224, + 231 + ] + } + ], + "range": [ + 224, + 231 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 233, + 240 + ] + }, + { + "category": "Identifier", + "range": [ + 244, + 250 + ] + } + ], + "range": [ + 233, + 250 + ] + } + ], + "range": [ + 222, + 252 + ] + }, + { + "category": "StringLiteral", + "range": [ + 258, + 268 + ] + } + ], + "range": [ + 200, + 269 + ] + } + ], + "patch": "insert", + "range": [ + 200, + 270 + ] + } + ], + "hasChanges": true, + "range": [ + 200, + 270 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 277, + 290 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 297, + 301 + ] + } + ], + "range": [ + 292, + 301 + ] + }, + { + "category": "StringLiteral", + "range": [ + 307, + 318 + ] + } + ], + "range": [ + 270, + 319 + ] + } + ], + "patch": "insert", + "range": [ + 270, + 320 + ] + } + ], + "hasChanges": true, + "range": [ + 270, + 320 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 327, + 340 + ] + } + ], + "range": [ + 320, + 341 + ] + } + ], + "patch": "insert", + "range": [ + 320, + 342 + ] + } + ], + "hasChanges": true, + "range": [ + 320, + 342 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 342, + 342 + ] + } + ], + "hasChanges": true, + "range": [ + 342, + 342 + ], + "number": 9 + } + ] + ], + "paths": [ + "import.js", + "import.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "491cb15d5f76cfc1be1bf5193ff0580369faaf5c" + ] + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index e69de29..491cb15 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -0,0 +1,8 @@", + "+import defaultMember from \"foo\";", + "+import * as name from \"aardvark\";", + "+import { member } from \"ant\";", + "+import { member1 , member2 } from \"antelope\";", + "+import { member1 , member2 as alias2 } from \"ant-eater\";", + "+import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "+import defaultMember, * as name from \"alligator\";", + "+import \"arctic-tern\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "81a41e72cb6728374f1f2c700f5656622f0966ec..7797a9819842490dcdc548a3dae02898cd7b1939" +} +,{ + "testCaseDescription": "javascript-import-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 36 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 45, + 59 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "patch": "insert", + "range": [ + 38, + 74 + ] + } + ], + "range": [ + 38, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 75 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 82, + 93 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + } + ], + "patch": "insert", + "range": [ + 75, + 108 + ] + } + ], + "range": [ + 75, + 109 + ] + } + ], + "hasChanges": true, + "range": [ + 75, + 109 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 126 + ] + } + ], + "range": [ + 118, + 126 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 116, + 139 + ] + }, + { + "category": "StringLiteral", + "range": [ + 145, + 157 + ] + } + ], + "patch": "insert", + "range": [ + 109, + 158 + ] + } + ], + "range": [ + 109, + 159 + ] + } + ], + "hasChanges": true, + "range": [ + 109, + 159 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 176 + ] + } + ], + "range": [ + 168, + 176 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 187 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 204 + ] + } + ], + "range": [ + 179, + 204 + ] + } + ], + "range": [ + 166, + 206 + ] + }, + { + "category": "StringLiteral", + "range": [ + 212, + 223 + ] + } + ], + "patch": "insert", + "range": [ + 159, + 224 + ] + } + ], + "range": [ + 159, + 225 + ] + } + ], + "hasChanges": true, + "range": [ + 159, + 225 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 232, + 245 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 249, + 257 + ] + } + ], + "range": [ + 249, + 257 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 259, + 267 + ] + }, + { + "category": "Identifier", + "range": [ + 271, + 284 + ] + } + ], + "range": [ + 259, + 284 + ] + } + ], + "range": [ + 247, + 286 + ] + }, + { + "category": "StringLiteral", + "range": [ + 292, + 301 + ] + } + ], + "patch": "insert", + "range": [ + 225, + 302 + ] + } + ], + "range": [ + 225, + 303 + ] + } + ], + "hasChanges": true, + "range": [ + 225, + 303 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 310, + 323 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 330, + 337 + ] + } + ], + "range": [ + 325, + 337 + ] + }, + { + "category": "StringLiteral", + "range": [ + 343, + 351 + ] + } + ], + "patch": "insert", + "range": [ + 303, + 352 + ] + } + ], + "range": [ + 303, + 353 + ] + } + ], + "hasChanges": true, + "range": [ + 303, + 353 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 360, + 370 + ] + } + ], + "patch": "insert", + "range": [ + 353, + 371 + ] + } + ], + "range": [ + 353, + 372 + ] + } + ], + "hasChanges": true, + "range": [ + 353, + 372 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 379, + 392 + ] + }, + { + "category": "StringLiteral", + "range": [ + 398, + 403 + ] + } + ], + "patch": "insert", + "range": [ + 372, + 404 + ] + } + ], + "range": [ + 372, + 405 + ] + } + ], + "hasChanges": true, + "range": [ + 372, + 405 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 417, + 421 + ] + } + ], + "range": [ + 412, + 421 + ] + }, + { + "category": "StringLiteral", + "range": [ + 427, + 437 + ] + } + ], + "patch": "insert", + "range": [ + 405, + 438 + ] + } + ], + "range": [ + 405, + 439 + ] + } + ], + "hasChanges": true, + "range": [ + 405, + 439 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 446, + 456 + ] + }, + { + "category": "StringLiteral", + "range": [ + 462, + 467 + ] + } + ], + "patch": "insert", + "range": [ + 439, + 468 + ] + } + ], + "range": [ + 439, + 469 + ] + } + ], + "hasChanges": true, + "range": [ + 439, + 469 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 478, + 485 + ] + } + ], + "range": [ + 478, + 485 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 476, + 497 + ] + }, + { + "category": "StringLiteral", + "range": [ + 503, + 513 + ] + } + ], + "patch": "insert", + "range": [ + 469, + 514 + ] + } + ], + "range": [ + 469, + 515 + ] + } + ], + "hasChanges": true, + "range": [ + 469, + 515 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 524, + 531 + ] + } + ], + "range": [ + 524, + 531 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 534, + 541 + ] + }, + { + "category": "Identifier", + "range": [ + 545, + 551 + ] + } + ], + "range": [ + 534, + 551 + ] + } + ], + "range": [ + 522, + 553 + ] + }, + { + "category": "StringLiteral", + "range": [ + 559, + 570 + ] + } + ], + "patch": "insert", + "range": [ + 515, + 571 + ] + } + ], + "range": [ + 515, + 572 + ] + } + ], + "hasChanges": true, + "range": [ + 515, + 572 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 579, + 592 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 596, + 603 + ] + } + ], + "range": [ + 596, + 603 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 605, + 612 + ] + }, + { + "category": "Identifier", + "range": [ + 616, + 622 + ] + } + ], + "range": [ + 605, + 622 + ] + } + ], + "range": [ + 594, + 624 + ] + }, + { + "category": "StringLiteral", + "range": [ + 630, + 640 + ] + } + ], + "patch": "insert", + "range": [ + 572, + 641 + ] + } + ], + "range": [ + 572, + 642 + ] + } + ], + "hasChanges": true, + "range": [ + 572, + 642 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 649, + 662 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 669, + 673 + ] + } + ], + "range": [ + 664, + 673 + ] + }, + { + "category": "StringLiteral", + "range": [ + 679, + 690 + ] + } + ], + "patch": "insert", + "range": [ + 642, + 691 + ] + } + ], + "range": [ + 642, + 692 + ] + } + ], + "hasChanges": true, + "range": [ + 642, + 692 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 699, + 712 + ] + } + ], + "patch": "insert", + "range": [ + 692, + 713 + ] + } + ], + "range": [ + 692, + 714 + ] + } + ], + "hasChanges": true, + "range": [ + 692, + 714 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 721, + 734 + ] + }, + { + "category": "StringLiteral", + "range": [ + 740, + 745 + ] + } + ], + "range": [ + 714, + 746 + ] + } + ], + "range": [ + 714, + 747 + ] + } + ], + "hasChanges": false, + "range": [ + 714, + 747 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 49 + ] + } + ], + "range": [ + 40, + 49 + ] + }, + { + "category": "StringLiteral", + "range": [ + 55, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "range": [ + 33, + 67 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 67 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 759, + 763 + ] + } + ], + "range": [ + 754, + 763 + ] + }, + { + "category": "StringLiteral", + "range": [ + 769, + 779 + ] + } + ], + "range": [ + 747, + 780 + ] + } + ], + "range": [ + 747, + 781 + ] + } + ], + "hasChanges": false, + "range": [ + 747, + 781 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 74, + 84 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 95 + ] + } + ], + "range": [ + 67, + 96 + ] + } + ], + "range": [ + 67, + 97 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 97 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 788, + 798 + ] + }, + { + "category": "StringLiteral", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 781, + 810 + ] + } + ], + "range": [ + 781, + 811 + ] + } + ], + "hasChanges": false, + "range": [ + 781, + 811 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 113 + ] + } + ], + "range": [ + 106, + 113 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 104, + 125 + ] + }, + { + "category": "StringLiteral", + "range": [ + 131, + 141 + ] + } + ], + "range": [ + 97, + 142 + ] + } + ], + "range": [ + 97, + 143 + ] + } + ], + "hasChanges": false, + "range": [ + 97, + 143 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 820, + 827 + ] + } + ], + "range": [ + 820, + 827 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 818, + 839 + ] + }, + { + "category": "StringLiteral", + "range": [ + 845, + 855 + ] + } + ], + "range": [ + 811, + 856 + ] + } + ], + "range": [ + 811, + 857 + ] + } + ], + "hasChanges": false, + "range": [ + 811, + 857 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 152, + 159 + ] + } + ], + "range": [ + 152, + 159 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 162, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 173, + 179 + ] + } + ], + "range": [ + 162, + 179 + ] + } + ], + "range": [ + 150, + 181 + ] + }, + { + "category": "StringLiteral", + "range": [ + 187, + 198 + ] + } + ], + "range": [ + 143, + 199 + ] + } + ], + "range": [ + 143, + 200 + ] + } + ], + "hasChanges": false, + "range": [ + 143, + 200 + ], + "number": 5 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 866, + 873 + ] + } + ], + "range": [ + 866, + 873 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 883 + ] + }, + { + "category": "Identifier", + "range": [ + 887, + 893 + ] + } + ], + "range": [ + 876, + 893 + ] + } + ], + "range": [ + 864, + 895 + ] + }, + { + "category": "StringLiteral", + "range": [ + 901, + 912 + ] + } + ], + "range": [ + 857, + 913 + ] + } + ], + "range": [ + 857, + 914 + ] + } + ], + "hasChanges": false, + "range": [ + 857, + 914 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 220 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 224, + 231 + ] + } + ], + "range": [ + 224, + 231 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 233, + 240 + ] + }, + { + "category": "Identifier", + "range": [ + 244, + 250 + ] + } + ], + "range": [ + 233, + 250 + ] + } + ], + "range": [ + 222, + 252 + ] + }, + { + "category": "StringLiteral", + "range": [ + 258, + 268 + ] + } + ], + "range": [ + 200, + 269 + ] + } + ], + "range": [ + 200, + 270 + ] + } + ], + "hasChanges": false, + "range": [ + 200, + 270 + ], + "number": 6 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 921, + 934 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 938, + 945 + ] + } + ], + "range": [ + 938, + 945 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 947, + 954 + ] + }, + { + "category": "Identifier", + "range": [ + 958, + 964 + ] + } + ], + "range": [ + 947, + 964 + ] + } + ], + "range": [ + 936, + 966 + ] + }, + { + "category": "StringLiteral", + "range": [ + 972, + 982 + ] + } + ], + "range": [ + 914, + 983 + ] + } + ], + "range": [ + 914, + 984 + ] + } + ], + "hasChanges": false, + "range": [ + 914, + 984 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 277, + 290 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 297, + 301 + ] + } + ], + "range": [ + 292, + 301 + ] + }, + { + "category": "StringLiteral", + "range": [ + 307, + 318 + ] + } + ], + "range": [ + 270, + 319 + ] + } + ], + "range": [ + 270, + 320 + ] + } + ], + "hasChanges": false, + "range": [ + 270, + 320 + ], + "number": 7 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 991, + 1004 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1015 + ] + } + ], + "range": [ + 1006, + 1015 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1021, + 1032 + ] + } + ], + "range": [ + 984, + 1033 + ] + } + ], + "range": [ + 984, + 1034 + ] + } + ], + "hasChanges": false, + "range": [ + 984, + 1034 + ], + "number": 23 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 327, + 340 + ] + } + ], + "range": [ + 320, + 341 + ] + } + ], + "range": [ + 320, + 342 + ] + } + ], + "hasChanges": false, + "range": [ + 320, + 342 + ], + "number": 8 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1041, + 1054 + ] + } + ], + "range": [ + 1034, + 1055 + ] + } + ], + "range": [ + 1034, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1034, + 1056 + ], + "number": 24 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 342, + 342 + ] + } + ], + "hasChanges": false, + "range": [ + 342, + 342 + ], + "number": 9 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1056, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1056, + 1056 + ], + "number": 25 + } + ] + ], + "paths": [ + "import.js", + "import.js" + ], + "oids": [ + "491cb15d5f76cfc1be1bf5193ff0580369faaf5c", + "045c536ef6c74be91ba31c1dd47f8cb5c92a19b2" + ] + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 491cb15..045c536 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,3 +1,19 @@", + "+import defaultMember from \"babirusa\";", + "+import * as otherName from \"baboon\";", + "+import { element } from \"badger\";", + "+import { element1 , element2 } from \"bald-eagle\";", + "+import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "+import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "+import defaultMember, * as element from \"barbet\";", + "+import \"basilisk\";", + "+import defaultMember from \"foo\";", + "+import * as name from \"aardvark\";", + "+import { member } from \"ant\";", + "+import { member1 , member2 } from \"antelope\";", + "+import { member1 , member2 as alias2 } from \"ant-eater\";", + "+import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "+import defaultMember, * as name from \"alligator\";", + "+import \"arctic-tern\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7797a9819842490dcdc548a3dae02898cd7b1939..4f93e4a12682c20523777c8ff21c23637b93b2c3" +} +,{ + "testCaseDescription": "javascript-import-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 26, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 45, + 59 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 38, + 74 + ] + } + ], + "range": [ + 38, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 75 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 45, + 49 + ] + } + ], + "range": [ + 40, + 49 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 55, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "range": [ + 33, + 67 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 74, + 84 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 95 + ] + } + ], + "patch": "insert", + "range": [ + 67, + 96 + ] + } + ], + "range": [ + 67, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 67, + 97 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 113 + ] + } + ], + "range": [ + 106, + 113 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 104, + 125 + ] + }, + { + "category": "StringLiteral", + "range": [ + 131, + 141 + ] + } + ], + "patch": "insert", + "range": [ + 97, + 142 + ] + } + ], + "range": [ + 97, + 143 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 143 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 152, + 159 + ] + } + ], + "range": [ + 152, + 159 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 162, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 173, + 179 + ] + } + ], + "range": [ + 162, + 179 + ] + } + ], + "range": [ + 150, + 181 + ] + }, + { + "category": "StringLiteral", + "range": [ + 187, + 198 + ] + } + ], + "patch": "insert", + "range": [ + 143, + 199 + ] + } + ], + "range": [ + 143, + 200 + ] + } + ], + "hasChanges": true, + "range": [ + 143, + 200 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 220 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 224, + 231 + ] + } + ], + "range": [ + 224, + 231 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 233, + 240 + ] + }, + { + "category": "Identifier", + "range": [ + 244, + 250 + ] + } + ], + "range": [ + 233, + 250 + ] + } + ], + "range": [ + 222, + 252 + ] + }, + { + "category": "StringLiteral", + "range": [ + 258, + 268 + ] + } + ], + "patch": "insert", + "range": [ + 200, + 269 + ] + } + ], + "range": [ + 200, + 270 + ] + } + ], + "hasChanges": true, + "range": [ + 200, + 270 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 82, + 93 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + } + ], + "patch": "replace", + "range": [ + 75, + 108 + ] + } + ], + "range": [ + 75, + 109 + ] + } + ], + "hasChanges": true, + "range": [ + 75, + 109 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 277, + 290 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 297, + 301 + ] + } + ], + "range": [ + 292, + 301 + ] + }, + { + "category": "StringLiteral", + "range": [ + 307, + 318 + ] + } + ], + "patch": "replace", + "range": [ + 270, + 319 + ] + } + ], + "range": [ + 270, + 320 + ] + } + ], + "hasChanges": true, + "range": [ + 270, + 320 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 126 + ] + } + ], + "range": [ + 118, + 126 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 116, + 139 + ] + }, + { + "category": "StringLiteral", + "range": [ + 145, + 157 + ] + } + ], + "patch": "delete", + "range": [ + 109, + 158 + ] + } + ], + "range": [ + 109, + 159 + ] + } + ], + "hasChanges": true, + "range": [ + 109, + 159 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 176 + ] + } + ], + "range": [ + 168, + 176 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 187 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 204 + ] + } + ], + "range": [ + 179, + 204 + ] + } + ], + "range": [ + 166, + 206 + ] + }, + { + "category": "StringLiteral", + "range": [ + 212, + 223 + ] + } + ], + "patch": "delete", + "range": [ + 159, + 224 + ] + } + ], + "range": [ + 159, + 225 + ] + } + ], + "hasChanges": true, + "range": [ + 159, + 225 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 232, + 245 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 249, + 257 + ] + } + ], + "range": [ + 249, + 257 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 259, + 267 + ] + }, + { + "category": "Identifier", + "range": [ + 271, + 284 + ] + } + ], + "range": [ + 259, + 284 + ] + } + ], + "range": [ + 247, + 286 + ] + }, + { + "category": "StringLiteral", + "range": [ + 292, + 301 + ] + } + ], + "patch": "delete", + "range": [ + 225, + 302 + ] + } + ], + "range": [ + 225, + 303 + ] + } + ], + "hasChanges": true, + "range": [ + 225, + 303 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 310, + 323 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 330, + 337 + ] + } + ], + "range": [ + 325, + 337 + ] + }, + { + "category": "StringLiteral", + "range": [ + 343, + 351 + ] + } + ], + "patch": "delete", + "range": [ + 303, + 352 + ] + } + ], + "range": [ + 303, + 353 + ] + } + ], + "hasChanges": true, + "range": [ + 303, + 353 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 360, + 370 + ] + } + ], + "patch": "delete", + "range": [ + 353, + 371 + ] + } + ], + "range": [ + 353, + 372 + ] + } + ], + "hasChanges": true, + "range": [ + 353, + 372 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 327, + 340 + ] + } + ], + "patch": "insert", + "range": [ + 320, + 341 + ] + } + ], + "range": [ + 320, + 342 + ] + } + ], + "hasChanges": true, + "range": [ + 320, + 342 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 379, + 392 + ] + }, + { + "category": "StringLiteral", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 372, + 404 + ] + } + ], + "range": [ + 372, + 405 + ] + } + ], + "hasChanges": false, + "range": [ + 372, + 405 + ], + "number": 9 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 349, + 362 + ] + }, + { + "category": "StringLiteral", + "range": [ + 368, + 373 + ] + } + ], + "range": [ + 342, + 374 + ] + } + ], + "range": [ + 342, + 375 + ] + } + ], + "hasChanges": false, + "range": [ + 342, + 375 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 417, + 421 + ] + } + ], + "range": [ + 412, + 421 + ] + }, + { + "category": "StringLiteral", + "range": [ + 427, + 437 + ] + } + ], + "range": [ + 405, + 438 + ] + } + ], + "range": [ + 405, + 439 + ] + } + ], + "hasChanges": false, + "range": [ + 405, + 439 + ], + "number": 10 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 391 + ] + } + ], + "range": [ + 382, + 391 + ] + }, + { + "category": "StringLiteral", + "range": [ + 397, + 407 + ] + } + ], + "range": [ + 375, + 408 + ] + } + ], + "range": [ + 375, + 409 + ] + } + ], + "hasChanges": false, + "range": [ + 375, + 409 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 446, + 456 + ] + }, + { + "category": "StringLiteral", + "range": [ + 462, + 467 + ] + } + ], + "range": [ + 439, + 468 + ] + } + ], + "range": [ + 439, + 469 + ] + } + ], + "hasChanges": false, + "range": [ + 439, + 469 + ], + "number": 11 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 418, + 424 + ] + } + ], + "range": [ + 418, + 424 + ] + } + ], + "range": [ + 416, + 426 + ] + }, + { + "category": "StringLiteral", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 409, + 438 + ] + } + ], + "range": [ + 409, + 439 + ] + } + ], + "hasChanges": false, + "range": [ + 409, + 439 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 478, + 485 + ] + } + ], + "range": [ + 478, + 485 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 476, + 497 + ] + }, + { + "category": "StringLiteral", + "range": [ + 503, + 513 + ] + } + ], + "range": [ + 469, + 514 + ] + } + ], + "range": [ + 469, + 515 + ] + } + ], + "hasChanges": false, + "range": [ + 469, + 515 + ], + "number": 12 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 448, + 455 + ] + } + ], + "range": [ + 448, + 455 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 458, + 465 + ] + } + ], + "range": [ + 458, + 465 + ] + } + ], + "range": [ + 446, + 467 + ] + }, + { + "category": "StringLiteral", + "range": [ + 473, + 483 + ] + } + ], + "range": [ + 439, + 484 + ] + } + ], + "range": [ + 439, + 485 + ] + } + ], + "hasChanges": false, + "range": [ + 439, + 485 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 524, + 531 + ] + } + ], + "range": [ + 524, + 531 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 534, + 541 + ] + }, + { + "category": "Identifier", + "range": [ + 545, + 551 + ] + } + ], + "range": [ + 534, + 551 + ] + } + ], + "range": [ + 522, + 553 + ] + }, + { + "category": "StringLiteral", + "range": [ + 559, + 570 + ] + } + ], + "range": [ + 515, + 571 + ] + } + ], + "range": [ + 515, + 572 + ] + } + ], + "hasChanges": false, + "range": [ + 515, + 572 + ], + "number": 13 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 494, + 501 + ] + } + ], + "range": [ + 494, + 501 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 504, + 511 + ] + }, + { + "category": "Identifier", + "range": [ + 515, + 521 + ] + } + ], + "range": [ + 504, + 521 + ] + } + ], + "range": [ + 492, + 523 + ] + }, + { + "category": "StringLiteral", + "range": [ + 529, + 540 + ] + } + ], + "range": [ + 485, + 541 + ] + } + ], + "range": [ + 485, + 542 + ] + } + ], + "hasChanges": false, + "range": [ + 485, + 542 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 579, + 592 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 596, + 603 + ] + } + ], + "range": [ + 596, + 603 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 605, + 612 + ] + }, + { + "category": "Identifier", + "range": [ + 616, + 622 + ] + } + ], + "range": [ + 605, + 622 + ] + } + ], + "range": [ + 594, + 624 + ] + }, + { + "category": "StringLiteral", + "range": [ + 630, + 640 + ] + } + ], + "range": [ + 572, + 641 + ] + } + ], + "range": [ + 572, + 642 + ] + } + ], + "hasChanges": false, + "range": [ + 572, + 642 + ], + "number": 14 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 549, + 562 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 566, + 573 + ] + } + ], + "range": [ + 566, + 573 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 575, + 582 + ] + }, + { + "category": "Identifier", + "range": [ + 586, + 592 + ] + } + ], + "range": [ + 575, + 592 + ] + } + ], + "range": [ + 564, + 594 + ] + }, + { + "category": "StringLiteral", + "range": [ + 600, + 610 + ] + } + ], + "range": [ + 542, + 611 + ] + } + ], + "range": [ + 542, + 612 + ] + } + ], + "hasChanges": false, + "range": [ + 542, + 612 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 649, + 662 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 669, + 673 + ] + } + ], + "range": [ + 664, + 673 + ] + }, + { + "category": "StringLiteral", + "range": [ + 679, + 690 + ] + } + ], + "range": [ + 642, + 691 + ] + } + ], + "range": [ + 642, + 692 + ] + } + ], + "hasChanges": false, + "range": [ + 642, + 692 + ], + "number": 15 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 619, + 632 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 639, + 643 + ] + } + ], + "range": [ + 634, + 643 + ] + }, + { + "category": "StringLiteral", + "range": [ + 649, + 660 + ] + } + ], + "range": [ + 612, + 661 + ] + } + ], + "range": [ + 612, + 662 + ] + } + ], + "hasChanges": false, + "range": [ + 612, + 662 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 699, + 712 + ] + } + ], + "range": [ + 692, + 713 + ] + } + ], + "range": [ + 692, + 714 + ] + } + ], + "hasChanges": false, + "range": [ + 692, + 714 + ], + "number": 16 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 669, + 682 + ] + } + ], + "range": [ + 662, + 683 + ] + } + ], + "range": [ + 662, + 684 + ] + } + ], + "hasChanges": false, + "range": [ + 662, + 684 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 721, + 734 + ] + }, + { + "category": "StringLiteral", + "range": [ + 740, + 745 + ] + } + ], + "range": [ + 714, + 746 + ] + } + ], + "range": [ + 714, + 747 + ] + } + ], + "hasChanges": false, + "range": [ + 714, + 747 + ], + "number": 17 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 691, + 704 + ] + }, + { + "category": "StringLiteral", + "range": [ + 710, + 715 + ] + } + ], + "range": [ + 684, + 716 + ] + } + ], + "range": [ + 684, + 717 + ] + } + ], + "hasChanges": false, + "range": [ + 684, + 717 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 759, + 763 + ] + } + ], + "range": [ + 754, + 763 + ] + }, + { + "category": "StringLiteral", + "range": [ + 769, + 779 + ] + } + ], + "range": [ + 747, + 780 + ] + } + ], + "range": [ + 747, + 781 + ] + } + ], + "hasChanges": false, + "range": [ + 747, + 781 + ], + "number": 18 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 729, + 733 + ] + } + ], + "range": [ + 724, + 733 + ] + }, + { + "category": "StringLiteral", + "range": [ + 739, + 749 + ] + } + ], + "range": [ + 717, + 750 + ] + } + ], + "range": [ + 717, + 751 + ] + } + ], + "hasChanges": false, + "range": [ + 717, + 751 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 788, + 798 + ] + }, + { + "category": "StringLiteral", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 781, + 810 + ] + } + ], + "range": [ + 781, + 811 + ] + } + ], + "hasChanges": false, + "range": [ + 781, + 811 + ], + "number": 19 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 760, + 766 + ] + } + ], + "range": [ + 760, + 766 + ] + } + ], + "range": [ + 758, + 768 + ] + }, + { + "category": "StringLiteral", + "range": [ + 774, + 779 + ] + } + ], + "range": [ + 751, + 780 + ] + } + ], + "range": [ + 751, + 781 + ] + } + ], + "hasChanges": false, + "range": [ + 751, + 781 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 820, + 827 + ] + } + ], + "range": [ + 820, + 827 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 818, + 839 + ] + }, + { + "category": "StringLiteral", + "range": [ + 845, + 855 + ] + } + ], + "range": [ + 811, + 856 + ] + } + ], + "range": [ + 811, + 857 + ] + } + ], + "hasChanges": false, + "range": [ + 811, + 857 + ], + "number": 20 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 790, + 797 + ] + } + ], + "range": [ + 790, + 797 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 800, + 807 + ] + } + ], + "range": [ + 800, + 807 + ] + } + ], + "range": [ + 788, + 809 + ] + }, + { + "category": "StringLiteral", + "range": [ + 815, + 825 + ] + } + ], + "range": [ + 781, + 826 + ] + } + ], + "range": [ + 781, + 827 + ] + } + ], + "hasChanges": false, + "range": [ + 781, + 827 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 866, + 873 + ] + } + ], + "range": [ + 866, + 873 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 883 + ] + }, + { + "category": "Identifier", + "range": [ + 887, + 893 + ] + } + ], + "range": [ + 876, + 893 + ] + } + ], + "range": [ + 864, + 895 + ] + }, + { + "category": "StringLiteral", + "range": [ + 901, + 912 + ] + } + ], + "range": [ + 857, + 913 + ] + } + ], + "range": [ + 857, + 914 + ] + } + ], + "hasChanges": false, + "range": [ + 857, + 914 + ], + "number": 21 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 836, + 843 + ] + } + ], + "range": [ + 836, + 843 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 846, + 853 + ] + }, + { + "category": "Identifier", + "range": [ + 857, + 863 + ] + } + ], + "range": [ + 846, + 863 + ] + } + ], + "range": [ + 834, + 865 + ] + }, + { + "category": "StringLiteral", + "range": [ + 871, + 882 + ] + } + ], + "range": [ + 827, + 883 + ] + } + ], + "range": [ + 827, + 884 + ] + } + ], + "hasChanges": false, + "range": [ + 827, + 884 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 921, + 934 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 938, + 945 + ] + } + ], + "range": [ + 938, + 945 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 947, + 954 + ] + }, + { + "category": "Identifier", + "range": [ + 958, + 964 + ] + } + ], + "range": [ + 947, + 964 + ] + } + ], + "range": [ + 936, + 966 + ] + }, + { + "category": "StringLiteral", + "range": [ + 972, + 982 + ] + } + ], + "range": [ + 914, + 983 + ] + } + ], + "range": [ + 914, + 984 + ] + } + ], + "hasChanges": false, + "range": [ + 914, + 984 + ], + "number": 22 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 891, + 904 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 908, + 915 + ] + } + ], + "range": [ + 908, + 915 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 917, + 924 + ] + }, + { + "category": "Identifier", + "range": [ + 928, + 934 + ] + } + ], + "range": [ + 917, + 934 + ] + } + ], + "range": [ + 906, + 936 + ] + }, + { + "category": "StringLiteral", + "range": [ + 942, + 952 + ] + } + ], + "range": [ + 884, + 953 + ] + } + ], + "range": [ + 884, + 954 + ] + } + ], + "hasChanges": false, + "range": [ + 884, + 954 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 991, + 1004 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1015 + ] + } + ], + "range": [ + 1006, + 1015 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1021, + 1032 + ] + } + ], + "range": [ + 984, + 1033 + ] + } + ], + "range": [ + 984, + 1034 + ] + } + ], + "hasChanges": false, + "range": [ + 984, + 1034 + ], + "number": 23 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 961, + 974 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 981, + 985 + ] + } + ], + "range": [ + 976, + 985 + ] + }, + { + "category": "StringLiteral", + "range": [ + 991, + 1002 + ] + } + ], + "range": [ + 954, + 1003 + ] + } + ], + "range": [ + 954, + 1004 + ] + } + ], + "hasChanges": false, + "range": [ + 954, + 1004 + ], + "number": 23 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1041, + 1054 + ] + } + ], + "range": [ + 1034, + 1055 + ] + } + ], + "range": [ + 1034, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1034, + 1056 + ], + "number": 24 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1011, + 1024 + ] + } + ], + "range": [ + 1004, + 1025 + ] + } + ], + "range": [ + 1004, + 1026 + ] + } + ], + "hasChanges": false, + "range": [ + 1004, + 1026 + ], + "number": 24 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1056, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1056, + 1056 + ], + "number": 25 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1026, + 1026 + ] + } + ], + "hasChanges": false, + "range": [ + 1026, + 1026 + ], + "number": 25 + } + ] + ], + "paths": [ + "import.js", + "import.js" + ], + "oids": [ + "045c536ef6c74be91ba31c1dd47f8cb5c92a19b2", + "cbad5a426013717f643717445d38e31452842a65" + ] + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 045c536..cbad5a4 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,11 +1,11 @@", + "-import defaultMember from \"babirusa\";", + "-import * as otherName from \"baboon\";", + "-import { element } from \"badger\";", + "-import { element1 , element2 } from \"bald-eagle\";", + "-import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "-import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "-import defaultMember, * as element from \"barbet\";", + "-import \"basilisk\";", + "+import defaultMember from \"foo\";", + "+import * as name from \"aardvark\";", + "+import { member } from \"ant\";", + "+import { member1 , member2 } from \"antelope\";", + "+import { member1 , member2 as alias2 } from \"ant-eater\";", + "+import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "+import defaultMember, * as name from \"alligator\";", + "+import \"arctic-tern\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4f93e4a12682c20523777c8ff21c23637b93b2c3..1a2c0ee4f2d6d47acc0e0b75adfd77412cdb5208" +} +,{ + "testCaseDescription": "javascript-import-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 26, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 45, + 49 + ] + } + ], + "range": [ + 40, + 49 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 55, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "range": [ + 33, + 67 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 67 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 45, + 59 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 38, + 74 + ] + } + ], + "range": [ + 38, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 75 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 82, + 93 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + } + ], + "patch": "insert", + "range": [ + 75, + 108 + ] + } + ], + "range": [ + 75, + 109 + ] + } + ], + "hasChanges": true, + "range": [ + 75, + 109 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 126 + ] + } + ], + "range": [ + 118, + 126 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 116, + 139 + ] + }, + { + "category": "StringLiteral", + "range": [ + 145, + 157 + ] + } + ], + "patch": "insert", + "range": [ + 109, + 158 + ] + } + ], + "range": [ + 109, + 159 + ] + } + ], + "hasChanges": true, + "range": [ + 109, + 159 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 176 + ] + } + ], + "range": [ + 168, + 176 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 187 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 204 + ] + } + ], + "range": [ + 179, + 204 + ] + } + ], + "range": [ + 166, + 206 + ] + }, + { + "category": "StringLiteral", + "range": [ + 212, + 223 + ] + } + ], + "patch": "insert", + "range": [ + 159, + 224 + ] + } + ], + "range": [ + 159, + 225 + ] + } + ], + "hasChanges": true, + "range": [ + 159, + 225 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 232, + 245 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 249, + 257 + ] + } + ], + "range": [ + 249, + 257 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 259, + 267 + ] + }, + { + "category": "Identifier", + "range": [ + 271, + 284 + ] + } + ], + "range": [ + 259, + 284 + ] + } + ], + "range": [ + 247, + 286 + ] + }, + { + "category": "StringLiteral", + "range": [ + 292, + 301 + ] + } + ], + "patch": "insert", + "range": [ + 225, + 302 + ] + } + ], + "range": [ + 225, + 303 + ] + } + ], + "hasChanges": true, + "range": [ + 225, + 303 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 74, + 84 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 95 + ] + } + ], + "patch": "replace", + "range": [ + 67, + 96 + ] + } + ], + "range": [ + 67, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 67, + 97 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 310, + 323 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 330, + 337 + ] + } + ], + "range": [ + 325, + 337 + ] + }, + { + "category": "StringLiteral", + "range": [ + 343, + 351 + ] + } + ], + "patch": "replace", + "range": [ + 303, + 352 + ] + } + ], + "range": [ + 303, + 353 + ] + } + ], + "hasChanges": true, + "range": [ + 303, + 353 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 113 + ] + } + ], + "range": [ + 106, + 113 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 104, + 125 + ] + }, + { + "category": "StringLiteral", + "range": [ + 131, + 141 + ] + } + ], + "patch": "delete", + "range": [ + 97, + 142 + ] + } + ], + "range": [ + 97, + 143 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 143 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 152, + 159 + ] + } + ], + "range": [ + 152, + 159 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 162, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 173, + 179 + ] + } + ], + "range": [ + 162, + 179 + ] + } + ], + "range": [ + 150, + 181 + ] + }, + { + "category": "StringLiteral", + "range": [ + 187, + 198 + ] + } + ], + "patch": "delete", + "range": [ + 143, + 199 + ] + } + ], + "range": [ + 143, + 200 + ] + } + ], + "hasChanges": true, + "range": [ + 143, + 200 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 220 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 224, + 231 + ] + } + ], + "range": [ + 224, + 231 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 233, + 240 + ] + }, + { + "category": "Identifier", + "range": [ + 244, + 250 + ] + } + ], + "range": [ + 233, + 250 + ] + } + ], + "range": [ + 222, + 252 + ] + }, + { + "category": "StringLiteral", + "range": [ + 258, + 268 + ] + } + ], + "patch": "delete", + "range": [ + 200, + 269 + ] + } + ], + "range": [ + 200, + 270 + ] + } + ], + "hasChanges": true, + "range": [ + 200, + 270 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 277, + 290 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 297, + 301 + ] + } + ], + "range": [ + 292, + 301 + ] + }, + { + "category": "StringLiteral", + "range": [ + 307, + 318 + ] + } + ], + "patch": "delete", + "range": [ + 270, + 319 + ] + } + ], + "range": [ + 270, + 320 + ] + } + ], + "hasChanges": true, + "range": [ + 270, + 320 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 327, + 340 + ] + } + ], + "patch": "delete", + "range": [ + 320, + 341 + ] + } + ], + "range": [ + 320, + 342 + ] + } + ], + "hasChanges": true, + "range": [ + 320, + 342 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 360, + 370 + ] + } + ], + "patch": "insert", + "range": [ + 353, + 371 + ] + } + ], + "range": [ + 353, + 372 + ] + } + ], + "hasChanges": true, + "range": [ + 353, + 372 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 349, + 362 + ] + }, + { + "category": "StringLiteral", + "range": [ + 368, + 373 + ] + } + ], + "range": [ + 342, + 374 + ] + } + ], + "range": [ + 342, + 375 + ] + } + ], + "hasChanges": false, + "range": [ + 342, + 375 + ], + "number": 9 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 379, + 392 + ] + }, + { + "category": "StringLiteral", + "range": [ + 398, + 403 + ] + } + ], + "range": [ + 372, + 404 + ] + } + ], + "range": [ + 372, + 405 + ] + } + ], + "hasChanges": false, + "range": [ + 372, + 405 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 387, + 391 + ] + } + ], + "range": [ + 382, + 391 + ] + }, + { + "category": "StringLiteral", + "range": [ + 397, + 407 + ] + } + ], + "range": [ + 375, + 408 + ] + } + ], + "range": [ + 375, + 409 + ] + } + ], + "hasChanges": false, + "range": [ + 375, + 409 + ], + "number": 10 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 417, + 421 + ] + } + ], + "range": [ + 412, + 421 + ] + }, + { + "category": "StringLiteral", + "range": [ + 427, + 437 + ] + } + ], + "range": [ + 405, + 438 + ] + } + ], + "range": [ + 405, + 439 + ] + } + ], + "hasChanges": false, + "range": [ + 405, + 439 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 418, + 424 + ] + } + ], + "range": [ + 418, + 424 + ] + } + ], + "range": [ + 416, + 426 + ] + }, + { + "category": "StringLiteral", + "range": [ + 432, + 437 + ] + } + ], + "range": [ + 409, + 438 + ] + } + ], + "range": [ + 409, + 439 + ] + } + ], + "hasChanges": false, + "range": [ + 409, + 439 + ], + "number": 11 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 446, + 456 + ] + }, + { + "category": "StringLiteral", + "range": [ + 462, + 467 + ] + } + ], + "range": [ + 439, + 468 + ] + } + ], + "range": [ + 439, + 469 + ] + } + ], + "hasChanges": false, + "range": [ + 439, + 469 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 448, + 455 + ] + } + ], + "range": [ + 448, + 455 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 458, + 465 + ] + } + ], + "range": [ + 458, + 465 + ] + } + ], + "range": [ + 446, + 467 + ] + }, + { + "category": "StringLiteral", + "range": [ + 473, + 483 + ] + } + ], + "range": [ + 439, + 484 + ] + } + ], + "range": [ + 439, + 485 + ] + } + ], + "hasChanges": false, + "range": [ + 439, + 485 + ], + "number": 12 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 478, + 485 + ] + } + ], + "range": [ + 478, + 485 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 476, + 497 + ] + }, + { + "category": "StringLiteral", + "range": [ + 503, + 513 + ] + } + ], + "range": [ + 469, + 514 + ] + } + ], + "range": [ + 469, + 515 + ] + } + ], + "hasChanges": false, + "range": [ + 469, + 515 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 494, + 501 + ] + } + ], + "range": [ + 494, + 501 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 504, + 511 + ] + }, + { + "category": "Identifier", + "range": [ + 515, + 521 + ] + } + ], + "range": [ + 504, + 521 + ] + } + ], + "range": [ + 492, + 523 + ] + }, + { + "category": "StringLiteral", + "range": [ + 529, + 540 + ] + } + ], + "range": [ + 485, + 541 + ] + } + ], + "range": [ + 485, + 542 + ] + } + ], + "hasChanges": false, + "range": [ + 485, + 542 + ], + "number": 13 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 524, + 531 + ] + } + ], + "range": [ + 524, + 531 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 534, + 541 + ] + }, + { + "category": "Identifier", + "range": [ + 545, + 551 + ] + } + ], + "range": [ + 534, + 551 + ] + } + ], + "range": [ + 522, + 553 + ] + }, + { + "category": "StringLiteral", + "range": [ + 559, + 570 + ] + } + ], + "range": [ + 515, + 571 + ] + } + ], + "range": [ + 515, + 572 + ] + } + ], + "hasChanges": false, + "range": [ + 515, + 572 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 549, + 562 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 566, + 573 + ] + } + ], + "range": [ + 566, + 573 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 575, + 582 + ] + }, + { + "category": "Identifier", + "range": [ + 586, + 592 + ] + } + ], + "range": [ + 575, + 592 + ] + } + ], + "range": [ + 564, + 594 + ] + }, + { + "category": "StringLiteral", + "range": [ + 600, + 610 + ] + } + ], + "range": [ + 542, + 611 + ] + } + ], + "range": [ + 542, + 612 + ] + } + ], + "hasChanges": false, + "range": [ + 542, + 612 + ], + "number": 14 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 579, + 592 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 596, + 603 + ] + } + ], + "range": [ + 596, + 603 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 605, + 612 + ] + }, + { + "category": "Identifier", + "range": [ + 616, + 622 + ] + } + ], + "range": [ + 605, + 622 + ] + } + ], + "range": [ + 594, + 624 + ] + }, + { + "category": "StringLiteral", + "range": [ + 630, + 640 + ] + } + ], + "range": [ + 572, + 641 + ] + } + ], + "range": [ + 572, + 642 + ] + } + ], + "hasChanges": false, + "range": [ + 572, + 642 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 619, + 632 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 639, + 643 + ] + } + ], + "range": [ + 634, + 643 + ] + }, + { + "category": "StringLiteral", + "range": [ + 649, + 660 + ] + } + ], + "range": [ + 612, + 661 + ] + } + ], + "range": [ + 612, + 662 + ] + } + ], + "hasChanges": false, + "range": [ + 612, + 662 + ], + "number": 15 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 649, + 662 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 669, + 673 + ] + } + ], + "range": [ + 664, + 673 + ] + }, + { + "category": "StringLiteral", + "range": [ + 679, + 690 + ] + } + ], + "range": [ + 642, + 691 + ] + } + ], + "range": [ + 642, + 692 + ] + } + ], + "hasChanges": false, + "range": [ + 642, + 692 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 669, + 682 + ] + } + ], + "range": [ + 662, + 683 + ] + } + ], + "range": [ + 662, + 684 + ] + } + ], + "hasChanges": false, + "range": [ + 662, + 684 + ], + "number": 16 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 699, + 712 + ] + } + ], + "range": [ + 692, + 713 + ] + } + ], + "range": [ + 692, + 714 + ] + } + ], + "hasChanges": false, + "range": [ + 692, + 714 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 691, + 704 + ] + }, + { + "category": "StringLiteral", + "range": [ + 710, + 715 + ] + } + ], + "range": [ + 684, + 716 + ] + } + ], + "range": [ + 684, + 717 + ] + } + ], + "hasChanges": false, + "range": [ + 684, + 717 + ], + "number": 17 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 721, + 734 + ] + }, + { + "category": "StringLiteral", + "range": [ + 740, + 745 + ] + } + ], + "range": [ + 714, + 746 + ] + } + ], + "range": [ + 714, + 747 + ] + } + ], + "hasChanges": false, + "range": [ + 714, + 747 + ], + "number": 17 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 729, + 733 + ] + } + ], + "range": [ + 724, + 733 + ] + }, + { + "category": "StringLiteral", + "range": [ + 739, + 749 + ] + } + ], + "range": [ + 717, + 750 + ] + } + ], + "range": [ + 717, + 751 + ] + } + ], + "hasChanges": false, + "range": [ + 717, + 751 + ], + "number": 18 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 759, + 763 + ] + } + ], + "range": [ + 754, + 763 + ] + }, + { + "category": "StringLiteral", + "range": [ + 769, + 779 + ] + } + ], + "range": [ + 747, + 780 + ] + } + ], + "range": [ + 747, + 781 + ] + } + ], + "hasChanges": false, + "range": [ + 747, + 781 + ], + "number": 18 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 760, + 766 + ] + } + ], + "range": [ + 760, + 766 + ] + } + ], + "range": [ + 758, + 768 + ] + }, + { + "category": "StringLiteral", + "range": [ + 774, + 779 + ] + } + ], + "range": [ + 751, + 780 + ] + } + ], + "range": [ + 751, + 781 + ] + } + ], + "hasChanges": false, + "range": [ + 751, + 781 + ], + "number": 19 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 788, + 798 + ] + }, + { + "category": "StringLiteral", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 781, + 810 + ] + } + ], + "range": [ + 781, + 811 + ] + } + ], + "hasChanges": false, + "range": [ + 781, + 811 + ], + "number": 19 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 790, + 797 + ] + } + ], + "range": [ + 790, + 797 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 800, + 807 + ] + } + ], + "range": [ + 800, + 807 + ] + } + ], + "range": [ + 788, + 809 + ] + }, + { + "category": "StringLiteral", + "range": [ + 815, + 825 + ] + } + ], + "range": [ + 781, + 826 + ] + } + ], + "range": [ + 781, + 827 + ] + } + ], + "hasChanges": false, + "range": [ + 781, + 827 + ], + "number": 20 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 820, + 827 + ] + } + ], + "range": [ + 820, + 827 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 818, + 839 + ] + }, + { + "category": "StringLiteral", + "range": [ + 845, + 855 + ] + } + ], + "range": [ + 811, + 856 + ] + } + ], + "range": [ + 811, + 857 + ] + } + ], + "hasChanges": false, + "range": [ + 811, + 857 + ], + "number": 20 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 836, + 843 + ] + } + ], + "range": [ + 836, + 843 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 846, + 853 + ] + }, + { + "category": "Identifier", + "range": [ + 857, + 863 + ] + } + ], + "range": [ + 846, + 863 + ] + } + ], + "range": [ + 834, + 865 + ] + }, + { + "category": "StringLiteral", + "range": [ + 871, + 882 + ] + } + ], + "range": [ + 827, + 883 + ] + } + ], + "range": [ + 827, + 884 + ] + } + ], + "hasChanges": false, + "range": [ + 827, + 884 + ], + "number": 21 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 866, + 873 + ] + } + ], + "range": [ + 866, + 873 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 883 + ] + }, + { + "category": "Identifier", + "range": [ + 887, + 893 + ] + } + ], + "range": [ + 876, + 893 + ] + } + ], + "range": [ + 864, + 895 + ] + }, + { + "category": "StringLiteral", + "range": [ + 901, + 912 + ] + } + ], + "range": [ + 857, + 913 + ] + } + ], + "range": [ + 857, + 914 + ] + } + ], + "hasChanges": false, + "range": [ + 857, + 914 + ], + "number": 21 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 891, + 904 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 908, + 915 + ] + } + ], + "range": [ + 908, + 915 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 917, + 924 + ] + }, + { + "category": "Identifier", + "range": [ + 928, + 934 + ] + } + ], + "range": [ + 917, + 934 + ] + } + ], + "range": [ + 906, + 936 + ] + }, + { + "category": "StringLiteral", + "range": [ + 942, + 952 + ] + } + ], + "range": [ + 884, + 953 + ] + } + ], + "range": [ + 884, + 954 + ] + } + ], + "hasChanges": false, + "range": [ + 884, + 954 + ], + "number": 22 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 921, + 934 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 938, + 945 + ] + } + ], + "range": [ + 938, + 945 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 947, + 954 + ] + }, + { + "category": "Identifier", + "range": [ + 958, + 964 + ] + } + ], + "range": [ + 947, + 964 + ] + } + ], + "range": [ + 936, + 966 + ] + }, + { + "category": "StringLiteral", + "range": [ + 972, + 982 + ] + } + ], + "range": [ + 914, + 983 + ] + } + ], + "range": [ + 914, + 984 + ] + } + ], + "hasChanges": false, + "range": [ + 914, + 984 + ], + "number": 22 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 961, + 974 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 981, + 985 + ] + } + ], + "range": [ + 976, + 985 + ] + }, + { + "category": "StringLiteral", + "range": [ + 991, + 1002 + ] + } + ], + "range": [ + 954, + 1003 + ] + } + ], + "range": [ + 954, + 1004 + ] + } + ], + "hasChanges": false, + "range": [ + 954, + 1004 + ], + "number": 23 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 991, + 1004 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1015 + ] + } + ], + "range": [ + 1006, + 1015 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1021, + 1032 + ] + } + ], + "range": [ + 984, + 1033 + ] + } + ], + "range": [ + 984, + 1034 + ] + } + ], + "hasChanges": false, + "range": [ + 984, + 1034 + ], + "number": 23 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1011, + 1024 + ] + } + ], + "range": [ + 1004, + 1025 + ] + } + ], + "range": [ + 1004, + 1026 + ] + } + ], + "hasChanges": false, + "range": [ + 1004, + 1026 + ], + "number": 24 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1041, + 1054 + ] + } + ], + "range": [ + 1034, + 1055 + ] + } + ], + "range": [ + 1034, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1034, + 1056 + ], + "number": 24 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1026, + 1026 + ] + } + ], + "hasChanges": false, + "range": [ + 1026, + 1026 + ], + "number": 25 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1056, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1056, + 1056 + ], + "number": 25 + } + ] + ], + "paths": [ + "import.js", + "import.js" + ], + "oids": [ + "cbad5a426013717f643717445d38e31452842a65", + "045c536ef6c74be91ba31c1dd47f8cb5c92a19b2" + ] + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index cbad5a4..045c536 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,11 +1,11 @@", + "-import defaultMember from \"foo\";", + "-import * as name from \"aardvark\";", + "-import { member } from \"ant\";", + "-import { member1 , member2 } from \"antelope\";", + "-import { member1 , member2 as alias2 } from \"ant-eater\";", + "-import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "-import defaultMember, * as name from \"alligator\";", + "-import \"arctic-tern\";", + "+import defaultMember from \"babirusa\";", + "+import * as otherName from \"baboon\";", + "+import { element } from \"badger\";", + "+import { element1 , element2 } from \"bald-eagle\";", + "+import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "+import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "+import defaultMember, * as element from \"barbet\";", + "+import \"basilisk\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1a2c0ee4f2d6d47acc0e0b75adfd77412cdb5208..9cee417f36dc72559f8005d43c1c64e38d14b260" +} +,{ + "testCaseDescription": "javascript-import-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 36 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 45, + 59 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "patch": "delete", + "range": [ + 38, + 74 + ] + } + ], + "range": [ + 38, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 75 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 82, + 93 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + } + ], + "patch": "delete", + "range": [ + 75, + 108 + ] + } + ], + "range": [ + 75, + 109 + ] + } + ], + "hasChanges": true, + "range": [ + 75, + 109 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 126 + ] + } + ], + "range": [ + 118, + 126 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 116, + 139 + ] + }, + { + "category": "StringLiteral", + "range": [ + 145, + 157 + ] + } + ], + "patch": "delete", + "range": [ + 109, + 158 + ] + } + ], + "range": [ + 109, + 159 + ] + } + ], + "hasChanges": true, + "range": [ + 109, + 159 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 176 + ] + } + ], + "range": [ + 168, + 176 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 187 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 204 + ] + } + ], + "range": [ + 179, + 204 + ] + } + ], + "range": [ + 166, + 206 + ] + }, + { + "category": "StringLiteral", + "range": [ + 212, + 223 + ] + } + ], + "patch": "delete", + "range": [ + 159, + 224 + ] + } + ], + "range": [ + 159, + 225 + ] + } + ], + "hasChanges": true, + "range": [ + 159, + 225 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 232, + 245 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 249, + 257 + ] + } + ], + "range": [ + 249, + 257 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 259, + 267 + ] + }, + { + "category": "Identifier", + "range": [ + 271, + 284 + ] + } + ], + "range": [ + 259, + 284 + ] + } + ], + "range": [ + 247, + 286 + ] + }, + { + "category": "StringLiteral", + "range": [ + 292, + 301 + ] + } + ], + "patch": "delete", + "range": [ + 225, + 302 + ] + } + ], + "range": [ + 225, + 303 + ] + } + ], + "hasChanges": true, + "range": [ + 225, + 303 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 310, + 323 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 330, + 337 + ] + } + ], + "range": [ + 325, + 337 + ] + }, + { + "category": "StringLiteral", + "range": [ + 343, + 351 + ] + } + ], + "patch": "delete", + "range": [ + 303, + 352 + ] + } + ], + "range": [ + 303, + 353 + ] + } + ], + "hasChanges": true, + "range": [ + 303, + 353 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 360, + 370 + ] + } + ], + "patch": "delete", + "range": [ + 353, + 371 + ] + } + ], + "range": [ + 353, + 372 + ] + } + ], + "hasChanges": true, + "range": [ + 353, + 372 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 379, + 392 + ] + }, + { + "category": "StringLiteral", + "range": [ + 398, + 403 + ] + } + ], + "patch": "delete", + "range": [ + 372, + 404 + ] + } + ], + "range": [ + 372, + 405 + ] + } + ], + "hasChanges": true, + "range": [ + 372, + 405 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 417, + 421 + ] + } + ], + "range": [ + 412, + 421 + ] + }, + { + "category": "StringLiteral", + "range": [ + 427, + 437 + ] + } + ], + "patch": "delete", + "range": [ + 405, + 438 + ] + } + ], + "range": [ + 405, + 439 + ] + } + ], + "hasChanges": true, + "range": [ + 405, + 439 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 448, + 454 + ] + } + ], + "range": [ + 446, + 456 + ] + }, + { + "category": "StringLiteral", + "range": [ + 462, + 467 + ] + } + ], + "patch": "delete", + "range": [ + 439, + 468 + ] + } + ], + "range": [ + 439, + 469 + ] + } + ], + "hasChanges": true, + "range": [ + 439, + 469 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 478, + 485 + ] + } + ], + "range": [ + 478, + 485 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 488, + 495 + ] + } + ], + "range": [ + 476, + 497 + ] + }, + { + "category": "StringLiteral", + "range": [ + 503, + 513 + ] + } + ], + "patch": "delete", + "range": [ + 469, + 514 + ] + } + ], + "range": [ + 469, + 515 + ] + } + ], + "hasChanges": true, + "range": [ + 469, + 515 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 524, + 531 + ] + } + ], + "range": [ + 524, + 531 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 534, + 541 + ] + }, + { + "category": "Identifier", + "range": [ + 545, + 551 + ] + } + ], + "range": [ + 534, + 551 + ] + } + ], + "range": [ + 522, + 553 + ] + }, + { + "category": "StringLiteral", + "range": [ + 559, + 570 + ] + } + ], + "patch": "delete", + "range": [ + 515, + 571 + ] + } + ], + "range": [ + 515, + 572 + ] + } + ], + "hasChanges": true, + "range": [ + 515, + 572 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 579, + 592 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 596, + 603 + ] + } + ], + "range": [ + 596, + 603 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 605, + 612 + ] + }, + { + "category": "Identifier", + "range": [ + 616, + 622 + ] + } + ], + "range": [ + 605, + 622 + ] + } + ], + "range": [ + 594, + 624 + ] + }, + { + "category": "StringLiteral", + "range": [ + 630, + 640 + ] + } + ], + "patch": "delete", + "range": [ + 572, + 641 + ] + } + ], + "range": [ + 572, + 642 + ] + } + ], + "hasChanges": true, + "range": [ + 572, + 642 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 649, + 662 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 669, + 673 + ] + } + ], + "range": [ + 664, + 673 + ] + }, + { + "category": "StringLiteral", + "range": [ + 679, + 690 + ] + } + ], + "patch": "delete", + "range": [ + 642, + 691 + ] + } + ], + "range": [ + 642, + 692 + ] + } + ], + "hasChanges": true, + "range": [ + 642, + 692 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 699, + 712 + ] + } + ], + "patch": "delete", + "range": [ + 692, + 713 + ] + } + ], + "range": [ + 692, + 714 + ] + } + ], + "hasChanges": true, + "range": [ + 692, + 714 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 721, + 734 + ] + }, + { + "category": "StringLiteral", + "range": [ + 740, + 745 + ] + } + ], + "range": [ + 714, + 746 + ] + } + ], + "range": [ + 714, + 747 + ] + } + ], + "hasChanges": false, + "range": [ + 714, + 747 + ], + "number": 17 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 759, + 763 + ] + } + ], + "range": [ + 754, + 763 + ] + }, + { + "category": "StringLiteral", + "range": [ + 769, + 779 + ] + } + ], + "range": [ + 747, + 780 + ] + } + ], + "range": [ + 747, + 781 + ] + } + ], + "hasChanges": false, + "range": [ + 747, + 781 + ], + "number": 18 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 49 + ] + } + ], + "range": [ + 40, + 49 + ] + }, + { + "category": "StringLiteral", + "range": [ + 55, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "range": [ + 33, + 67 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 790, + 796 + ] + } + ], + "range": [ + 788, + 798 + ] + }, + { + "category": "StringLiteral", + "range": [ + 804, + 809 + ] + } + ], + "range": [ + 781, + 810 + ] + } + ], + "range": [ + 781, + 811 + ] + } + ], + "hasChanges": false, + "range": [ + 781, + 811 + ], + "number": 19 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 74, + 84 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 95 + ] + } + ], + "range": [ + 67, + 96 + ] + } + ], + "range": [ + 67, + 97 + ] + } + ], + "hasChanges": false, + "range": [ + 67, + 97 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 820, + 827 + ] + } + ], + "range": [ + 820, + 827 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 830, + 837 + ] + } + ], + "range": [ + 818, + 839 + ] + }, + { + "category": "StringLiteral", + "range": [ + 845, + 855 + ] + } + ], + "range": [ + 811, + 856 + ] + } + ], + "range": [ + 811, + 857 + ] + } + ], + "hasChanges": false, + "range": [ + 811, + 857 + ], + "number": 20 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 113 + ] + } + ], + "range": [ + 106, + 113 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 104, + 125 + ] + }, + { + "category": "StringLiteral", + "range": [ + 131, + 141 + ] + } + ], + "range": [ + 97, + 142 + ] + } + ], + "range": [ + 97, + 143 + ] + } + ], + "hasChanges": false, + "range": [ + 97, + 143 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 866, + 873 + ] + } + ], + "range": [ + 866, + 873 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 876, + 883 + ] + }, + { + "category": "Identifier", + "range": [ + 887, + 893 + ] + } + ], + "range": [ + 876, + 893 + ] + } + ], + "range": [ + 864, + 895 + ] + }, + { + "category": "StringLiteral", + "range": [ + 901, + 912 + ] + } + ], + "range": [ + 857, + 913 + ] + } + ], + "range": [ + 857, + 914 + ] + } + ], + "hasChanges": false, + "range": [ + 857, + 914 + ], + "number": 21 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 152, + 159 + ] + } + ], + "range": [ + 152, + 159 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 162, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 173, + 179 + ] + } + ], + "range": [ + 162, + 179 + ] + } + ], + "range": [ + 150, + 181 + ] + }, + { + "category": "StringLiteral", + "range": [ + 187, + 198 + ] + } + ], + "range": [ + 143, + 199 + ] + } + ], + "range": [ + 143, + 200 + ] + } + ], + "hasChanges": false, + "range": [ + 143, + 200 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 921, + 934 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 938, + 945 + ] + } + ], + "range": [ + 938, + 945 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 947, + 954 + ] + }, + { + "category": "Identifier", + "range": [ + 958, + 964 + ] + } + ], + "range": [ + 947, + 964 + ] + } + ], + "range": [ + 936, + 966 + ] + }, + { + "category": "StringLiteral", + "range": [ + 972, + 982 + ] + } + ], + "range": [ + 914, + 983 + ] + } + ], + "range": [ + 914, + 984 + ] + } + ], + "hasChanges": false, + "range": [ + 914, + 984 + ], + "number": 22 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 220 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 224, + 231 + ] + } + ], + "range": [ + 224, + 231 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 233, + 240 + ] + }, + { + "category": "Identifier", + "range": [ + 244, + 250 + ] + } + ], + "range": [ + 233, + 250 + ] + } + ], + "range": [ + 222, + 252 + ] + }, + { + "category": "StringLiteral", + "range": [ + 258, + 268 + ] + } + ], + "range": [ + 200, + 269 + ] + } + ], + "range": [ + 200, + 270 + ] + } + ], + "hasChanges": false, + "range": [ + 200, + 270 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 991, + 1004 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 1011, + 1015 + ] + } + ], + "range": [ + 1006, + 1015 + ] + }, + { + "category": "StringLiteral", + "range": [ + 1021, + 1032 + ] + } + ], + "range": [ + 984, + 1033 + ] + } + ], + "range": [ + 984, + 1034 + ] + } + ], + "hasChanges": false, + "range": [ + 984, + 1034 + ], + "number": 23 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 277, + 290 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 297, + 301 + ] + } + ], + "range": [ + 292, + 301 + ] + }, + { + "category": "StringLiteral", + "range": [ + 307, + 318 + ] + } + ], + "range": [ + 270, + 319 + ] + } + ], + "range": [ + 270, + 320 + ] + } + ], + "hasChanges": false, + "range": [ + 270, + 320 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 1041, + 1054 + ] + } + ], + "range": [ + 1034, + 1055 + ] + } + ], + "range": [ + 1034, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1034, + 1056 + ], + "number": 24 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 327, + 340 + ] + } + ], + "range": [ + 320, + 341 + ] + } + ], + "range": [ + 320, + 342 + ] + } + ], + "hasChanges": false, + "range": [ + 320, + 342 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 349, + 362 + ] + }, + { + "category": "StringLiteral", + "range": [ + 368, + 378 + ] + } + ], + "patch": "insert", + "range": [ + 342, + 379 + ] + } + ], + "range": [ + 342, + 380 + ] + } + ], + "hasChanges": true, + "range": [ + 342, + 380 + ], + "number": 9 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 392, + 401 + ] + } + ], + "range": [ + 387, + 401 + ] + }, + { + "category": "StringLiteral", + "range": [ + 407, + 415 + ] + } + ], + "patch": "insert", + "range": [ + 380, + 416 + ] + } + ], + "range": [ + 380, + 417 + ] + } + ], + "hasChanges": true, + "range": [ + 380, + 417 + ], + "number": 10 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 426, + 433 + ] + } + ], + "range": [ + 426, + 433 + ] + } + ], + "range": [ + 424, + 435 + ] + }, + { + "category": "StringLiteral", + "range": [ + 441, + 449 + ] + } + ], + "patch": "insert", + "range": [ + 417, + 450 + ] + } + ], + "range": [ + 417, + 451 + ] + } + ], + "hasChanges": true, + "range": [ + 417, + 451 + ], + "number": 11 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 460, + 468 + ] + } + ], + "range": [ + 460, + 468 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 471, + 479 + ] + } + ], + "range": [ + 471, + 479 + ] + } + ], + "range": [ + 458, + 481 + ] + }, + { + "category": "StringLiteral", + "range": [ + 487, + 499 + ] + } + ], + "patch": "insert", + "range": [ + 451, + 500 + ] + } + ], + "range": [ + 451, + 501 + ] + } + ], + "hasChanges": true, + "range": [ + 451, + 501 + ], + "number": 12 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 510, + 518 + ] + } + ], + "range": [ + 510, + 518 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 521, + 529 + ] + }, + { + "category": "Identifier", + "range": [ + 533, + 546 + ] + } + ], + "range": [ + 521, + 546 + ] + } + ], + "range": [ + 508, + 548 + ] + }, + { + "category": "StringLiteral", + "range": [ + 554, + 565 + ] + } + ], + "patch": "insert", + "range": [ + 501, + 566 + ] + } + ], + "range": [ + 501, + 567 + ] + } + ], + "hasChanges": true, + "range": [ + 501, + 567 + ], + "number": 13 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 574, + 587 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 591, + 599 + ] + } + ], + "range": [ + 591, + 599 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 601, + 609 + ] + }, + { + "category": "Identifier", + "range": [ + 613, + 626 + ] + } + ], + "range": [ + 601, + 626 + ] + } + ], + "range": [ + 589, + 628 + ] + }, + { + "category": "StringLiteral", + "range": [ + 634, + 643 + ] + } + ], + "patch": "insert", + "range": [ + 567, + 644 + ] + } + ], + "range": [ + 567, + 645 + ] + } + ], + "hasChanges": true, + "range": [ + 567, + 645 + ], + "number": 14 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 652, + 665 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 672, + 679 + ] + } + ], + "range": [ + 667, + 679 + ] + }, + { + "category": "StringLiteral", + "range": [ + 685, + 693 + ] + } + ], + "patch": "insert", + "range": [ + 645, + 694 + ] + } + ], + "range": [ + 645, + 695 + ] + } + ], + "hasChanges": true, + "range": [ + 645, + 695 + ], + "number": 15 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 702, + 712 + ] + } + ], + "patch": "insert", + "range": [ + 695, + 713 + ] + } + ], + "range": [ + 695, + 714 + ] + } + ], + "hasChanges": true, + "range": [ + 695, + 714 + ], + "number": 16 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 1056, + 1056 + ] + } + ], + "hasChanges": false, + "range": [ + 1056, + 1056 + ], + "number": 25 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 714, + 714 + ] + } + ], + "hasChanges": false, + "range": [ + 714, + 714 + ], + "number": 17 + } + ] + ], + "paths": [ + "import.js", + "import.js" + ], + "oids": [ + "045c536ef6c74be91ba31c1dd47f8cb5c92a19b2", + "873ff752f28ce7a81e8c7573d696b2de0f08281d" + ] + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 045c536..873ff75 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,19 +1,3 @@", + "-import defaultMember from \"babirusa\";", + "-import * as otherName from \"baboon\";", + "-import { element } from \"badger\";", + "-import { element1 , element2 } from \"bald-eagle\";", + "-import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "-import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "-import defaultMember, * as element from \"barbet\";", + "-import \"basilisk\";", + "-import defaultMember from \"foo\";", + "-import * as name from \"aardvark\";", + "-import { member } from \"ant\";", + "-import { member1 , member2 } from \"antelope\";", + "-import { member1 , member2 as alias2 } from \"ant-eater\";", + "-import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "-import defaultMember, * as name from \"alligator\";", + "-import \"arctic-tern\";", + " import defaultMember from \"foo\";", + " import * as name from \"aardvark\";", + " import { member } from \"ant\";", + "@@ -22,3 +6,11 @@ import { member1 , member2 as alias2 } from \"ant-eater\";", + " import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + " import defaultMember, * as name from \"alligator\";", + " import \"arctic-tern\";", + "+import defaultMember from \"babirusa\";", + "+import * as otherName from \"baboon\";", + "+import { element } from \"badger\";", + "+import { element1 , element2 } from \"bald-eagle\";", + "+import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "+import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "+import defaultMember, * as element from \"barbet\";", + "+import \"basilisk\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9cee417f36dc72559f8005d43c1c64e38d14b260..04525879004b8577a357fe3fa2c7c5937218f3f4" +} +,{ + "testCaseDescription": "javascript-import-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 45, + 49 + ] + } + ], + "range": [ + 40, + 49 + ] + }, + { + "category": "StringLiteral", + "range": [ + 55, + 65 + ] + } + ], + "patch": "delete", + "range": [ + 33, + 66 + ] + } + ], + "range": [ + 33, + 67 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 67 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 76, + 82 + ] + } + ], + "range": [ + 74, + 84 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 95 + ] + } + ], + "patch": "delete", + "range": [ + 67, + 96 + ] + } + ], + "range": [ + 67, + 97 + ] + } + ], + "hasChanges": true, + "range": [ + 67, + 97 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 106, + 113 + ] + } + ], + "range": [ + 106, + 113 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 116, + 123 + ] + } + ], + "range": [ + 104, + 125 + ] + }, + { + "category": "StringLiteral", + "range": [ + 131, + 141 + ] + } + ], + "patch": "delete", + "range": [ + 97, + 142 + ] + } + ], + "range": [ + 97, + 143 + ] + } + ], + "hasChanges": true, + "range": [ + 97, + 143 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 152, + 159 + ] + } + ], + "range": [ + 152, + 159 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 162, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 173, + 179 + ] + } + ], + "range": [ + 162, + 179 + ] + } + ], + "range": [ + 150, + 181 + ] + }, + { + "category": "StringLiteral", + "range": [ + 187, + 198 + ] + } + ], + "patch": "delete", + "range": [ + 143, + 199 + ] + } + ], + "range": [ + 143, + 200 + ] + } + ], + "hasChanges": true, + "range": [ + 143, + 200 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 207, + 220 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 224, + 231 + ] + } + ], + "range": [ + 224, + 231 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 233, + 240 + ] + }, + { + "category": "Identifier", + "range": [ + 244, + 250 + ] + } + ], + "range": [ + 233, + 250 + ] + } + ], + "range": [ + 222, + 252 + ] + }, + { + "category": "StringLiteral", + "range": [ + 258, + 268 + ] + } + ], + "patch": "delete", + "range": [ + 200, + 269 + ] + } + ], + "range": [ + 200, + 270 + ] + } + ], + "hasChanges": true, + "range": [ + 200, + 270 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 277, + 290 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 297, + 301 + ] + } + ], + "range": [ + 292, + 301 + ] + }, + { + "category": "StringLiteral", + "range": [ + 307, + 318 + ] + } + ], + "patch": "delete", + "range": [ + 270, + 319 + ] + } + ], + "range": [ + 270, + 320 + ] + } + ], + "hasChanges": true, + "range": [ + 270, + 320 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 327, + 340 + ] + } + ], + "patch": "delete", + "range": [ + 320, + 341 + ] + } + ], + "range": [ + 320, + 342 + ] + } + ], + "hasChanges": true, + "range": [ + 320, + 342 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 349, + 362 + ] + }, + { + "category": "StringLiteral", + "range": [ + 368, + 378 + ] + } + ], + "range": [ + 342, + 379 + ] + } + ], + "range": [ + 342, + 380 + ] + } + ], + "hasChanges": false, + "range": [ + 342, + 380 + ], + "number": 9 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 392, + 401 + ] + } + ], + "range": [ + 387, + 401 + ] + }, + { + "category": "StringLiteral", + "range": [ + 407, + 415 + ] + } + ], + "range": [ + 380, + 416 + ] + } + ], + "range": [ + 380, + 417 + ] + } + ], + "hasChanges": false, + "range": [ + 380, + 417 + ], + "number": 10 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 45, + 59 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 38, + 74 + ] + } + ], + "range": [ + 38, + 75 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 75 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 426, + 433 + ] + } + ], + "range": [ + 426, + 433 + ] + } + ], + "range": [ + 424, + 435 + ] + }, + { + "category": "StringLiteral", + "range": [ + 441, + 449 + ] + } + ], + "range": [ + 417, + 450 + ] + } + ], + "range": [ + 417, + 451 + ] + } + ], + "hasChanges": false, + "range": [ + 417, + 451 + ], + "number": 11 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 82, + 93 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + } + ], + "range": [ + 75, + 108 + ] + } + ], + "range": [ + 75, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 75, + 109 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 460, + 468 + ] + } + ], + "range": [ + 460, + 468 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 471, + 479 + ] + } + ], + "range": [ + 471, + 479 + ] + } + ], + "range": [ + 458, + 481 + ] + }, + { + "category": "StringLiteral", + "range": [ + 487, + 499 + ] + } + ], + "range": [ + 451, + 500 + ] + } + ], + "range": [ + 451, + 501 + ] + } + ], + "hasChanges": false, + "range": [ + 451, + 501 + ], + "number": 12 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 126 + ] + } + ], + "range": [ + 118, + 126 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 116, + 139 + ] + }, + { + "category": "StringLiteral", + "range": [ + 145, + 157 + ] + } + ], + "range": [ + 109, + 158 + ] + } + ], + "range": [ + 109, + 159 + ] + } + ], + "hasChanges": false, + "range": [ + 109, + 159 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 510, + 518 + ] + } + ], + "range": [ + 510, + 518 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 521, + 529 + ] + }, + { + "category": "Identifier", + "range": [ + 533, + 546 + ] + } + ], + "range": [ + 521, + 546 + ] + } + ], + "range": [ + 508, + 548 + ] + }, + { + "category": "StringLiteral", + "range": [ + 554, + 565 + ] + } + ], + "range": [ + 501, + 566 + ] + } + ], + "range": [ + 501, + 567 + ] + } + ], + "hasChanges": false, + "range": [ + 501, + 567 + ], + "number": 13 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 176 + ] + } + ], + "range": [ + 168, + 176 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 187 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 204 + ] + } + ], + "range": [ + 179, + 204 + ] + } + ], + "range": [ + 166, + 206 + ] + }, + { + "category": "StringLiteral", + "range": [ + 212, + 223 + ] + } + ], + "range": [ + 159, + 224 + ] + } + ], + "range": [ + 159, + 225 + ] + } + ], + "hasChanges": false, + "range": [ + 159, + 225 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 574, + 587 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 591, + 599 + ] + } + ], + "range": [ + 591, + 599 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 601, + 609 + ] + }, + { + "category": "Identifier", + "range": [ + 613, + 626 + ] + } + ], + "range": [ + 601, + 626 + ] + } + ], + "range": [ + 589, + 628 + ] + }, + { + "category": "StringLiteral", + "range": [ + 634, + 643 + ] + } + ], + "range": [ + 567, + 644 + ] + } + ], + "range": [ + 567, + 645 + ] + } + ], + "hasChanges": false, + "range": [ + 567, + 645 + ], + "number": 14 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 232, + 245 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 249, + 257 + ] + } + ], + "range": [ + 249, + 257 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 259, + 267 + ] + }, + { + "category": "Identifier", + "range": [ + 271, + 284 + ] + } + ], + "range": [ + 259, + 284 + ] + } + ], + "range": [ + 247, + 286 + ] + }, + { + "category": "StringLiteral", + "range": [ + 292, + 301 + ] + } + ], + "range": [ + 225, + 302 + ] + } + ], + "range": [ + 225, + 303 + ] + } + ], + "hasChanges": false, + "range": [ + 225, + 303 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 652, + 665 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 672, + 679 + ] + } + ], + "range": [ + 667, + 679 + ] + }, + { + "category": "StringLiteral", + "range": [ + 685, + 693 + ] + } + ], + "range": [ + 645, + 694 + ] + } + ], + "range": [ + 645, + 695 + ] + } + ], + "hasChanges": false, + "range": [ + 645, + 695 + ], + "number": 15 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 310, + 323 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 330, + 337 + ] + } + ], + "range": [ + 325, + 337 + ] + }, + { + "category": "StringLiteral", + "range": [ + 343, + 351 + ] + } + ], + "range": [ + 303, + 352 + ] + } + ], + "range": [ + 303, + 353 + ] + } + ], + "hasChanges": false, + "range": [ + 303, + 353 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 702, + 712 + ] + } + ], + "range": [ + 695, + 713 + ] + } + ], + "range": [ + 695, + 714 + ] + } + ], + "hasChanges": false, + "range": [ + 695, + 714 + ], + "number": 16 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 360, + 370 + ] + } + ], + "range": [ + 353, + 371 + ] + } + ], + "range": [ + 353, + 372 + ] + } + ], + "hasChanges": false, + "range": [ + 353, + 372 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 714, + 714 + ] + } + ], + "hasChanges": false, + "range": [ + 714, + 714 + ], + "number": 17 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 372, + 372 + ] + } + ], + "hasChanges": false, + "range": [ + 372, + 372 + ], + "number": 9 + } + ] + ], + "paths": [ + "import.js", + "import.js" + ], + "oids": [ + "873ff752f28ce7a81e8c7573d696b2de0f08281d", + "db723392d3b659586cec185608d7d57ce5da872b" + ] + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index 873ff75..db72339 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,11 +1,3 @@", + "-import defaultMember from \"foo\";", + "-import * as name from \"aardvark\";", + "-import { member } from \"ant\";", + "-import { member1 , member2 } from \"antelope\";", + "-import { member1 , member2 as alias2 } from \"ant-eater\";", + "-import defaultMember, { member1, member2 as alias2 } from \"anaconda\";", + "-import defaultMember, * as name from \"alligator\";", + "-import \"arctic-tern\";", + " import defaultMember from \"babirusa\";", + " import * as otherName from \"baboon\";", + " import { element } from \"badger\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "04525879004b8577a357fe3fa2c7c5937218f3f4..31410516cd8aa6df7e993b64253cb523aab15729" +} +,{ + "testCaseDescription": "javascript-import-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 20 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 59 + ] + } + ], + "range": [ + 45, + 59 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 38, + 74 + ] + } + ], + "patch": "delete", + "range": [ + 38, + 75 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 75 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 84, + 91 + ] + } + ], + "range": [ + 82, + 93 + ] + }, + { + "category": "StringLiteral", + "range": [ + 99, + 107 + ] + } + ], + "range": [ + 75, + 108 + ] + } + ], + "patch": "delete", + "range": [ + 75, + 109 + ] + } + ], + "hasChanges": true, + "range": [ + 75, + 109 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 118, + 126 + ] + } + ], + "range": [ + 118, + 126 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 129, + 137 + ] + } + ], + "range": [ + 116, + 139 + ] + }, + { + "category": "StringLiteral", + "range": [ + 145, + 157 + ] + } + ], + "range": [ + 109, + 158 + ] + } + ], + "patch": "delete", + "range": [ + 109, + 159 + ] + } + ], + "hasChanges": true, + "range": [ + 109, + 159 + ], + "number": 4 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 168, + 176 + ] + } + ], + "range": [ + 168, + 176 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 179, + 187 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 204 + ] + } + ], + "range": [ + 179, + 204 + ] + } + ], + "range": [ + 166, + 206 + ] + }, + { + "category": "StringLiteral", + "range": [ + 212, + 223 + ] + } + ], + "range": [ + 159, + 224 + ] + } + ], + "patch": "delete", + "range": [ + 159, + 225 + ] + } + ], + "hasChanges": true, + "range": [ + 159, + 225 + ], + "number": 5 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 232, + 245 + ] + }, + { + "category": "named_imports", + "children": [ + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 249, + 257 + ] + } + ], + "range": [ + 249, + 257 + ] + }, + { + "category": "import_specifier", + "children": [ + { + "category": "Identifier", + "range": [ + 259, + 267 + ] + }, + { + "category": "Identifier", + "range": [ + 271, + 284 + ] + } + ], + "range": [ + 259, + 284 + ] + } + ], + "range": [ + 247, + 286 + ] + }, + { + "category": "StringLiteral", + "range": [ + 292, + 301 + ] + } + ], + "range": [ + 225, + 302 + ] + } + ], + "patch": "delete", + "range": [ + 225, + 303 + ] + } + ], + "hasChanges": true, + "range": [ + 225, + 303 + ], + "number": 6 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "Identifier", + "range": [ + 310, + 323 + ] + }, + { + "category": "namespace_import", + "children": [ + { + "category": "Identifier", + "range": [ + 330, + 337 + ] + } + ], + "range": [ + 325, + 337 + ] + }, + { + "category": "StringLiteral", + "range": [ + 343, + 351 + ] + } + ], + "range": [ + 303, + 352 + ] + } + ], + "patch": "delete", + "range": [ + 303, + 353 + ] + } + ], + "hasChanges": true, + "range": [ + 303, + 353 + ], + "number": 7 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Import", + "children": [ + { + "category": "StringLiteral", + "range": [ + 360, + 370 + ] + } + ], + "range": [ + 353, + 371 + ] + } + ], + "patch": "delete", + "range": [ + 353, + 372 + ] + } + ], + "hasChanges": true, + "range": [ + 353, + 372 + ], + "number": 8 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 372, + 372 + ] + } + ], + "hasChanges": true, + "range": [ + 372, + 372 + ], + "number": 9 + } + ] + ], + "paths": [ + "import.js", + "import.js" + ], + "oids": [ + "db723392d3b659586cec185608d7d57ce5da872b", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "import.js" + ], + "patch": [ + "diff --git a/import.js b/import.js", + "index db72339..e69de29 100644", + "--- a/import.js", + "+++ b/import.js", + "@@ -1,8 +0,0 @@", + "-import defaultMember from \"babirusa\";", + "-import * as otherName from \"baboon\";", + "-import { element } from \"badger\";", + "-import { element1 , element2 } from \"bald-eagle\";", + "-import { element1 , element2 as elementAlias2 } from \"bandicoot\";", + "-import defaultMember, { element1, element2 as elementAlias2 } from \"banteng\";", + "-import defaultMember, * as element from \"barbet\";", + "-import \"basilisk\";" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "31410516cd8aa6df7e993b64253cb523aab15729..0bb74af8eede739c6d9a6b79a13e61263d3c52e6" +}] diff --git a/test/corpus/json/javascript/math-assignment-operator.json b/test/corpus/json/javascript/math-assignment-operator.json new file mode 100644 index 000000000..2d0d1f80a --- /dev/null +++ b/test/corpus/json/javascript/math-assignment-operator.json @@ -0,0 +1,1812 @@ +[{ + "testCaseDescription": "javascript-math-assignment-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "math-assignment-operator.js", + "math-assignment-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "7150d6e7aaaa31b485dad53b7938765558a5ef7b" + ] + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index e69de29..7150d6e 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -0,0 +1 @@", + "+x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2dd315197d728e8efdfc502c8ec48dac3ee8a4b7..ded203079c60a3d7a343120c4c5a54079dd4340e" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "math-assignment-operator.js", + "math-assignment-operator.js" + ], + "oids": [ + "7150d6e7aaaa31b485dad53b7938765558a5ef7b", + "0bf97e75fb39f981fc1b59bbf98a59d49b6ac9d6" + ] + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 7150d6e..0bf97e7 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1 +1,3 @@", + "+x += 2;", + "+x += 1;", + " x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ded203079c60a3d7a343120c4c5a54079dd4340e..ab4c64432f01363febab14a118751ced86cbede9" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "math-assignment-operator.js", + "math-assignment-operator.js" + ], + "oids": [ + "0bf97e75fb39f981fc1b59bbf98a59d49b6ac9d6", + "ad04937aee456c0697e6e26b9172bb3f951d187f" + ] + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 0bf97e7..ad04937 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,3 +1,3 @@", + "-x += 2;", + "+x += 1;", + " x += 1;", + " x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ab4c64432f01363febab14a118751ced86cbede9..c631f771b1428cf1a28dc4db4d00252aa24b22fe" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "math-assignment-operator.js", + "math-assignment-operator.js" + ], + "oids": [ + "ad04937aee456c0697e6e26b9172bb3f951d187f", + "0bf97e75fb39f981fc1b59bbf98a59d49b6ac9d6" + ] + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index ad04937..0bf97e7 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,3 +1,3 @@", + "-x += 1;", + "+x += 2;", + " x += 1;", + " x += 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c631f771b1428cf1a28dc4db4d00252aa24b22fe..6f08c08ae092e52ef599812163e6b8b39330ab63" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "patch": "delete", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + } + ] + ], + "paths": [ + "math-assignment-operator.js", + "math-assignment-operator.js" + ], + "oids": [ + "0bf97e75fb39f981fc1b59bbf98a59d49b6ac9d6", + "71275450ce8eab1ec02ce012fe725a62327af0ef" + ] + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 0bf97e7..7127545 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,3 +1,2 @@", + "-x += 2;", + "-x += 1;", + " x += 1;", + "+x += 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6f08c08ae092e52ef599812163e6b8b39330ab63..b7d905cc763b31035f76fda7ac7f3b48f8df1154" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 13, + 14 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "math-assignment-operator.js", + "math-assignment-operator.js" + ], + "oids": [ + "71275450ce8eab1ec02ce012fe725a62327af0ef", + "94d1472273d5e1435104388d3ffb1a3465112096" + ] + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 7127545..94d1472 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1,2 +1 @@", + "-x += 1;", + " x += 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b7d905cc763b31035f76fda7ac7f3b48f8df1154..634f52893f90b01720432e519a9feb7c07c26012" +} +,{ + "testCaseDescription": "javascript-math-assignment-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "math-assignment-operator.js", + "math-assignment-operator.js" + ], + "oids": [ + "94d1472273d5e1435104388d3ffb1a3465112096", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "math-assignment-operator.js" + ], + "patch": [ + "diff --git a/math-assignment-operator.js b/math-assignment-operator.js", + "index 94d1472..e69de29 100644", + "--- a/math-assignment-operator.js", + "+++ b/math-assignment-operator.js", + "@@ -1 +0,0 @@", + "-x += 2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "634f52893f90b01720432e519a9feb7c07c26012..8dd4d424eeae076b657c04fb290058c4635ae818" +}] diff --git a/test/corpus/json/javascript/math-operator.json b/test/corpus/json/javascript/math-operator.json new file mode 100644 index 000000000..81ed7425a --- /dev/null +++ b/test/corpus/json/javascript/math-operator.json @@ -0,0 +1,3064 @@ +[{ + "testCaseDescription": "javascript-math-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 19, + 19 + ], + "number": 2 + } + ] + ], + "paths": [ + "math-operator.js", + "math-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "034466776814285bcd24cd966033449721d6e89b" + ] + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index e69de29..0344667 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -0,0 +1 @@", + "+i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "349ec3f8639b7b854f6fcfdaaf8e2ef63c05fef7..c10213a914cc4c581935c845587b1615f782b23d" +} +,{ + "testCaseDescription": "javascript-math-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "patch": "insert", + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 19, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 19 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 42, + 47 + ] + } + ], + "range": [ + 38, + 47 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 38, + 55 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + } + ] + ], + "paths": [ + "math-operator.js", + "math-operator.js" + ], + "oids": [ + "034466776814285bcd24cd966033449721d6e89b", + "79f5f20cab835046e300f62aca0465b308b06b3f" + ] + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 0344667..79f5f20 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1 +1,3 @@", + "+i + j * 2 - j % 4;", + "+i + j * 3 - j % 5;", + " i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c10213a914cc4c581935c845587b1615f782b23d..8d0e873b6e585bc5d038b3597e50375979bab9d7" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 38 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 42, + 47 + ] + } + ], + "range": [ + 38, + 47 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 38, + 55 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 42, + 47 + ] + } + ], + "range": [ + 38, + 47 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 38, + 55 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + } + ] + ], + "paths": [ + "math-operator.js", + "math-operator.js" + ], + "oids": [ + "79f5f20cab835046e300f62aca0465b308b06b3f", + "284561c5dce063cf9773c88b0d61138440ef0ecb" + ] + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 79f5f20..284561c 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,3 +1,3 @@", + "-i + j * 2 - j % 4;", + "+i + j * 3 - j % 5;", + " i + j * 3 - j % 5;", + " i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8d0e873b6e585bc5d038b3597e50375979bab9d7..410a2f6f9d81e855cad2997c46445446d9a969d3" +} +,{ + "testCaseDescription": "javascript-math-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 38 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 42, + 47 + ] + } + ], + "range": [ + 38, + 47 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 38, + 55 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 42, + 47 + ] + } + ], + "range": [ + 38, + 47 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 38, + 55 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + } + ] + ], + "paths": [ + "math-operator.js", + "math-operator.js" + ], + "oids": [ + "284561c5dce063cf9773c88b0d61138440ef0ecb", + "79f5f20cab835046e300f62aca0465b308b06b3f" + ] + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 284561c..79f5f20 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,3 +1,3 @@", + "-i + j * 3 - j % 5;", + "+i + j * 2 - j % 4;", + " i + j * 3 - j % 5;", + " i + j * 3 - j % 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "410a2f6f9d81e855cad2997c46445446d9a969d3..2682d71eb0c050080c252a74b5086466a18fbeac" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "patch": "delete", + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 19, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 42, + 47 + ] + } + ], + "range": [ + 38, + 47 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 51 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 54, + 55 + ] + } + ], + "range": [ + 50, + 55 + ] + } + ], + "range": [ + 38, + 55 + ] + } + ], + "range": [ + 38, + 56 + ] + } + ], + "range": [ + 38, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 57 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "patch": "insert", + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 19, + 38 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 57, + 57 + ] + } + ], + "hasChanges": false, + "range": [ + 57, + 57 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 38, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 38 + ], + "number": 3 + } + ] + ], + "paths": [ + "math-operator.js", + "math-operator.js" + ], + "oids": [ + "79f5f20cab835046e300f62aca0465b308b06b3f", + "d1055f77d631ead2c4f4959b2f21f6dab64462c3" + ] + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 79f5f20..d1055f7 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,3 +1,2 @@", + "-i + j * 2 - j % 4;", + "-i + j * 3 - j % 5;", + " i + j * 3 - j % 5;", + "+i + j * 2 - j % 4;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2682d71eb0c050080c252a74b5086466a18fbeac..e94c4f98fb944fbc75a8f45d35f143b51d1eb642" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 23, + 28 + ] + } + ], + "range": [ + 19, + 28 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 31, + 32 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 31, + 36 + ] + } + ], + "range": [ + 19, + 36 + ] + } + ], + "range": [ + 19, + 37 + ] + } + ], + "range": [ + 19, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 38 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 38, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 38 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 2 + } + ] + ], + "paths": [ + "math-operator.js", + "math-operator.js" + ], + "oids": [ + "d1055f77d631ead2c4f4959b2f21f6dab64462c3", + "79ba2b3f103626747e184f54f8885acf39bc5d60" + ] + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index d1055f7..79ba2b3 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1,2 +1 @@", + "-i + j * 3 - j % 5;", + " i + j * 2 - j % 4;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e94c4f98fb944fbc75a8f45d35f143b51d1eb642..946717e49735f8b580f7b162468c366784e6678d" +} +,{ + "testCaseDescription": "javascript-math-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + }, + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 16, + 17 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 19 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 19, + 19 + ], + "number": 2 + } + ] + ], + "paths": [ + "math-operator.js", + "math-operator.js" + ], + "oids": [ + "79ba2b3f103626747e184f54f8885acf39bc5d60", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "math-operator.js" + ], + "patch": [ + "diff --git a/math-operator.js b/math-operator.js", + "index 79ba2b3..e69de29 100644", + "--- a/math-operator.js", + "+++ b/math-operator.js", + "@@ -1 +0,0 @@", + "-i + j * 2 - j % 4;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "946717e49735f8b580f7b162468c366784e6678d..b0194f4ccae027de9b6fbbc4ceefe070cf51555c" +}] diff --git a/test/corpus/json/javascript/member-access-assignment.json b/test/corpus/json/javascript/member-access-assignment.json new file mode 100644 index 000000000..e31a02e15 --- /dev/null +++ b/test/corpus/json/javascript/member-access-assignment.json @@ -0,0 +1,2228 @@ +[{ + "testCaseDescription": "javascript-member-access-assignment-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 9 + ], + "number": 2 + } + ] + ], + "paths": [ + "member-access-assignment.js", + "member-access-assignment.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "7a99e3099456e71f6d44eae1634a02873cf08445" + ] + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index e69de29..7a99e30 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -0,0 +1 @@", + "+y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "30a517ace94526eae9f09618d7cc587cdbb96c25..8d4dfc6dee6848d963a1ae274414a21efda49931" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 9 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + } + ], + "range": [ + 18, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 18, + 25 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 9 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + } + ] + ], + "paths": [ + "member-access-assignment.js", + "member-access-assignment.js" + ], + "oids": [ + "7a99e3099456e71f6d44eae1634a02873cf08445", + "32040068931708fb0b9512d6957fc4b1eb61238c" + ] + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 7a99e30..3204006 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1 +1,3 @@", + "+y.x = 1;", + "+y.x = 0;", + " y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8d4dfc6dee6848d963a1ae274414a21efda49931..85fb25af4dc9beca3e862fec80f2212cb67e51a8" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + } + ], + "range": [ + 18, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 18, + 25 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + } + ], + "range": [ + 18, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 18, + 25 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + } + ] + ], + "paths": [ + "member-access-assignment.js", + "member-access-assignment.js" + ], + "oids": [ + "32040068931708fb0b9512d6957fc4b1eb61238c", + "94893a32f203ac706838c159344b8ab9085db17d" + ] + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 3204006..94893a3 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y.x = 1;", + "+y.x = 0;", + " y.x = 0;", + " y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "85fb25af4dc9beca3e862fec80f2212cb67e51a8..20e1b9fe5bd2d81f12abfc191d986ef7fcc86401" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + } + ], + "range": [ + 18, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 18, + 25 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + } + ], + "range": [ + 18, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 18, + 25 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + } + ] + ], + "paths": [ + "member-access-assignment.js", + "member-access-assignment.js" + ], + "oids": [ + "94893a32f203ac706838c159344b8ab9085db17d", + "32040068931708fb0b9512d6957fc4b1eb61238c" + ] + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 94893a3..3204006 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y.x = 0;", + "+y.x = 1;", + " y.x = 0;", + " y.x = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "20e1b9fe5bd2d81f12abfc191d986ef7fcc86401..0a32ed61310da85bb560f6fe0466714dfb0623f5" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "patch": "delete", + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + } + ], + "range": [ + 18, + 21 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 24, + 25 + ] + } + ], + "range": [ + 18, + 25 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 3 + } + ] + ], + "paths": [ + "member-access-assignment.js", + "member-access-assignment.js" + ], + "oids": [ + "32040068931708fb0b9512d6957fc4b1eb61238c", + "8d78a24f4a6b385148718b33a24742123a8c413a" + ] + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 3204006..8d78a24 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,3 +1,2 @@", + "-y.x = 1;", + "-y.x = 0;", + " y.x = 0;", + "+y.x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0a32ed61310da85bb560f6fe0466714dfb0623f5..8906b689174ac6fdae79acf100face3eb283fadd" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 9, + 12 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 9, + 16 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 9 + ], + "number": 2 + } + ] + ], + "paths": [ + "member-access-assignment.js", + "member-access-assignment.js" + ], + "oids": [ + "8d78a24f4a6b385148718b33a24742123a8c413a", + "799018d077c34569268d97d29864cda54c49aa23" + ] + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 8d78a24..799018d 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1,2 +1 @@", + "-y.x = 0;", + " y.x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8906b689174ac6fdae79acf100face3eb283fadd..6b8df6e5c3cb67d6c14497e03fbc3f2fbb850f95" +} +,{ + "testCaseDescription": "javascript-member-access-assignment-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 9 + ], + "number": 2 + } + ] + ], + "paths": [ + "member-access-assignment.js", + "member-access-assignment.js" + ], + "oids": [ + "799018d077c34569268d97d29864cda54c49aa23", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "member-access-assignment.js" + ], + "patch": [ + "diff --git a/member-access-assignment.js b/member-access-assignment.js", + "index 799018d..e69de29 100644", + "--- a/member-access-assignment.js", + "+++ b/member-access-assignment.js", + "@@ -1 +0,0 @@", + "-y.x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6b8df6e5c3cb67d6c14497e03fbc3f2fbb850f95..6a942b8c8b6674795040d75810b847dd6dbf37e4" +}] diff --git a/test/corpus/json/javascript/member-access.json b/test/corpus/json/javascript/member-access.json new file mode 100644 index 000000000..64690bf59 --- /dev/null +++ b/test/corpus/json/javascript/member-access.json @@ -0,0 +1,1812 @@ +[{ + "testCaseDescription": "javascript-member-access-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 16, + 16 + ], + "number": 2 + } + ] + ], + "paths": [ + "member-access.js", + "member-access.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "3c837c9ac2210ab22e17256aec6c81255b24a053" + ] + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index e69de29..3c837c9 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -0,0 +1 @@", + "+x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6bb7b92e6660b4bea6500b17891e6215571694a1..a7e9f12709231169ce940b7b5adddb8b700c4740" +} +,{ + "testCaseDescription": "javascript-member-access-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 20, + 34 + ] + } + ], + "patch": "insert", + "range": [ + 20, + 35 + ] + } + ], + "range": [ + 20, + 36 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 36 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 16 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + }, + { + "category": "Identifier", + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 36, + 50 + ] + } + ], + "range": [ + 36, + 51 + ] + } + ], + "range": [ + 36, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 52 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + } + ] + ], + "paths": [ + "member-access.js", + "member-access.js" + ], + "oids": [ + "3c837c9ac2210ab22e17256aec6c81255b24a053", + "858131aff5581b39a869c08175f8d36ded551ad7" + ] + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 3c837c9..858131a 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1 +1,3 @@", + "+x.someOtherProperty", + "+x.someProperty;", + " x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a7e9f12709231169ce940b7b5adddb8b700c4740..8a2a90b5c78a4271528ba0098926b1309345cd81" +} +,{ + "testCaseDescription": "javascript-member-access-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 20, + 34 + ] + } + ], + "range": [ + 20, + 35 + ] + } + ], + "range": [ + 20, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 36 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 30 + ] + } + ], + "range": [ + 16, + 30 + ] + } + ], + "range": [ + 16, + 31 + ] + } + ], + "range": [ + 16, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 32 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + }, + { + "category": "Identifier", + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 36, + 50 + ] + } + ], + "range": [ + 36, + 51 + ] + } + ], + "range": [ + 36, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 52 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 46 + ] + } + ], + "range": [ + 32, + 46 + ] + } + ], + "range": [ + 32, + 47 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 48 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 4 + } + ] + ], + "paths": [ + "member-access.js", + "member-access.js" + ], + "oids": [ + "858131aff5581b39a869c08175f8d36ded551ad7", + "5ed8a8d239fc6159dcd6c4eda641a3371076c3a6" + ] + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 858131a..5ed8a8d 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,3 +1,3 @@", + "-x.someOtherProperty", + "+x.someProperty;", + " x.someProperty;", + " x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8a2a90b5c78a4271528ba0098926b1309345cd81..b3e91ac2bb642a9f673811cf0f81464baa0d5107" +} +,{ + "testCaseDescription": "javascript-member-access-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 30 + ] + } + ], + "range": [ + 16, + 30 + ] + } + ], + "range": [ + 16, + 31 + ] + } + ], + "range": [ + 16, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 32 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 20, + 34 + ] + } + ], + "range": [ + 20, + 35 + ] + } + ], + "range": [ + 20, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 36 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + }, + { + "category": "Identifier", + "range": [ + 34, + 46 + ] + } + ], + "range": [ + 32, + 46 + ] + } + ], + "range": [ + 32, + 47 + ] + } + ], + "range": [ + 32, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 48 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + }, + { + "category": "Identifier", + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 36, + 50 + ] + } + ], + "range": [ + 36, + 51 + ] + } + ], + "range": [ + 36, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 52 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 48, + 48 + ] + } + ], + "hasChanges": false, + "range": [ + 48, + 48 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + } + ] + ], + "paths": [ + "member-access.js", + "member-access.js" + ], + "oids": [ + "5ed8a8d239fc6159dcd6c4eda641a3371076c3a6", + "858131aff5581b39a869c08175f8d36ded551ad7" + ] + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 5ed8a8d..858131a 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,3 +1,3 @@", + "-x.someProperty;", + "+x.someOtherProperty", + " x.someProperty;", + " x.someProperty;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b3e91ac2bb642a9f673811cf0f81464baa0d5107..a840fc931f382340c5556c4189d2d1794ccc11dd" +} +,{ + "testCaseDescription": "javascript-member-access-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 20, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 22, + 34 + ] + } + ], + "range": [ + 20, + 34 + ] + } + ], + "patch": "delete", + "range": [ + 20, + 35 + ] + } + ], + "range": [ + 20, + 36 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 36 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + }, + { + "category": "Identifier", + "range": [ + 38, + 50 + ] + } + ], + "range": [ + 36, + 50 + ] + } + ], + "range": [ + 36, + 51 + ] + } + ], + "range": [ + 36, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 52 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 35 + ] + } + ], + "range": [ + 16, + 35 + ] + } + ], + "patch": "insert", + "range": [ + 16, + 36 + ] + } + ], + "range": [ + 16, + 36 + ] + } + ], + "hasChanges": true, + "range": [ + 16, + 36 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 3 + } + ] + ], + "paths": [ + "member-access.js", + "member-access.js" + ], + "oids": [ + "858131aff5581b39a869c08175f8d36ded551ad7", + "81f5f468eb0e95b890ccdd3e5aaf1fd53361aa03" + ] + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 858131a..81f5f46 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,3 +1,2 @@", + "-x.someOtherProperty", + "-x.someProperty;", + " x.someProperty;", + "+x.someOtherProperty" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a840fc931f382340c5556c4189d2d1794ccc11dd..162904a6f6d643b66a5f4b844ba2e228b7dc6c5e" +} +,{ + "testCaseDescription": "javascript-member-access-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 14 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 35 + ] + } + ], + "range": [ + 16, + 35 + ] + } + ], + "range": [ + 16, + 36 + ] + } + ], + "range": [ + 16, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 36 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 20, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 20 + ], + "number": 2 + } + ] + ], + "paths": [ + "member-access.js", + "member-access.js" + ], + "oids": [ + "81f5f468eb0e95b890ccdd3e5aaf1fd53361aa03", + "8329c7704ddcef58fe0babaebc1e4ff7a3b39979" + ] + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 81f5f46..8329c77 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1,2 +1 @@", + "-x.someProperty;", + " x.someOtherProperty" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "162904a6f6d643b66a5f4b844ba2e228b7dc6c5e..66de6fe8153911bdce9e1e49b303c1e0fa6f3df9" +} +,{ + "testCaseDescription": "javascript-member-access-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 20, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 20 + ], + "number": 2 + } + ] + ], + "paths": [ + "member-access.js", + "member-access.js" + ], + "oids": [ + "8329c7704ddcef58fe0babaebc1e4ff7a3b39979", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "member-access.js" + ], + "patch": [ + "diff --git a/member-access.js b/member-access.js", + "index 8329c77..e69de29 100644", + "--- a/member-access.js", + "+++ b/member-access.js", + "@@ -1 +0,0 @@", + "-x.someOtherProperty" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "66de6fe8153911bdce9e1e49b303c1e0fa6f3df9..75ba258ab370ff0efecb47f5f6a2f6a9968e9b8d" +}] diff --git a/test/corpus/json/javascript/method-call.json b/test/corpus/json/javascript/method-call.json new file mode 100644 index 000000000..7d2d6271b --- /dev/null +++ b/test/corpus/json/javascript/method-call.json @@ -0,0 +1,2176 @@ +[{ + "testCaseDescription": "javascript-method-call-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 33 + ], + "number": 2 + } + ] + ], + "paths": [ + "method-call.js", + "method-call.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "07ab90c69d337ae3711ce064e3003f38aa49c5af" + ] + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index e69de29..07ab90c 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -0,0 +1 @@", + "+object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7aca49a04758f43f9e7c909ee616f33c18cf0e27..a391db61c291e9652b50630df1819b83df83ffea" +} +,{ + "testCaseDescription": "javascript-method-call-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "patch": "insert", + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 66 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 96 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + } + ] + ], + "paths": [ + "method-call.js", + "method-call.js" + ], + "oids": [ + "07ab90c69d337ae3711ce064e3003f38aa49c5af", + "9341e1754f85b838816c6c07c0e23a94bc817482" + ] + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 07ab90c..9341e17 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1 +1,3 @@", + "+object.someMethod(arg1, \"arg3\");", + "+object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a391db61c291e9652b50630df1819b83df83ffea..8a52922fc1e9800afafa4c5bb1bd7c6bf8bc1673" +} +,{ + "testCaseDescription": "javascript-method-call-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 96 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 96 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + } + ] + ], + "paths": [ + "method-call.js", + "method-call.js" + ], + "oids": [ + "9341e1754f85b838816c6c07c0e23a94bc817482", + "f6ada2d15e5cdbecee0da95ff9e84677f32f2e1e" + ] + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 9341e17..f6ada2d 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,3 +1,3 @@", + "-object.someMethod(arg1, \"arg3\");", + "+object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8a52922fc1e9800afafa4c5bb1bd7c6bf8bc1673..af43a2e5f963ea29cb4bbef3df5d610dfb0dd6c4" +} +,{ + "testCaseDescription": "javascript-method-call-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 96 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 96 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + } + ] + ], + "paths": [ + "method-call.js", + "method-call.js" + ], + "oids": [ + "f6ada2d15e5cdbecee0da95ff9e84677f32f2e1e", + "9341e1754f85b838816c6c07c0e23a94bc817482" + ] + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index f6ada2d..9341e17 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,3 +1,3 @@", + "-object.someMethod(arg1, \"arg2\");", + "+object.someMethod(arg1, \"arg3\");", + " object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "af43a2e5f963ea29cb4bbef3df5d610dfb0dd6c4..51076f4ed7a3e7277b2d21eaecc04fe0ac703d33" +} +,{ + "testCaseDescription": "javascript-method-call-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "patch": "delete", + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 66 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 66, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 83 + ] + }, + { + "category": "Identifier", + "range": [ + 84, + 88 + ] + }, + { + "category": "StringLiteral", + "range": [ + 90, + 96 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "patch": "insert", + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 66 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 3 + } + ] + ], + "paths": [ + "method-call.js", + "method-call.js" + ], + "oids": [ + "9341e1754f85b838816c6c07c0e23a94bc817482", + "894dcf6638fa03abcfa66082a858e5a1266dd714" + ] + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 9341e17..894dcf6 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,3 +1,2 @@", + "-object.someMethod(arg1, \"arg3\");", + "-object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg2\");", + "+object.someMethod(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "51076f4ed7a3e7277b2d21eaecc04fe0ac703d33..52f38ade18e39d463dad479757df8039e8f9cfb9" +} +,{ + "testCaseDescription": "javascript-method-call-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 50 + ] + }, + { + "category": "Identifier", + "range": [ + 51, + 55 + ] + }, + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 2 + } + ] + ], + "paths": [ + "method-call.js", + "method-call.js" + ], + "oids": [ + "894dcf6638fa03abcfa66082a858e5a1266dd714", + "a82528c868f9222f29b3b80c97112469b67a2d1d" + ] + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index 894dcf6..a82528c 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1,2 +1 @@", + "-object.someMethod(arg1, \"arg2\");", + " object.someMethod(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "52f38ade18e39d463dad479757df8039e8f9cfb9..2b82d812ce523f1c1ec125ab8590a1cd7191bda9" +} +,{ + "testCaseDescription": "javascript-method-call-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + }, + { + "category": "Identifier", + "range": [ + 7, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 22 + ] + }, + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 33 + ], + "number": 2 + } + ] + ], + "paths": [ + "method-call.js", + "method-call.js" + ], + "oids": [ + "a82528c868f9222f29b3b80c97112469b67a2d1d", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "method-call.js" + ], + "patch": [ + "diff --git a/method-call.js b/method-call.js", + "index a82528c..e69de29 100644", + "--- a/method-call.js", + "+++ b/method-call.js", + "@@ -1 +0,0 @@", + "-object.someMethod(arg1, \"arg3\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2b82d812ce523f1c1ec125ab8590a1cd7191bda9..fc795a83fff7fcdcadac0ce15ce74b4c24bfcbd5" +}] diff --git a/test/corpus/json/javascript/named-function.json b/test/corpus/json/javascript/named-function.json new file mode 100644 index 000000000..64cd0f92e --- /dev/null +++ b/test/corpus/json/javascript/named-function.json @@ -0,0 +1,2540 @@ +[{ + "testCaseDescription": "javascript-named-function-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 34, + 39 + ] + } + ], + "range": [ + 32, + 41 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 43, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 43, + 43 + ], + "number": 2 + } + ] + ], + "paths": [ + "named-function.js", + "named-function.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "94b19f8eb1eb7d5e14e197559feaacf01465c358" + ] + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index e69de29..94b19f8 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -0,0 +1 @@", + "+function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e3b9f963811fa510e777ed818a75408691e53555..26ef45fff727a1d92e4e7838001a2b035fc278e8" +} +,{ + "testCaseDescription": "javascript-named-function-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 27, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 70 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 84 + ] + } + ], + "range": [ + 80, + 85 + ] + } + ], + "range": [ + 78, + 87 + ] + } + ], + "range": [ + 46, + 87 + ] + } + ], + "patch": "insert", + "range": [ + 46, + 88 + ] + } + ], + "range": [ + 46, + 89 + ] + } + ], + "hasChanges": true, + "range": [ + 46, + 89 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 34, + 39 + ] + } + ], + "range": [ + 32, + 41 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 43 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 108 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 115, + 119 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 123, + 127 + ] + } + ], + "range": [ + 123, + 128 + ] + } + ], + "range": [ + 121, + 130 + ] + } + ], + "range": [ + 89, + 130 + ] + } + ], + "range": [ + 89, + 131 + ] + } + ], + "range": [ + 89, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 89, + 132 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 43, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 43 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + } + ] + ], + "paths": [ + "named-function.js", + "named-function.js" + ], + "oids": [ + "94b19f8eb1eb7d5e14e197559feaacf01465c358", + "cb766a0e05101d1697005bb235aedfb5c1e1869e" + ] + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index 94b19f8..cb766a0 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1 +1,3 @@", + "+function anotherFunction() { return false; };", + "+function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "26ef45fff727a1d92e4e7838001a2b035fc278e8..75a5271cdbee078430f84c42f7d1d117412b1113" +} +,{ + "testCaseDescription": "javascript-named-function-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 36, + 41 + ] + } + ], + "patch": "delete", + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 27, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 19 + ] + }, + { + "category": "Identifier", + "patch": "insert", + "range": [ + 20, + 24 + ] + }, + { + "category": "Identifier", + "patch": "insert", + "range": [ + 26, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "patch": "insert", + "range": [ + 34, + 39 + ] + } + ], + "range": [ + 32, + 41 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 70 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 84 + ] + } + ], + "range": [ + 80, + 85 + ] + } + ], + "range": [ + 78, + 87 + ] + } + ], + "range": [ + 46, + 87 + ] + } + ], + "range": [ + 46, + 88 + ] + } + ], + "range": [ + 46, + 89 + ] + } + ], + "hasChanges": false, + "range": [ + 46, + 89 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 62 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 81 + ] + } + ], + "range": [ + 77, + 82 + ] + } + ], + "range": [ + 75, + 84 + ] + } + ], + "range": [ + 43, + 84 + ] + } + ], + "range": [ + 43, + 85 + ] + } + ], + "range": [ + 43, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 86 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 108 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 115, + 119 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 123, + 127 + ] + } + ], + "range": [ + 123, + 128 + ] + } + ], + "range": [ + 121, + 130 + ] + } + ], + "range": [ + 89, + 130 + ] + } + ], + "range": [ + 89, + 131 + ] + } + ], + "range": [ + 89, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 89, + 132 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 105 + ] + }, + { + "category": "Identifier", + "range": [ + 106, + 110 + ] + }, + { + "category": "Identifier", + "range": [ + 112, + 116 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + } + ], + "range": [ + 120, + 125 + ] + } + ], + "range": [ + 118, + 127 + ] + } + ], + "range": [ + 86, + 127 + ] + } + ], + "range": [ + 86, + 128 + ] + } + ], + "range": [ + 86, + 129 + ] + } + ], + "hasChanges": false, + "range": [ + 86, + 129 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 129, + 129 + ] + } + ], + "hasChanges": false, + "range": [ + 129, + 129 + ], + "number": 4 + } + ] + ], + "paths": [ + "named-function.js", + "named-function.js" + ], + "oids": [ + "cb766a0e05101d1697005bb235aedfb5c1e1869e", + "c9cff07773192e8f646366ac816f1a7bf06cbbcc" + ] + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index cb766a0..c9cff07 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,3 +1,3 @@", + "-function anotherFunction() { return false; };", + "+function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "75a5271cdbee078430f84c42f7d1d117412b1113..09c3cd31554ad0960c5587fc0bea5d6c63208af1" +} +,{ + "testCaseDescription": "javascript-named-function-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 19 + ] + }, + { + "category": "Identifier", + "patch": "delete", + "range": [ + 20, + 24 + ] + }, + { + "category": "Identifier", + "patch": "delete", + "range": [ + 26, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 34, + 39 + ] + } + ], + "range": [ + 32, + 41 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 9, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 36, + 41 + ] + } + ], + "patch": "insert", + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 27, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 62 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 67 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 73 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 77, + 81 + ] + } + ], + "range": [ + 77, + 82 + ] + } + ], + "range": [ + 75, + 84 + ] + } + ], + "range": [ + 43, + 84 + ] + } + ], + "range": [ + 43, + 85 + ] + } + ], + "range": [ + 43, + 86 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 86 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 70 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 84 + ] + } + ], + "range": [ + 80, + 85 + ] + } + ], + "range": [ + 78, + 87 + ] + } + ], + "range": [ + 46, + 87 + ] + } + ], + "range": [ + 46, + 88 + ] + } + ], + "range": [ + 46, + 89 + ] + } + ], + "hasChanges": false, + "range": [ + 46, + 89 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 105 + ] + }, + { + "category": "Identifier", + "range": [ + 106, + 110 + ] + }, + { + "category": "Identifier", + "range": [ + 112, + 116 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + } + ], + "range": [ + 120, + 125 + ] + } + ], + "range": [ + 118, + 127 + ] + } + ], + "range": [ + 86, + 127 + ] + } + ], + "range": [ + 86, + 128 + ] + } + ], + "range": [ + 86, + 129 + ] + } + ], + "hasChanges": false, + "range": [ + 86, + 129 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 108 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 115, + 119 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 123, + 127 + ] + } + ], + "range": [ + 123, + 128 + ] + } + ], + "range": [ + 121, + 130 + ] + } + ], + "range": [ + 89, + 130 + ] + } + ], + "range": [ + 89, + 131 + ] + } + ], + "range": [ + 89, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 89, + 132 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 129, + 129 + ] + } + ], + "hasChanges": false, + "range": [ + 129, + 129 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + } + ] + ], + "paths": [ + "named-function.js", + "named-function.js" + ], + "oids": [ + "c9cff07773192e8f646366ac816f1a7bf06cbbcc", + "cb766a0e05101d1697005bb235aedfb5c1e1869e" + ] + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index c9cff07..cb766a0 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,3 +1,3 @@", + "-function myFunction(arg1, arg2) { arg2; };", + "+function anotherFunction() { return false; };", + " function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "09c3cd31554ad0960c5587fc0bea5d6c63208af1..780f471ede93bca59163186bb3b949234cbb34ad" +} +,{ + "testCaseDescription": "javascript-named-function-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 27, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 55, + 65 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 70 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 76 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 84 + ] + } + ], + "range": [ + 80, + 85 + ] + } + ], + "range": [ + 78, + 87 + ] + } + ], + "range": [ + 46, + 87 + ] + } + ], + "patch": "delete", + "range": [ + 46, + 88 + ] + } + ], + "range": [ + 46, + 89 + ] + } + ], + "hasChanges": true, + "range": [ + 46, + 89 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 98, + 108 + ] + }, + { + "category": "Identifier", + "range": [ + 109, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 115, + 119 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 123, + 127 + ] + } + ], + "range": [ + 123, + 128 + ] + } + ], + "range": [ + 121, + 130 + ] + } + ], + "range": [ + 89, + 130 + ] + } + ], + "range": [ + 89, + 131 + ] + } + ], + "range": [ + 89, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 89, + 132 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 34, + 39 + ] + } + ], + "range": [ + 32, + 41 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 67 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 79, + 84 + ] + } + ], + "range": [ + 72, + 85 + ] + } + ], + "range": [ + 70, + 87 + ] + } + ], + "range": [ + 43, + 87 + ] + } + ], + "patch": "insert", + "range": [ + 43, + 88 + ] + } + ], + "range": [ + 43, + 89 + ] + } + ], + "hasChanges": true, + "range": [ + 43, + 89 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 132, + 132 + ] + } + ], + "hasChanges": false, + "range": [ + 132, + 132 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 89, + 89 + ] + } + ], + "hasChanges": false, + "range": [ + 89, + 89 + ], + "number": 3 + } + ] + ], + "paths": [ + "named-function.js", + "named-function.js" + ], + "oids": [ + "cb766a0e05101d1697005bb235aedfb5c1e1869e", + "148bcc771954af656fac03fd1f2070200dac9b89" + ] + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index cb766a0..148bcc7 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,3 +1,2 @@", + "-function anotherFunction() { return false; };", + "-function myFunction(arg1, arg2) { arg2; };", + " function myFunction(arg1, arg2) { arg2; };", + "+function anotherFunction() { return false; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "780f471ede93bca59163186bb3b949234cbb34ad..0d92f7f8cad59587e7bdcfdeee9fbdb9ccc97834" +} +,{ + "testCaseDescription": "javascript-named-function-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 19 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 24 + ] + }, + { + "category": "Identifier", + "range": [ + 26, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 38 + ] + } + ], + "range": [ + 34, + 39 + ] + } + ], + "range": [ + 32, + 41 + ] + } + ], + "range": [ + 0, + 41 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 67 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 79, + 84 + ] + } + ], + "range": [ + 72, + 85 + ] + } + ], + "range": [ + 70, + 87 + ] + } + ], + "range": [ + 43, + 87 + ] + } + ], + "range": [ + 43, + 88 + ] + } + ], + "range": [ + 43, + 89 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 89 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 27, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 89, + 89 + ] + } + ], + "hasChanges": false, + "range": [ + 89, + 89 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 46, + 46 + ] + } + ], + "hasChanges": false, + "range": [ + 46, + 46 + ], + "number": 2 + } + ] + ], + "paths": [ + "named-function.js", + "named-function.js" + ], + "oids": [ + "148bcc771954af656fac03fd1f2070200dac9b89", + "80e11b021534ad3a70c0ed32d90b7fd5b31b1f37" + ] + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index 148bcc7..80e11b0 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1,2 +1 @@", + "-function myFunction(arg1, arg2) { arg2; };", + " function anotherFunction() { return false; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0d92f7f8cad59587e7bdcfdeee9fbdb9ccc97834..8ca0ac128c264aae6e22d2fd2d5d7afe05a25226" +} +,{ + "testCaseDescription": "javascript-named-function-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 24 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 36, + 41 + ] + } + ], + "range": [ + 29, + 42 + ] + } + ], + "range": [ + 27, + 44 + ] + } + ], + "range": [ + 0, + 44 + ] + } + ], + "range": [ + 0, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 46 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 46, + 46 + ] + } + ], + "hasChanges": true, + "range": [ + 46, + 46 + ], + "number": 2 + } + ] + ], + "paths": [ + "named-function.js", + "named-function.js" + ], + "oids": [ + "80e11b021534ad3a70c0ed32d90b7fd5b31b1f37", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "named-function.js" + ], + "patch": [ + "diff --git a/named-function.js b/named-function.js", + "index 80e11b0..e69de29 100644", + "--- a/named-function.js", + "+++ b/named-function.js", + "@@ -1 +0,0 @@", + "-function anotherFunction() { return false; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8ca0ac128c264aae6e22d2fd2d5d7afe05a25226..6bb7b92e6660b4bea6500b17891e6215571694a1" +}] diff --git a/test/corpus/json/javascript/nested-do-while-in-function.json b/test/corpus/json/javascript/nested-do-while-in-function.json new file mode 100644 index 000000000..43ce3ea92 --- /dev/null +++ b/test/corpus/json/javascript/nested-do-while-in-function.json @@ -0,0 +1,3714 @@ +[{ + "testCaseDescription": "javascript-nested-do-while-in-function-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 65, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 65, + 65 + ], + "number": 2 + } + ] + ], + "paths": [ + "nested-do-while-in-function.js", + "nested-do-while-in-function.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "d205614e4003d65c0c1e0884312fea4c3284ee27" + ] + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index e69de29..d205614 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -0,0 +1 @@", + "+function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1eaceb51f0254fd4621ddd6e017876ef398d5d8e..dc15722d3808e5012e5bcf3a23499db0e1b7c995" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "patch": "insert", + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": true, + "range": [ + 65, + 130 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 65 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 174 + ] + } + ], + "range": [ + 160, + 175 + ] + } + ], + "range": [ + 160, + 176 + ] + } + ], + "range": [ + 158, + 178 + ] + }, + { + "category": "Identifier", + "range": [ + 186, + 190 + ] + } + ], + "range": [ + 155, + 192 + ] + } + ], + "range": [ + 153, + 194 + ] + } + ], + "range": [ + 130, + 194 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 195 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 65, + 65 + ] + } + ], + "hasChanges": false, + "range": [ + 65, + 65 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 195, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 195, + 195 + ], + "number": 4 + } + ] + ], + "paths": [ + "nested-do-while-in-function.js", + "nested-do-while-in-function.js" + ], + "oids": [ + "d205614e4003d65c0c1e0884312fea4c3284ee27", + "5dfcca69fc8c45b892e7e7d0c2177e46ff90047d" + ] + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index d205614..5dfcca6 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1 +1,3 @@", + "+function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + "+function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dc15722d3808e5012e5bcf3a23499db0e1b7c995..7fa92c6f78c6d1456cdc90a1fa61b2388aeef6cd" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": false, + "range": [ + 65, + 130 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": false, + "range": [ + 65, + 130 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 174 + ] + } + ], + "range": [ + 160, + 175 + ] + } + ], + "range": [ + 160, + 176 + ] + } + ], + "range": [ + 158, + 178 + ] + }, + { + "category": "Identifier", + "range": [ + 186, + 190 + ] + } + ], + "range": [ + 155, + 192 + ] + } + ], + "range": [ + 153, + 194 + ] + } + ], + "range": [ + 130, + 194 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 195 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 174 + ] + } + ], + "range": [ + 160, + 175 + ] + } + ], + "range": [ + 160, + 176 + ] + } + ], + "range": [ + 158, + 178 + ] + }, + { + "category": "Identifier", + "range": [ + 186, + 190 + ] + } + ], + "range": [ + 155, + 192 + ] + } + ], + "range": [ + 153, + 194 + ] + } + ], + "range": [ + 130, + 194 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 195 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 195, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 195, + 195 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 195, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 195, + 195 + ], + "number": 4 + } + ] + ], + "paths": [ + "nested-do-while-in-function.js", + "nested-do-while-in-function.js" + ], + "oids": [ + "5dfcca69fc8c45b892e7e7d0c2177e46ff90047d", + "49cff7e6f3e7e1a6c3d91ed0b2ec8fbdcd20a842" + ] + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 5dfcca6..49cff7e 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,3 +1,3 @@", + "-function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + "+function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7fa92c6f78c6d1456cdc90a1fa61b2388aeef6cd..fa3d4a9247fd7b7e73925554743a8744c9896695" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": false, + "range": [ + 65, + 130 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": false, + "range": [ + 65, + 130 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 174 + ] + } + ], + "range": [ + 160, + 175 + ] + } + ], + "range": [ + 160, + 176 + ] + } + ], + "range": [ + 158, + 178 + ] + }, + { + "category": "Identifier", + "range": [ + 186, + 190 + ] + } + ], + "range": [ + 155, + 192 + ] + } + ], + "range": [ + 153, + 194 + ] + } + ], + "range": [ + 130, + 194 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 195 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 174 + ] + } + ], + "range": [ + 160, + 175 + ] + } + ], + "range": [ + 160, + 176 + ] + } + ], + "range": [ + 158, + 178 + ] + }, + { + "category": "Identifier", + "range": [ + 186, + 190 + ] + } + ], + "range": [ + 155, + 192 + ] + } + ], + "range": [ + 153, + 194 + ] + } + ], + "range": [ + 130, + 194 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 195 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 195, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 195, + 195 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 195, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 195, + 195 + ], + "number": 4 + } + ] + ], + "paths": [ + "nested-do-while-in-function.js", + "nested-do-while-in-function.js" + ], + "oids": [ + "49cff7e6f3e7e1a6c3d91ed0b2ec8fbdcd20a842", + "5dfcca69fc8c45b892e7e7d0c2177e46ff90047d" + ] + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 49cff7e..5dfcca6 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,3 +1,3 @@", + "-function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + "+function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fa3d4a9247fd7b7e73925554743a8744c9896695..7f3d2ac374c6ec185e40f87572406f9502997106" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "patch": "delete", + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": true, + "range": [ + 65, + 130 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 139, + 140 + ] + }, + { + "category": "Identifier", + "range": [ + 141, + 145 + ] + }, + { + "category": "Identifier", + "range": [ + 147, + 151 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 160, + 169 + ] + }, + { + "category": "Identifier", + "range": [ + 170, + 174 + ] + } + ], + "range": [ + 160, + 175 + ] + } + ], + "range": [ + 160, + 176 + ] + } + ], + "range": [ + 158, + 178 + ] + }, + { + "category": "Identifier", + "range": [ + 186, + 190 + ] + } + ], + "range": [ + 155, + 192 + ] + } + ], + "range": [ + 153, + 194 + ] + } + ], + "range": [ + 130, + 194 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "range": [ + 130, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 195 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "patch": "insert", + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": true, + "range": [ + 65, + 130 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 195, + 195 + ] + } + ], + "hasChanges": false, + "range": [ + 195, + 195 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 130, + 130 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 130 + ], + "number": 3 + } + ] + ], + "paths": [ + "nested-do-while-in-function.js", + "nested-do-while-in-function.js" + ], + "oids": [ + "5dfcca69fc8c45b892e7e7d0c2177e46ff90047d", + "babb1e64587c352c2ff10aabaa632bbfc9012a02" + ] + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 5dfcca6..babb1e6 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,3 +1,2 @@", + "-function f(arg1, arg2) { do { something(arg2); } while (arg1); }", + "-function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + "+function f(arg1, arg2) { do { something(arg2); } while (arg1); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7f3d2ac374c6ec185e40f87572406f9502997106..595f4e5c33c8379201bee89a298c78167dc96943" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + }, + { + "category": "Identifier", + "range": [ + 76, + 80 + ] + }, + { + "category": "Identifier", + "range": [ + 82, + 86 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 95, + 104 + ] + }, + { + "category": "Identifier", + "range": [ + 105, + 109 + ] + } + ], + "range": [ + 95, + 110 + ] + } + ], + "range": [ + 95, + 111 + ] + } + ], + "range": [ + 93, + 113 + ] + }, + { + "category": "Identifier", + "range": [ + 121, + 125 + ] + } + ], + "range": [ + 90, + 127 + ] + } + ], + "range": [ + 88, + 129 + ] + } + ], + "range": [ + 65, + 129 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "range": [ + 65, + 130 + ] + } + ], + "hasChanges": false, + "range": [ + 65, + 130 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 130, + 130 + ] + } + ], + "hasChanges": false, + "range": [ + 130, + 130 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 65, + 65 + ] + } + ], + "hasChanges": false, + "range": [ + 65, + 65 + ], + "number": 2 + } + ] + ], + "paths": [ + "nested-do-while-in-function.js", + "nested-do-while-in-function.js" + ], + "oids": [ + "babb1e64587c352c2ff10aabaa632bbfc9012a02", + "2b155808a78e6f220d56186ac013b537f94a479c" + ] + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index babb1e6..2b15580 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1,2 +1 @@", + "-function f(arg1, arg2) { do { something(arg1); } while (arg2); }", + " function f(arg1, arg2) { do { something(arg2); } while (arg1); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "595f4e5c33c8379201bee89a298c78167dc96943..81b84277f9f896d95d168abe4c1a79b6ef04f831" +} +,{ + "testCaseDescription": "javascript-nested-do-while-in-function-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "DoWhile", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 30, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 44 + ] + } + ], + "range": [ + 30, + 45 + ] + } + ], + "range": [ + 30, + 46 + ] + } + ], + "range": [ + 28, + 48 + ] + }, + { + "category": "Identifier", + "range": [ + 56, + 60 + ] + } + ], + "range": [ + 25, + 62 + ] + } + ], + "range": [ + 23, + 64 + ] + } + ], + "range": [ + 0, + 64 + ] + } + ], + "range": [ + 0, + 65 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 65 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 65, + 65 + ] + } + ], + "hasChanges": true, + "range": [ + 65, + 65 + ], + "number": 2 + } + ] + ], + "paths": [ + "nested-do-while-in-function.js", + "nested-do-while-in-function.js" + ], + "oids": [ + "2b155808a78e6f220d56186ac013b537f94a479c", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "nested-do-while-in-function.js" + ], + "patch": [ + "diff --git a/nested-do-while-in-function.js b/nested-do-while-in-function.js", + "index 2b15580..e69de29 100644", + "--- a/nested-do-while-in-function.js", + "+++ b/nested-do-while-in-function.js", + "@@ -1 +0,0 @@", + "-function f(arg1, arg2) { do { something(arg2); } while (arg1); }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "81b84277f9f896d95d168abe4c1a79b6ef04f831..81a41e72cb6728374f1f2c700f5656622f0966ec" +}] diff --git a/test/corpus/json/javascript/nested-functions.json b/test/corpus/json/javascript/nested-functions.json new file mode 100644 index 000000000..2272cbdaa --- /dev/null +++ b/test/corpus/json/javascript/nested-functions.json @@ -0,0 +1,5508 @@ +[{ + "testCaseDescription": "javascript-nested-functions-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 103, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 103, + 103 + ], + "number": 2 + } + ] + ], + "paths": [ + "nested-functions.js", + "nested-functions.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "72531d81633b54539c4e0e118c94794023582163" + ] + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index e69de29..72531d8 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -0,0 +1 @@", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "790f317cf635d64f5798d63a5b58483fd6bad99f..583329489c6f6b0bffd28c0ba69c284b7f1b811b" +} +,{ + "testCaseDescription": "javascript-nested-functions-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "patch": "insert", + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": true, + "range": [ + 103, + 206 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 103 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 221 + ] + }, + { + "category": "Identifier", + "range": [ + 223, + 227 + ] + }, + { + "category": "Identifier", + "range": [ + 229, + 233 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 246, + 251 + ] + }, + { + "category": "Identifier", + "range": [ + 253, + 257 + ] + }, + { + "category": "Identifier", + "range": [ + 259, + 263 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 267, + 274 + ] + }, + { + "category": "Identifier", + "range": [ + 275, + 278 + ] + }, + { + "category": "Identifier", + "range": [ + 279, + 283 + ] + } + ], + "range": [ + 267, + 284 + ] + } + ], + "range": [ + 267, + 285 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 286, + 293 + ] + }, + { + "category": "Identifier", + "range": [ + 294, + 297 + ] + }, + { + "category": "Identifier", + "range": [ + 298, + 302 + ] + } + ], + "range": [ + 286, + 303 + ] + } + ], + "range": [ + 286, + 304 + ] + } + ], + "range": [ + 265, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 235, + 308 + ] + } + ], + "range": [ + 206, + 308 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 309 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 103, + 103 + ] + } + ], + "hasChanges": false, + "range": [ + 103, + 103 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 309, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 309, + 309 + ], + "number": 4 + } + ] + ], + "paths": [ + "nested-functions.js", + "nested-functions.js" + ], + "oids": [ + "72531d81633b54539c4e0e118c94794023582163", + "c960aae180e11fcaea00d3e8b5ff586e41e0f2da" + ] + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 72531d8..c960aae 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1 +1,3 @@", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "583329489c6f6b0bffd28c0ba69c284b7f1b811b..5e0f442eda3b1d8f963cc7e248c5630420b5cff5" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": false, + "range": [ + 103, + 206 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": false, + "range": [ + 103, + 206 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 221 + ] + }, + { + "category": "Identifier", + "range": [ + 223, + 227 + ] + }, + { + "category": "Identifier", + "range": [ + 229, + 233 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 246, + 251 + ] + }, + { + "category": "Identifier", + "range": [ + 253, + 257 + ] + }, + { + "category": "Identifier", + "range": [ + 259, + 263 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 267, + 274 + ] + }, + { + "category": "Identifier", + "range": [ + 275, + 278 + ] + }, + { + "category": "Identifier", + "range": [ + 279, + 283 + ] + } + ], + "range": [ + 267, + 284 + ] + } + ], + "range": [ + 267, + 285 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 286, + 293 + ] + }, + { + "category": "Identifier", + "range": [ + 294, + 297 + ] + }, + { + "category": "Identifier", + "range": [ + 298, + 302 + ] + } + ], + "range": [ + 286, + 303 + ] + } + ], + "range": [ + 286, + 304 + ] + } + ], + "range": [ + 265, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 235, + 308 + ] + } + ], + "range": [ + 206, + 308 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 309 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 221 + ] + }, + { + "category": "Identifier", + "range": [ + 223, + 227 + ] + }, + { + "category": "Identifier", + "range": [ + 229, + 233 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 246, + 251 + ] + }, + { + "category": "Identifier", + "range": [ + 253, + 257 + ] + }, + { + "category": "Identifier", + "range": [ + 259, + 263 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 267, + 274 + ] + }, + { + "category": "Identifier", + "range": [ + 275, + 278 + ] + }, + { + "category": "Identifier", + "range": [ + 279, + 283 + ] + } + ], + "range": [ + 267, + 284 + ] + } + ], + "range": [ + 267, + 285 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 286, + 293 + ] + }, + { + "category": "Identifier", + "range": [ + 294, + 297 + ] + }, + { + "category": "Identifier", + "range": [ + 298, + 302 + ] + } + ], + "range": [ + 286, + 303 + ] + } + ], + "range": [ + 286, + 304 + ] + } + ], + "range": [ + 265, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 235, + 308 + ] + } + ], + "range": [ + 206, + 308 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 309 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 309, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 309, + 309 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 309, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 309, + 309 + ], + "number": 4 + } + ] + ], + "paths": [ + "nested-functions.js", + "nested-functions.js" + ], + "oids": [ + "c960aae180e11fcaea00d3e8b5ff586e41e0f2da", + "1b9b61a3964ffb047472f21103b352f506252d1f" + ] + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index c960aae..1b9b61a 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,3 +1,3 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5e0f442eda3b1d8f963cc7e248c5630420b5cff5..4ce43f40272580f43a9fb8e2b7cdaf164023371b" +} +,{ + "testCaseDescription": "javascript-nested-functions-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": false, + "range": [ + 103, + 206 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": false, + "range": [ + 103, + 206 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 221 + ] + }, + { + "category": "Identifier", + "range": [ + 223, + 227 + ] + }, + { + "category": "Identifier", + "range": [ + 229, + 233 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 246, + 251 + ] + }, + { + "category": "Identifier", + "range": [ + 253, + 257 + ] + }, + { + "category": "Identifier", + "range": [ + 259, + 263 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 267, + 274 + ] + }, + { + "category": "Identifier", + "range": [ + 275, + 278 + ] + }, + { + "category": "Identifier", + "range": [ + 279, + 283 + ] + } + ], + "range": [ + 267, + 284 + ] + } + ], + "range": [ + 267, + 285 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 286, + 293 + ] + }, + { + "category": "Identifier", + "range": [ + 294, + 297 + ] + }, + { + "category": "Identifier", + "range": [ + 298, + 302 + ] + } + ], + "range": [ + 286, + 303 + ] + } + ], + "range": [ + 286, + 304 + ] + } + ], + "range": [ + 265, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 235, + 308 + ] + } + ], + "range": [ + 206, + 308 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 309 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 221 + ] + }, + { + "category": "Identifier", + "range": [ + 223, + 227 + ] + }, + { + "category": "Identifier", + "range": [ + 229, + 233 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 246, + 251 + ] + }, + { + "category": "Identifier", + "range": [ + 253, + 257 + ] + }, + { + "category": "Identifier", + "range": [ + 259, + 263 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 267, + 274 + ] + }, + { + "category": "Identifier", + "range": [ + 275, + 278 + ] + }, + { + "category": "Identifier", + "range": [ + 279, + 283 + ] + } + ], + "range": [ + 267, + 284 + ] + } + ], + "range": [ + 267, + 285 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 286, + 293 + ] + }, + { + "category": "Identifier", + "range": [ + 294, + 297 + ] + }, + { + "category": "Identifier", + "range": [ + 298, + 302 + ] + } + ], + "range": [ + 286, + 303 + ] + } + ], + "range": [ + 286, + 304 + ] + } + ], + "range": [ + 265, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 235, + 308 + ] + } + ], + "range": [ + 206, + 308 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 309 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 309, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 309, + 309 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 309, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 309, + 309 + ], + "number": 4 + } + ] + ], + "paths": [ + "nested-functions.js", + "nested-functions.js" + ], + "oids": [ + "1b9b61a3964ffb047472f21103b352f506252d1f", + "c960aae180e11fcaea00d3e8b5ff586e41e0f2da" + ] + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 1b9b61a..c960aae 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,3 +1,3 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4ce43f40272580f43a9fb8e2b7cdaf164023371b..66f83c285b323ea127caf0550c0dc30e999711af" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "patch": "delete", + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": true, + "range": [ + 103, + 206 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 215, + 221 + ] + }, + { + "category": "Identifier", + "range": [ + 223, + 227 + ] + }, + { + "category": "Identifier", + "range": [ + 229, + 233 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 246, + 251 + ] + }, + { + "category": "Identifier", + "range": [ + 253, + 257 + ] + }, + { + "category": "Identifier", + "range": [ + 259, + 263 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 267, + 274 + ] + }, + { + "category": "Identifier", + "range": [ + 275, + 278 + ] + }, + { + "category": "Identifier", + "range": [ + 279, + 283 + ] + } + ], + "range": [ + 267, + 284 + ] + } + ], + "range": [ + 267, + 285 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 286, + 293 + ] + }, + { + "category": "Identifier", + "range": [ + 294, + 297 + ] + }, + { + "category": "Identifier", + "range": [ + 298, + 302 + ] + } + ], + "range": [ + 286, + 303 + ] + } + ], + "range": [ + 286, + 304 + ] + } + ], + "range": [ + 265, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 237, + 306 + ] + } + ], + "range": [ + 235, + 308 + ] + } + ], + "range": [ + 206, + 308 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "range": [ + 206, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 309 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "patch": "insert", + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": true, + "range": [ + 103, + 206 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 309, + 309 + ] + } + ], + "hasChanges": false, + "range": [ + 309, + 309 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 206, + 206 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 206 + ], + "number": 3 + } + ] + ], + "paths": [ + "nested-functions.js", + "nested-functions.js" + ], + "oids": [ + "c960aae180e11fcaea00d3e8b5ff586e41e0f2da", + "81522c7de2c57509747653614226409aac798ff8" + ] + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index c960aae..81522c7 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,3 +1,2 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + "+function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "66f83c285b323ea127caf0550c0dc30e999711af..f73fd1833e4219f46c9fbf2a4b40b819b299f142" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 112, + 118 + ] + }, + { + "category": "Identifier", + "range": [ + 120, + 124 + ] + }, + { + "category": "Identifier", + "range": [ + 126, + 130 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 143, + 148 + ] + }, + { + "category": "Identifier", + "range": [ + 150, + 154 + ] + }, + { + "category": "Identifier", + "range": [ + 156, + 160 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 164, + 171 + ] + }, + { + "category": "Identifier", + "range": [ + 172, + 175 + ] + }, + { + "category": "Identifier", + "range": [ + 176, + 180 + ] + } + ], + "range": [ + 164, + 181 + ] + } + ], + "range": [ + 164, + 182 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 183, + 190 + ] + }, + { + "category": "Identifier", + "range": [ + 191, + 194 + ] + }, + { + "category": "Identifier", + "range": [ + 195, + 199 + ] + } + ], + "range": [ + 183, + 200 + ] + } + ], + "range": [ + 183, + 201 + ] + } + ], + "range": [ + 162, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 134, + 203 + ] + } + ], + "range": [ + 132, + 205 + ] + } + ], + "range": [ + 103, + 205 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "range": [ + 103, + 206 + ] + } + ], + "hasChanges": false, + "range": [ + 103, + 206 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 206, + 206 + ] + } + ], + "hasChanges": false, + "range": [ + 206, + 206 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 103, + 103 + ] + } + ], + "hasChanges": false, + "range": [ + 103, + 103 + ], + "number": 2 + } + ] + ], + "paths": [ + "nested-functions.js", + "nested-functions.js" + ], + "oids": [ + "81522c7de2c57509747653614226409aac798ff8", + "3056480033bd7114a2ec5dd52e466f4f746952c1" + ] + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 81522c7..3056480 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1,2 +1 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg3); console.log(arg4); } }", + " function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f73fd1833e4219f46c9fbf2a4b40b819b299f142..eef7c0a54cfb951da941ad6f8697f41ee7eabc07" +} +,{ + "testCaseDescription": "javascript-nested-functions-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 9, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 17, + 21 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "trailing_expression_statement", + "children": [ + { + "category": "Function", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 51 + ] + }, + { + "category": "Identifier", + "range": [ + 53, + 57 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 61, + 68 + ] + }, + { + "category": "Identifier", + "range": [ + 69, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 61, + 78 + ] + } + ], + "range": [ + 61, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "MethodCall", + "children": [ + { + "category": "Identifier", + "range": [ + 80, + 87 + ] + }, + { + "category": "Identifier", + "range": [ + 88, + 91 + ] + }, + { + "category": "Identifier", + "range": [ + 92, + 96 + ] + } + ], + "range": [ + 80, + 97 + ] + } + ], + "range": [ + 80, + 98 + ] + } + ], + "range": [ + 59, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 31, + 100 + ] + } + ], + "range": [ + 29, + 102 + ] + } + ], + "range": [ + 0, + 102 + ] + } + ], + "range": [ + 0, + 103 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 103 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 103, + 103 + ] + } + ], + "hasChanges": true, + "range": [ + 103, + 103 + ], + "number": 2 + } + ] + ], + "paths": [ + "nested-functions.js", + "nested-functions.js" + ], + "oids": [ + "3056480033bd7114a2ec5dd52e466f4f746952c1", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "nested-functions.js" + ], + "patch": [ + "diff --git a/nested-functions.js b/nested-functions.js", + "index 3056480..e69de29 100644", + "--- a/nested-functions.js", + "+++ b/nested-functions.js", + "@@ -1 +0,0 @@", + "-function parent (arg1, arg2) { function child (arg3, arg4) { console.log(arg1); console.log(arg2); } }" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "eef7c0a54cfb951da941ad6f8697f41ee7eabc07..1eaceb51f0254fd4621ddd6e017876ef398d5d8e" +}] diff --git a/test/corpus/json/javascript/null.json b/test/corpus/json/javascript/null.json new file mode 100644 index 000000000..c795064d7 --- /dev/null +++ b/test/corpus/json/javascript/null.json @@ -0,0 +1,1400 @@ +[{ + "testCaseDescription": "javascript-null-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 6, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 6, + 6 + ], + "number": 2 + } + ] + ], + "paths": [ + "null.js", + "null.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "ff464d15b288f85c9b313d7db279de2c7bf7061d" + ] + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index e69de29..ff464d1 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -0,0 +1 @@", + "+null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "32100dbe7cbc819422359a14ab7495be3254310f..86f55a90cfe40fbdeeb68022238d81184f0932e0" +} +,{ + "testCaseDescription": "javascript-null-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 6 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 6, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 6 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + } + ] + ], + "paths": [ + "null.js", + "null.js" + ], + "oids": [ + "ff464d15b288f85c9b313d7db279de2c7bf7061d", + "2d3c3e032c12f42ff6f0ce1fce49f512071d403f" + ] + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index ff464d1..2d3c3e0 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1 +1,3 @@", + "+return null;", + "+null;", + " null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "86f55a90cfe40fbdeeb68022238d81184f0932e0..0289269250068ba7071ae26974fd3c8a7ed46ab0" +} +,{ + "testCaseDescription": "javascript-null-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + } + ], + "range": [ + 6, + 11 + ] + } + ], + "range": [ + 6, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 12 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 18 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 4 + } + ] + ], + "paths": [ + "null.js", + "null.js" + ], + "oids": [ + "2d3c3e032c12f42ff6f0ce1fce49f512071d403f", + "3122897c071b31b6350901c14ada2c0bb1b24e4f" + ] + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 2d3c3e0..3122897 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,3 +1,3 @@", + "-return null;", + "+null;", + " null;", + " null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0289269250068ba7071ae26974fd3c8a7ed46ab0..e48a4fe220f501abddbc4a16c44d570b990a3026" +} +,{ + "testCaseDescription": "javascript-null-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + } + ], + "range": [ + 6, + 11 + ] + } + ], + "range": [ + 6, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 12 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 18 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + } + ] + ], + "paths": [ + "null.js", + "null.js" + ], + "oids": [ + "3122897c071b31b6350901c14ada2c0bb1b24e4f", + "2d3c3e032c12f42ff6f0ce1fce49f512071d403f" + ] + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 3122897..2d3c3e0 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,3 +1,3 @@", + "-null;", + "+return null;", + " null;", + " null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e48a4fe220f501abddbc4a16c44d570b990a3026..4983cc8781e012c5884c8f077015d7a4ed689d67" +} +,{ + "testCaseDescription": "javascript-null-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 6, + 18 + ] + } + ], + "range": [ + 6, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 6, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 3 + } + ] + ], + "paths": [ + "null.js", + "null.js" + ], + "oids": [ + "2d3c3e032c12f42ff6f0ce1fce49f512071d403f", + "0eb99c86abfbb4431a5b044161749c789d7864d4" + ] + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 2d3c3e0..0eb99c8 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,3 +1,2 @@", + "-return null;", + "-null;", + " null;", + "+return null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4983cc8781e012c5884c8f077015d7a4ed689d67..cea8b90183ea7a84318980bb1b3934ee54b8a1f1" +} +,{ + "testCaseDescription": "javascript-null-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 6, + 18 + ] + } + ], + "range": [ + 6, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "null.js", + "null.js" + ], + "oids": [ + "0eb99c86abfbb4431a5b044161749c789d7864d4", + "76137ff0e049cae270a489efd5473c201f39cc2f" + ] + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 0eb99c8..76137ff 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1,2 +1 @@", + "-null;", + " return null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "cea8b90183ea7a84318980bb1b3934ee54b8a1f1..5dbd5eecb4a0dac8872d09eca47ac9717eca9abb" +} +,{ + "testCaseDescription": "javascript-null-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "null.js", + "null.js" + ], + "oids": [ + "76137ff0e049cae270a489efd5473c201f39cc2f", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "null.js" + ], + "patch": [ + "diff --git a/null.js b/null.js", + "index 76137ff..e69de29 100644", + "--- a/null.js", + "+++ b/null.js", + "@@ -1 +0,0 @@", + "-return null;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5dbd5eecb4a0dac8872d09eca47ac9717eca9abb..61695447b9d6c99d6fbee197c961837045e9237b" +}] diff --git a/test/corpus/json/javascript/number.json b/test/corpus/json/javascript/number.json new file mode 100644 index 000000000..9f8c0ecdc --- /dev/null +++ b/test/corpus/json/javascript/number.json @@ -0,0 +1,1396 @@ +[{ + "testCaseDescription": "javascript-number-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 4, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 4, + 4 + ], + "number": 2 + } + ] + ], + "paths": [ + "number.js", + "number.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "398050c62c882fa5ebc8d8aaa2e730e70790beeb" + ] + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index e69de29..398050c 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -0,0 +1 @@", + "+101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f099c07f976a3deecc22768c671cc7ff3604a4e7..d2e50ce553db7a088ac51c4b4928cabab02e2ff9" +} +,{ + "testCaseDescription": "javascript-number-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 4, + 8 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 4 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 11 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 12 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 4, + 4 + ] + } + ], + "hasChanges": false, + "range": [ + 4, + 4 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 4 + } + ] + ], + "paths": [ + "number.js", + "number.js" + ], + "oids": [ + "398050c62c882fa5ebc8d8aaa2e730e70790beeb", + "16da476c5eb0a463dd2f919bda7acf6bb56f15c8" + ] + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 398050c..16da476 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1 +1,3 @@", + "+102", + "+101", + " 101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d2e50ce553db7a088ac51c4b4928cabab02e2ff9..0ed8b90e49ac6b90b6e201c3f076f10089eb4498" +} +,{ + "testCaseDescription": "javascript-number-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 4, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 4, + 8 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 11 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 12 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 11 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 12 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 4 + } + ] + ], + "paths": [ + "number.js", + "number.js" + ], + "oids": [ + "16da476c5eb0a463dd2f919bda7acf6bb56f15c8", + "252b3e84820efae4196cb2066888a12a7cc5087d" + ] + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 16da476..252b3e8 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,3 +1,3 @@", + "-102", + "+101", + " 101", + " 101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0ed8b90e49ac6b90b6e201c3f076f10089eb4498..6ddf08fc0a1608bf1654e38b027fcfbb084afb1c" +} +,{ + "testCaseDescription": "javascript-number-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 4, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 4, + 8 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 11 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 12 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 11 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 12 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 4 + } + ] + ], + "paths": [ + "number.js", + "number.js" + ], + "oids": [ + "252b3e84820efae4196cb2066888a12a7cc5087d", + "16da476c5eb0a463dd2f919bda7acf6bb56f15c8" + ] + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 252b3e8..16da476 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,3 +1,3 @@", + "-101", + "+102", + " 101", + " 101" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6ddf08fc0a1608bf1654e38b027fcfbb084afb1c..9083177390beeb4964e0c04c9f14d0b11747a08e" +} +,{ + "testCaseDescription": "javascript-number-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 4, + 8 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 11 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "range": [ + 8, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 12 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 4, + 8 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 3 + } + ] + ], + "paths": [ + "number.js", + "number.js" + ], + "oids": [ + "16da476c5eb0a463dd2f919bda7acf6bb56f15c8", + "bb77dfbdf4e6fac33e22e4caf91084f3a6fccb07" + ] + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 16da476..bb77dfb 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,3 +1,2 @@", + "-102", + "-101", + " 101", + "+102" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9083177390beeb4964e0c04c9f14d0b11747a08e..91a9f6f544a6d00ee6e6578fb3d7934cda974e6f" +} +,{ + "testCaseDescription": "javascript-number-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 4, + 7 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "range": [ + 4, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 4, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 4, + 4 + ] + } + ], + "hasChanges": false, + "range": [ + 4, + 4 + ], + "number": 2 + } + ] + ], + "paths": [ + "number.js", + "number.js" + ], + "oids": [ + "bb77dfbdf4e6fac33e22e4caf91084f3a6fccb07", + "257e563266b43281b3fbb3632ab67ab0d3f314e9" + ] + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index bb77dfb..257e563 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1,2 +1 @@", + "-101", + " 102" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "91a9f6f544a6d00ee6e6578fb3d7934cda974e6f..37cdd671605c31bf8013ad5d9e703390588df7fd" +} +,{ + "testCaseDescription": "javascript-number-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 0, + 3 + ] + } + ], + "range": [ + 0, + 4 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 4 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 4, + 4 + ] + } + ], + "hasChanges": true, + "range": [ + 4, + 4 + ], + "number": 2 + } + ] + ], + "paths": [ + "number.js", + "number.js" + ], + "oids": [ + "257e563266b43281b3fbb3632ab67ab0d3f314e9", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "number.js" + ], + "patch": [ + "diff --git a/number.js b/number.js", + "index 257e563..e69de29 100644", + "--- a/number.js", + "+++ b/number.js", + "@@ -1 +0,0 @@", + "-102" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "37cdd671605c31bf8013ad5d9e703390588df7fd..3accaff544c4d4e390ec737b8c076a43e5d56563" +}] diff --git a/test/corpus/json/javascript/object.json b/test/corpus/json/javascript/object.json new file mode 100644 index 000000000..2e5a92167 --- /dev/null +++ b/test/corpus/json/javascript/object.json @@ -0,0 +1,2414 @@ +[{ + "testCaseDescription": "javascript-object-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 22 + ], + "number": 2 + } + ] + ], + "paths": [ + "object.js", + "object.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "fe17bb20d5e0ada03f8b771d45dcc2d553584145" + ] + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index e69de29..fe17bb2 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -0,0 +1 @@", + "+{ \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "925b73e9fde76236d0b037d687edcc925a5cef9a..ba5e502469d76330934d3f544642168b9a8be48e" +} +,{ + "testCaseDescription": "javascript-object-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 26 + ] + }, + { + "category": "StringLiteral", + "range": [ + 28, + 36 + ] + } + ], + "range": [ + 20, + 36 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 38, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 46, + 51 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 0, + 53 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 54 + ] + } + ], + "range": [ + 0, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 55 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 57, + 73 + ] + } + ], + "range": [ + 55, + 75 + ] + } + ], + "patch": "insert", + "range": [ + 55, + 76 + ] + } + ], + "range": [ + 55, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 55, + 77 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 85 + ] + }, + { + "category": "StringLiteral", + "range": [ + 87, + 95 + ] + } + ], + "range": [ + 79, + 95 + ] + } + ], + "range": [ + 77, + 97 + ] + } + ], + "range": [ + 77, + 98 + ] + } + ], + "range": [ + 77, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 99 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + } + ] + ], + "paths": [ + "object.js", + "object.js" + ], + "oids": [ + "fe17bb20d5e0ada03f8b771d45dcc2d553584145", + "741c3dc18ee0367453de24a06ac75106b0e303a2" + ] + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index fe17bb2..741c3dc 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1 +1,3 @@", + "+{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + "+{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ba5e502469d76330934d3f544642168b9a8be48e..83daa3599047a89477381c86dcc84c654773699f" +} +,{ + "testCaseDescription": "javascript-object-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 26 + ] + }, + { + "category": "StringLiteral", + "range": [ + 28, + 36 + ] + } + ], + "patch": "delete", + "range": [ + 20, + 36 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 38, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 46, + 51 + ] + } + ], + "patch": "delete", + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 0, + 53 + ] + } + ], + "range": [ + 0, + 54 + ] + } + ], + "range": [ + 0, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 55 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 57, + 73 + ] + } + ], + "range": [ + 55, + 75 + ] + } + ], + "range": [ + 55, + 76 + ] + } + ], + "range": [ + 55, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 77 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 32, + 40 + ] + } + ], + "range": [ + 24, + 40 + ] + } + ], + "range": [ + 22, + 42 + ] + } + ], + "range": [ + 22, + 43 + ] + } + ], + "range": [ + 22, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 44 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 85 + ] + }, + { + "category": "StringLiteral", + "range": [ + 87, + 95 + ] + } + ], + "range": [ + 79, + 95 + ] + } + ], + "range": [ + 77, + 97 + ] + } + ], + "range": [ + 77, + 98 + ] + } + ], + "range": [ + 77, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 99 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 46, + 52 + ] + }, + { + "category": "StringLiteral", + "range": [ + 54, + 62 + ] + } + ], + "range": [ + 46, + 62 + ] + } + ], + "range": [ + 44, + 64 + ] + } + ], + "range": [ + 44, + 65 + ] + } + ], + "range": [ + 44, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 66 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 4 + } + ] + ], + "paths": [ + "object.js", + "object.js" + ], + "oids": [ + "741c3dc18ee0367453de24a06ac75106b0e303a2", + "701239d4791062b1b1d6d512a409c2cbeae71cd0" + ] + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 741c3dc..701239d 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,3 +1,3 @@", + "-{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + "+{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "83daa3599047a89477381c86dcc84c654773699f..8b139d9d6374dd725f251e360d9e1b85d4b74527" +} +,{ + "testCaseDescription": "javascript-object-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 26 + ] + }, + { + "category": "StringLiteral", + "range": [ + 28, + 36 + ] + } + ], + "patch": "insert", + "range": [ + 20, + 36 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 38, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 46, + 51 + ] + } + ], + "patch": "insert", + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 0, + 53 + ] + } + ], + "range": [ + 0, + 54 + ] + } + ], + "range": [ + 0, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 55 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 32, + 40 + ] + } + ], + "range": [ + 24, + 40 + ] + } + ], + "range": [ + 22, + 42 + ] + } + ], + "range": [ + 22, + 43 + ] + } + ], + "range": [ + 22, + 44 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 44 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 57, + 73 + ] + } + ], + "range": [ + 55, + 75 + ] + } + ], + "range": [ + 55, + 76 + ] + } + ], + "range": [ + 55, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 77 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 46, + 52 + ] + }, + { + "category": "StringLiteral", + "range": [ + 54, + 62 + ] + } + ], + "range": [ + 46, + 62 + ] + } + ], + "range": [ + 44, + 64 + ] + } + ], + "range": [ + 44, + 65 + ] + } + ], + "range": [ + 44, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 44, + 66 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 85 + ] + }, + { + "category": "StringLiteral", + "range": [ + 87, + 95 + ] + } + ], + "range": [ + 79, + 95 + ] + } + ], + "range": [ + 77, + 97 + ] + } + ], + "range": [ + 77, + 98 + ] + } + ], + "range": [ + 77, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 99 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 66, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 66 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + } + ] + ], + "paths": [ + "object.js", + "object.js" + ], + "oids": [ + "701239d4791062b1b1d6d512a409c2cbeae71cd0", + "741c3dc18ee0367453de24a06ac75106b0e303a2" + ] + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 701239d..741c3dc 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,3 +1,3 @@", + "-{ \"key1\": \"value1\" };", + "+{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + " { \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8b139d9d6374dd725f251e360d9e1b85d4b74527..f1d27fd392c566c9c5d26e2f239387a8079f149e" +} +,{ + "testCaseDescription": "javascript-object-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 26 + ] + }, + { + "category": "StringLiteral", + "range": [ + 28, + 36 + ] + } + ], + "range": [ + 20, + 36 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 38, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 46, + 51 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 0, + 53 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 54 + ] + } + ], + "range": [ + 0, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 55 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 57, + 63 + ] + }, + { + "category": "StringLiteral", + "range": [ + 65, + 73 + ] + } + ], + "range": [ + 57, + 73 + ] + } + ], + "range": [ + 55, + 75 + ] + } + ], + "patch": "delete", + "range": [ + 55, + 76 + ] + } + ], + "range": [ + 55, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 55, + 77 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 79, + 85 + ] + }, + { + "category": "StringLiteral", + "range": [ + 87, + 95 + ] + } + ], + "range": [ + 79, + 95 + ] + } + ], + "range": [ + 77, + 97 + ] + } + ], + "range": [ + 77, + 98 + ] + } + ], + "range": [ + 77, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 99 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 32, + 40 + ] + } + ], + "range": [ + 24, + 40 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 42, + 48 + ] + }, + { + "category": "StringLiteral", + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 42, + 58 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 60, + 66 + ] + }, + { + "category": "StringLiteral", + "range": [ + 68, + 73 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 22, + 75 + ] + } + ], + "patch": "insert", + "range": [ + 22, + 76 + ] + } + ], + "range": [ + 22, + 77 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 77 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 77, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 77 + ], + "number": 3 + } + ] + ], + "paths": [ + "object.js", + "object.js" + ], + "oids": [ + "741c3dc18ee0367453de24a06ac75106b0e303a2", + "9e4827392b43125f3109e099c54540e927e83088" + ] + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 741c3dc..9e48273 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,3 +1,2 @@", + "-{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };", + "-{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\" };", + "+{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f1d27fd392c566c9c5d26e2f239387a8079f149e..eefa16d6784883e1bcc084747522245c8875803d" +} +,{ + "testCaseDescription": "javascript-object-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 24, + 30 + ] + }, + { + "category": "StringLiteral", + "range": [ + 32, + 40 + ] + } + ], + "range": [ + 24, + 40 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 42, + 48 + ] + }, + { + "category": "StringLiteral", + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 42, + 58 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 60, + 66 + ] + }, + { + "category": "StringLiteral", + "range": [ + 68, + 73 + ] + } + ], + "range": [ + 60, + 73 + ] + } + ], + "range": [ + 22, + 75 + ] + } + ], + "range": [ + 22, + 76 + ] + } + ], + "range": [ + 22, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 77 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 26 + ] + }, + { + "category": "StringLiteral", + "range": [ + 28, + 36 + ] + } + ], + "range": [ + 20, + 36 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 38, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 46, + 51 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 0, + 53 + ] + } + ], + "range": [ + 0, + 54 + ] + } + ], + "range": [ + 0, + 55 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 55 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 77, + 77 + ] + } + ], + "hasChanges": false, + "range": [ + 77, + 77 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 55, + 55 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 55 + ], + "number": 2 + } + ] + ], + "paths": [ + "object.js", + "object.js" + ], + "oids": [ + "9e4827392b43125f3109e099c54540e927e83088", + "12d063ad120ecce823ab0d7a5bce83c59a522751" + ] + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 9e48273..12d063a 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1,2 +1 @@", + "-{ \"key1\": \"value1\" };", + " { \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "eefa16d6784883e1bcc084747522245c8875803d..a9f043663130ffeeb0a948413011e9a72886d277" +} +,{ + "testCaseDescription": "javascript-object-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 2, + 8 + ] + }, + { + "category": "StringLiteral", + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 2, + 18 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 20, + 26 + ] + }, + { + "category": "StringLiteral", + "range": [ + 28, + 36 + ] + } + ], + "range": [ + 20, + 36 + ] + }, + { + "category": "Pair", + "children": [ + { + "category": "StringLiteral", + "range": [ + 38, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 46, + 51 + ] + } + ], + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 0, + 53 + ] + } + ], + "range": [ + 0, + 54 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 55 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 55, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 55, + 55 + ], + "number": 2 + } + ] + ], + "paths": [ + "object.js", + "object.js" + ], + "oids": [ + "12d063ad120ecce823ab0d7a5bce83c59a522751", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "object.js" + ], + "patch": [ + "diff --git a/object.js b/object.js", + "index 12d063a..e69de29 100644", + "--- a/object.js", + "+++ b/object.js", + "@@ -1 +0,0 @@", + "-{ \"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"3.0\" };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a9f043663130ffeeb0a948413011e9a72886d277..193d1078ef93cde9a03725d1f4b6a42b856754d3" +}] diff --git a/test/corpus/json/javascript/objects-with-methods.json b/test/corpus/json/javascript/objects-with-methods.json new file mode 100644 index 000000000..20e83a57c --- /dev/null +++ b/test/corpus/json/javascript/objects-with-methods.json @@ -0,0 +1,3060 @@ +[{ + "testCaseDescription": "javascript-objects-with-methods-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + }, + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 2, + 29 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 33 + ], + "number": 2 + } + ] + ], + "paths": [ + "objects-with-methods.js", + "objects-with-methods.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "7421e188d46cf98be199f3d272591a65ddc29ef1" + ] + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index e69de29..7421e18 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -0,0 +1 @@", + "+{ add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d85c24526768ef13d44a0e8cce5aefe270e43c4a..8eea4fae7706338a3f452fd4bd3055b37c97016a" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 19, + 32 + ] + } + ], + "range": [ + 2, + 34 + ] + } + ], + "range": [ + 0, + 36 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 64 + ] + } + ], + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 52, + 65 + ] + } + ], + "range": [ + 40, + 67 + ] + } + ], + "range": [ + 38, + 69 + ] + } + ], + "patch": "insert", + "range": [ + 38, + 70 + ] + } + ], + "range": [ + 38, + 71 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 71 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + }, + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 2, + 29 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 76 + ] + }, + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + }, + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + } + ], + "range": [ + 92, + 97 + ] + } + ], + "range": [ + 85, + 98 + ] + } + ], + "range": [ + 73, + 100 + ] + } + ], + "range": [ + 71, + 102 + ] + } + ], + "range": [ + 71, + 103 + ] + } + ], + "range": [ + 71, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 71, + 104 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 104, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 104, + 104 + ], + "number": 4 + } + ] + ], + "paths": [ + "objects-with-methods.js", + "objects-with-methods.js" + ], + "oids": [ + "7421e188d46cf98be199f3d272591a65ddc29ef1", + "59eb3a3df5e42ec577cadd4b85d82b33ffd2c610" + ] + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 7421e18..59eb3a3 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1 +1,3 @@", + "+{ subtract(a, b) { return a - b; } };", + "+{ add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8eea4fae7706338a3f452fd4bd3055b37c97016a..6eff566d865d623bc9da78e1d3effc0e71359b64" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 19, + 32 + ] + } + ], + "range": [ + 2, + 34 + ] + } + ], + "range": [ + 0, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + }, + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 2, + 29 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 64 + ] + } + ], + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 52, + 65 + ] + } + ], + "range": [ + 40, + 67 + ] + } + ], + "range": [ + 38, + 69 + ] + } + ], + "range": [ + 38, + 70 + ] + } + ], + "range": [ + 38, + 71 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 71 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "range": [ + 54, + 59 + ] + } + ], + "range": [ + 47, + 60 + ] + } + ], + "range": [ + 35, + 62 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 76 + ] + }, + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + }, + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + } + ], + "range": [ + 92, + 97 + ] + } + ], + "range": [ + 85, + 98 + ] + } + ], + "range": [ + 73, + 100 + ] + } + ], + "range": [ + 71, + 102 + ] + } + ], + "range": [ + 71, + 103 + ] + } + ], + "range": [ + 71, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 71, + 104 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 73 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 68, + 95 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 104, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 104, + 104 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + } + ] + ], + "paths": [ + "objects-with-methods.js", + "objects-with-methods.js" + ], + "oids": [ + "59eb3a3df5e42ec577cadd4b85d82b33ffd2c610", + "05689b17622c4729be0642be57c9cfbe2abe692b" + ] + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 59eb3a3..05689b1 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,3 +1,3 @@", + "-{ subtract(a, b) { return a - b; } };", + "+{ add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6eff566d865d623bc9da78e1d3effc0e71359b64..5e157004b3bbcf754390b5ea0b16a1293f239d41" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + }, + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 2, + 29 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 19, + 32 + ] + } + ], + "range": [ + 2, + 34 + ] + } + ], + "range": [ + 0, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 38 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 55 + ] + }, + { + "category": "Identifier", + "range": [ + 58, + 59 + ] + } + ], + "range": [ + 54, + 59 + ] + } + ], + "range": [ + 47, + 60 + ] + } + ], + "range": [ + 35, + 62 + ] + } + ], + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 64 + ] + } + ], + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 52, + 65 + ] + } + ], + "range": [ + 40, + 67 + ] + } + ], + "range": [ + 38, + 69 + ] + } + ], + "range": [ + 38, + 70 + ] + } + ], + "range": [ + 38, + 71 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 71 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 68, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 73 + ] + }, + { + "category": "Identifier", + "range": [ + 75, + 76 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 87, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 92 + ] + } + ], + "range": [ + 87, + 92 + ] + } + ], + "range": [ + 80, + 93 + ] + } + ], + "range": [ + 68, + 95 + ] + } + ], + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 76 + ] + }, + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + }, + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + } + ], + "range": [ + 92, + 97 + ] + } + ], + "range": [ + 85, + 98 + ] + } + ], + "range": [ + 73, + 100 + ] + } + ], + "range": [ + 71, + 102 + ] + } + ], + "range": [ + 71, + 103 + ] + } + ], + "range": [ + 71, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 71, + 104 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 104, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 104, + 104 + ], + "number": 4 + } + ] + ], + "paths": [ + "objects-with-methods.js", + "objects-with-methods.js" + ], + "oids": [ + "05689b17622c4729be0642be57c9cfbe2abe692b", + "59eb3a3df5e42ec577cadd4b85d82b33ffd2c610" + ] + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 05689b1..59eb3a3 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,3 +1,3 @@", + "-{ add(a, b) { return a + b; } };", + "+{ subtract(a, b) { return a - b; } };", + " { add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5e157004b3bbcf754390b5ea0b16a1293f239d41..c31bcd1e44f97b7db87ff2b5a6cf0406e0d9e081" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 19, + 32 + ] + } + ], + "range": [ + 2, + 34 + ] + } + ], + "range": [ + 0, + 36 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 40, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 64 + ] + } + ], + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 52, + 65 + ] + } + ], + "range": [ + 40, + 67 + ] + } + ], + "range": [ + 38, + 69 + ] + } + ], + "patch": "delete", + "range": [ + 38, + 70 + ] + } + ], + "range": [ + 38, + 71 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 71 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 73, + 76 + ] + }, + { + "category": "Identifier", + "range": [ + 77, + 78 + ] + }, + { + "category": "Identifier", + "range": [ + 80, + 81 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 92, + 93 + ] + }, + { + "category": "Identifier", + "range": [ + 96, + 97 + ] + } + ], + "range": [ + 92, + 97 + ] + } + ], + "range": [ + 85, + 98 + ] + } + ], + "range": [ + 73, + 100 + ] + } + ], + "range": [ + 71, + 102 + ] + } + ], + "range": [ + 71, + 103 + ] + } + ], + "range": [ + 71, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 71, + 104 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + }, + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 2, + 29 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 64 + ] + } + ], + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 52, + 65 + ] + } + ], + "range": [ + 35, + 67 + ] + } + ], + "range": [ + 33, + 69 + ] + } + ], + "patch": "insert", + "range": [ + 33, + 70 + ] + } + ], + "range": [ + 33, + 71 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 71 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 104, + 104 + ] + } + ], + "hasChanges": false, + "range": [ + 104, + 104 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 71, + 71 + ] + } + ], + "hasChanges": false, + "range": [ + 71, + 71 + ], + "number": 3 + } + ] + ], + "paths": [ + "objects-with-methods.js", + "objects-with-methods.js" + ], + "oids": [ + "59eb3a3df5e42ec577cadd4b85d82b33ffd2c610", + "29d3998790b8e7722b7d1167dd0feb5e14f11be8" + ] + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 59eb3a3..29d3998 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,3 +1,2 @@", + "-{ subtract(a, b) { return a - b; } };", + "-{ add(a, b) { return a + b; } };", + " { add(a, b) { return a + b; } };", + "+{ subtract(a, b) { return a - b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c31bcd1e44f97b7db87ff2b5a6cf0406e0d9e081..9224e4bb69acfd7cae9b2c42bef700ee0193975f" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 5 + ] + }, + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + }, + { + "category": "Identifier", + "range": [ + 9, + 10 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 21, + 22 + ] + }, + { + "category": "Identifier", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 21, + 26 + ] + } + ], + "range": [ + 14, + 27 + ] + } + ], + "range": [ + 2, + 29 + ] + } + ], + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 43 + ] + }, + { + "category": "Identifier", + "range": [ + 44, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + }, + { + "category": "Identifier", + "range": [ + 63, + 64 + ] + } + ], + "range": [ + 59, + 64 + ] + } + ], + "range": [ + 52, + 65 + ] + } + ], + "range": [ + 35, + 67 + ] + } + ], + "range": [ + 33, + 69 + ] + } + ], + "range": [ + 33, + 70 + ] + } + ], + "range": [ + 33, + 71 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 71 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 19, + 32 + ] + } + ], + "range": [ + 2, + 34 + ] + } + ], + "range": [ + 0, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 71, + 71 + ] + } + ], + "hasChanges": false, + "range": [ + 71, + 71 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 38, + 38 + ] + } + ], + "hasChanges": false, + "range": [ + 38, + 38 + ], + "number": 2 + } + ] + ], + "paths": [ + "objects-with-methods.js", + "objects-with-methods.js" + ], + "oids": [ + "29d3998790b8e7722b7d1167dd0feb5e14f11be8", + "80ad7f08d4faf3fc14918a3a60ce664a5e4a6700" + ] + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 29d3998..80ad7f0 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1,2 +1 @@", + "-{ add(a, b) { return a + b; } };", + " { subtract(a, b) { return a - b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9224e4bb69acfd7cae9b2c42bef700ee0193975f..09865379a4ced5df31bdfc3432abeeb525fa8b53" +} +,{ + "testCaseDescription": "javascript-objects-with-methods-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Object", + "children": [ + { + "category": "Method", + "children": [ + { + "category": "Identifier", + "range": [ + 2, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + }, + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Return", + "children": [ + { + "category": "MathOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 19, + 32 + ] + } + ], + "range": [ + 2, + 34 + ] + } + ], + "range": [ + 0, + 36 + ] + } + ], + "range": [ + 0, + 37 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 38 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 38, + 38 + ] + } + ], + "hasChanges": true, + "range": [ + 38, + 38 + ], + "number": 2 + } + ] + ], + "paths": [ + "objects-with-methods.js", + "objects-with-methods.js" + ], + "oids": [ + "80ad7f08d4faf3fc14918a3a60ce664a5e4a6700", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "objects-with-methods.js" + ], + "patch": [ + "diff --git a/objects-with-methods.js b/objects-with-methods.js", + "index 80ad7f0..e69de29 100644", + "--- a/objects-with-methods.js", + "+++ b/objects-with-methods.js", + "@@ -1 +0,0 @@", + "-{ subtract(a, b) { return a - b; } };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "09865379a4ced5df31bdfc3432abeeb525fa8b53..b4b7955f8a8306e856b260875bdf3039b29612a8" +}] diff --git a/test/corpus/json/javascript/regex.json b/test/corpus/json/javascript/regex.json new file mode 100644 index 000000000..3a165733e --- /dev/null +++ b/test/corpus/json/javascript/regex.json @@ -0,0 +1,1396 @@ +[{ + "testCaseDescription": "javascript-regex-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "regex.js", + "regex.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "b3818424d73f7c45817c6f976bc00d9363144460" + ] + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index e69de29..b381842 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -0,0 +1 @@", + "+/one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "38a4e343f701a84082bcd768e0389e8f827f85af..edc82ef64657537a6745a77405f29336c5f416bc" +} +,{ + "testCaseDescription": "javascript-regex-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 16, + 22 + ] + } + ], + "patch": "insert", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 16, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 32 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 4 + } + ] + ], + "paths": [ + "regex.js", + "regex.js" + ], + "oids": [ + "b3818424d73f7c45817c6f976bc00d9363144460", + "6ed4b424fdb93d355b5c6cd4180e600bfc0595de" + ] + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index b381842..6ed4b42 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1 +1,3 @@", + "+/on[^/]afe/gim;", + "+/one/g;", + " /one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "edc82ef64657537a6745a77405f29336c5f416bc..88ff755ad131e5c05f0c6abcdae6b8e2f77f39a6" +} +,{ + "testCaseDescription": "javascript-regex-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "patch": "replace", + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "patch": "replace", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 32 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "regex.js", + "regex.js" + ], + "oids": [ + "6ed4b424fdb93d355b5c6cd4180e600bfc0595de", + "abb87ec8eee8efba03b51ea7c72bd7006ced248d" + ] + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 6ed4b42..abb87ec 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,3 +1,3 @@", + "-/on[^/]afe/gim;", + "+/one/g;", + " /one/g;", + " /one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "88ff755ad131e5c05f0c6abcdae6b8e2f77f39a6..10bb41b3b3a4df65d6616fc5d0e514ddad71ed9a" +} +,{ + "testCaseDescription": "javascript-regex-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "patch": "replace", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "patch": "replace", + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 32 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 4 + } + ] + ], + "paths": [ + "regex.js", + "regex.js" + ], + "oids": [ + "abb87ec8eee8efba03b51ea7c72bd7006ced248d", + "6ed4b424fdb93d355b5c6cd4180e600bfc0595de" + ] + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index abb87ec..6ed4b42 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,3 +1,3 @@", + "-/one/g;", + "+/on[^/]afe/gim;", + " /one/g;", + " /one/g;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "10bb41b3b3a4df65d6616fc5d0e514ddad71ed9a..ffde850e3fe4fca0dfac3eb57899101e15b22d4c" +} +,{ + "testCaseDescription": "javascript-regex-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 14 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 16, + 22 + ] + } + ], + "patch": "delete", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 16, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 24, + 30 + ] + } + ], + "range": [ + 24, + 31 + ] + } + ], + "range": [ + 24, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 32 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 8, + 22 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 23 + ] + } + ], + "range": [ + 8, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 32, + 32 + ] + } + ], + "hasChanges": false, + "range": [ + 32, + 32 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 3 + } + ] + ], + "paths": [ + "regex.js", + "regex.js" + ], + "oids": [ + "6ed4b424fdb93d355b5c6cd4180e600bfc0595de", + "9f57e9197e0a21f3959215851536cad98f8a0b93" + ] + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 6ed4b42..9f57e91 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,3 +1,2 @@", + "-/on[^/]afe/gim;", + "-/one/g;", + " /one/g;", + "+/on[^/]afe/gim;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ffde850e3fe4fca0dfac3eb57899101e15b22d4c..c1a636c92ae8fafe7a7bb251771d96306e59297c" +} +,{ + "testCaseDescription": "javascript-regex-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 8, + 22 + ] + } + ], + "range": [ + 8, + 23 + ] + } + ], + "range": [ + 8, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 24 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 2 + } + ] + ], + "paths": [ + "regex.js", + "regex.js" + ], + "oids": [ + "9f57e9197e0a21f3959215851536cad98f8a0b93", + "9b04194db65414727487376cf72803fa747f0939" + ] + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 9f57e91..9b04194 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1,2 +1 @@", + "-/one/g;", + " /on[^/]afe/gim;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c1a636c92ae8fafe7a7bb251771d96306e59297c..598fffd310ec3abebf3f54dbdd383ef2c1a10689" +} +,{ + "testCaseDescription": "javascript-regex-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Regex", + "range": [ + 0, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 16 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 16, + 16 + ], + "number": 2 + } + ] + ], + "paths": [ + "regex.js", + "regex.js" + ], + "oids": [ + "9b04194db65414727487376cf72803fa747f0939", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "regex.js" + ], + "patch": [ + "diff --git a/regex.js b/regex.js", + "index 9b04194..e69de29 100644", + "--- a/regex.js", + "+++ b/regex.js", + "@@ -1 +0,0 @@", + "-/on[^/]afe/gim;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "598fffd310ec3abebf3f54dbdd383ef2c1a10689..1414e435bed741828bc662b2617b65f006198115" +}] diff --git a/test/corpus/json/javascript/relational-operator.json b/test/corpus/json/javascript/relational-operator.json new file mode 100644 index 000000000..2e95a92f4 --- /dev/null +++ b/test/corpus/json/javascript/relational-operator.json @@ -0,0 +1,1804 @@ +[{ + "testCaseDescription": "javascript-relational-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 7, + 7 + ], + "number": 2 + } + ] + ], + "paths": [ + "relational-operator.js", + "relational-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "4021910f3d29e1915cf66201d9558dfa1b19fa8d" + ] + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index e69de29..4021910 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -0,0 +1 @@", + "+x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ba72732ac272c8ae8487ba0af9045dea54eb02d9..3e474168119e157dd78cc58193422367455f7d4b" +} +,{ + "testCaseDescription": "javascript-relational-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 8, + 13 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 15 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 15, + 21 + ] + } + ], + "range": [ + 15, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 15, + 22 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 7, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 7 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 4 + } + ] + ], + "paths": [ + "relational-operator.js", + "relational-operator.js" + ], + "oids": [ + "4021910f3d29e1915cf66201d9558dfa1b19fa8d", + "dbef0501d91f214d6bb08756d1447824b8eccd54" + ] + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index 4021910..dbef050 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1 +1,3 @@", + "+x <= y;", + "+x < y;", + " x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3e474168119e157dd78cc58193422367455f7d4b..80299a9d43818b539001b6d79fc5b2a4060e7c51" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 8, + 13 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 15 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 15, + 21 + ] + } + ], + "range": [ + 15, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 15, + 22 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + } + ] + ], + "paths": [ + "relational-operator.js", + "relational-operator.js" + ], + "oids": [ + "dbef0501d91f214d6bb08756d1447824b8eccd54", + "a9ff7f65a167feb135388b62a3375a6e7d235472" + ] + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index dbef050..a9ff7f6 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,3 +1,3 @@", + "-x <= y;", + "+x < y;", + " x < y;", + " x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "80299a9d43818b539001b6d79fc5b2a4060e7c51..d908f67a8ee9d6610371bb8343c67b172f915b23" +} +,{ + "testCaseDescription": "javascript-relational-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 12 + ] + } + ], + "range": [ + 7, + 12 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 14 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 8, + 13 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 15 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + }, + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + } + ], + "range": [ + 14, + 19 + ] + } + ], + "range": [ + 14, + 20 + ] + } + ], + "range": [ + 14, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 14, + 21 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 15, + 21 + ] + } + ], + "range": [ + 15, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 15, + 22 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 4 + } + ] + ], + "paths": [ + "relational-operator.js", + "relational-operator.js" + ], + "oids": [ + "a9ff7f65a167feb135388b62a3375a6e7d235472", + "dbef0501d91f214d6bb08756d1447824b8eccd54" + ] + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index a9ff7f6..dbef050 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,3 +1,3 @@", + "-x < y;", + "+x <= y;", + " x < y;", + " x < y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d908f67a8ee9d6610371bb8343c67b172f915b23..b553dcd439cdfb5d1b6846389ed69bbff93ada3d" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 8, + 13 + ] + } + ], + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 15 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 15, + 21 + ] + } + ], + "range": [ + 15, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 15, + 22 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "range": [ + 7, + 15 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 15 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 15, + 15 + ] + } + ], + "hasChanges": false, + "range": [ + 15, + 15 + ], + "number": 3 + } + ] + ], + "paths": [ + "relational-operator.js", + "relational-operator.js" + ], + "oids": [ + "dbef0501d91f214d6bb08756d1447824b8eccd54", + "1ee42eb93693db35c67b8f9dcad91d058bbb4ba0" + ] + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index dbef050..1ee42eb 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,3 +1,2 @@", + "-x <= y;", + "-x < y;", + " x < y;", + "+x <= y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b553dcd439cdfb5d1b6846389ed69bbff93ada3d..b0570894175ea4fdd408d62919b08db9d82eac0d" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 7 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 14 + ] + } + ], + "range": [ + 7, + 15 + ] + } + ], + "hasChanges": false, + "range": [ + 7, + 15 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 15, + 15 + ] + } + ], + "hasChanges": false, + "range": [ + 15, + 15 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "relational-operator.js", + "relational-operator.js" + ], + "oids": [ + "1ee42eb93693db35c67b8f9dcad91d058bbb4ba0", + "3be8450fc04aa724c72a21d9fa334afdaf09acac" + ] + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index 1ee42eb..3be8450 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1,2 +1 @@", + "-x < y;", + " x <= y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b0570894175ea4fdd408d62919b08db9d82eac0d..f90601d7c97c8e74625f9724a011cb40ee870ec2" +} +,{ + "testCaseDescription": "javascript-relational-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "RelationalOperator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "relational-operator.js", + "relational-operator.js" + ], + "oids": [ + "3be8450fc04aa724c72a21d9fa334afdaf09acac", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "relational-operator.js" + ], + "patch": [ + "diff --git a/relational-operator.js b/relational-operator.js", + "index 3be8450..e69de29 100644", + "--- a/relational-operator.js", + "+++ b/relational-operator.js", + "@@ -1 +0,0 @@", + "-x <= y;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f90601d7c97c8e74625f9724a011cb40ee870ec2..6ca5e77d4063360bcd0a90d891c3e81e09835b84" +}] diff --git a/test/corpus/json/javascript/return-statement.json b/test/corpus/json/javascript/return-statement.json new file mode 100644 index 000000000..b16c17890 --- /dev/null +++ b/test/corpus/json/javascript/return-statement.json @@ -0,0 +1,1334 @@ +[{ + "testCaseDescription": "javascript-return-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 10, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 10, + 10 + ], + "number": 2 + } + ] + ], + "paths": [ + "return-statement.js", + "return-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "63150293528b8f92a51906e7d0eec0b779aa453c" + ] + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index e69de29..6315029 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -0,0 +1 @@", + "+return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9fdae081cef5395f539eef79836a911574344379..a6519eaebdf537fde59ebe64592c4809e1687d84" +} +,{ + "testCaseDescription": "javascript-return-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "patch": "insert", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 17 + ] + } + ], + "range": [ + 8, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 10 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 28 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 10, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 10 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + } + ] + ], + "paths": [ + "return-statement.js", + "return-statement.js" + ], + "oids": [ + "63150293528b8f92a51906e7d0eec0b779aa453c", + "22dde951c6fc9abc659cc72626caa6cda8205669" + ] + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 6315029..22dde95 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1 +1,3 @@", + "+return;", + "+return 5;", + " return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a6519eaebdf537fde59ebe64592c4809e1687d84..70590b307748041027a3074e4e8568ae9bbea413" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "patch": "insert", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 8, + 17 + ] + } + ], + "range": [ + 8, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + } + ], + "range": [ + 10, + 19 + ] + } + ], + "range": [ + 10, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 20 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 28 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 20, + 29 + ] + } + ], + "range": [ + 20, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 30 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 30, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 30, + 30 + ], + "number": 4 + } + ] + ], + "paths": [ + "return-statement.js", + "return-statement.js" + ], + "oids": [ + "22dde951c6fc9abc659cc72626caa6cda8205669", + "522349cd232eb2ae5f60d649e4b05d504c4a40b3" + ] + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 22dde95..522349c 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,3 +1,3 @@", + "-return;", + "+return 5;", + " return 5;", + " return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "70590b307748041027a3074e4e8568ae9bbea413..21febb1d7f52af48f7d71d6b063371ae1e7ee66c" +} +,{ + "testCaseDescription": "javascript-return-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "patch": "delete", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 17, + 18 + ] + } + ], + "range": [ + 10, + 19 + ] + } + ], + "range": [ + 10, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 20 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 8, + 17 + ] + } + ], + "range": [ + 8, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 20, + 29 + ] + } + ], + "range": [ + 20, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 30 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 28 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 30, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 30, + 30 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + } + ] + ], + "paths": [ + "return-statement.js", + "return-statement.js" + ], + "oids": [ + "522349cd232eb2ae5f60d649e4b05d504c4a40b3", + "22dde951c6fc9abc659cc72626caa6cda8205669" + ] + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 522349c..22dde95 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,3 +1,3 @@", + "-return 5;", + "+return;", + " return 5;", + " return 5;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "21febb1d7f52af48f7d71d6b063371ae1e7ee66c..8b962deb58f1b589be0cdede381164f4c8b02fac" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 15, + 16 + ] + } + ], + "patch": "delete", + "range": [ + 8, + 17 + ] + } + ], + "range": [ + 8, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 25, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 28 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "patch": "insert", + "range": [ + 10, + 17 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 10, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 28, + 28 + ] + } + ], + "hasChanges": false, + "range": [ + 28, + 28 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 3 + } + ] + ], + "paths": [ + "return-statement.js", + "return-statement.js" + ], + "oids": [ + "22dde951c6fc9abc659cc72626caa6cda8205669", + "4d44d6ac3898047ed4db33654eb4ab548be2690d" + ] + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 22dde95..4d44d6a 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,3 +1,2 @@", + "-return;", + "-return 5;", + " return 5;", + "+return;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8b962deb58f1b589be0cdede381164f4c8b02fac..90bc3b8759268da9a86a1e27674f462916546ca8" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 7, + 8 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "range": [ + 10, + 17 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "return-statement.js", + "return-statement.js" + ], + "oids": [ + "4d44d6ac3898047ed4db33654eb4ab548be2690d", + "f312410bd34c623a6ade23a58fdbe161663518a2" + ] + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index 4d44d6a..f312410 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1,2 +1 @@", + "-return 5;", + " return;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "90bc3b8759268da9a86a1e27674f462916546ca8..e60ebebf754719b6c7025fd60e409ca738c7dec6" +} +,{ + "testCaseDescription": "javascript-return-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [], + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "return-statement.js", + "return-statement.js" + ], + "oids": [ + "f312410bd34c623a6ade23a58fdbe161663518a2", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "return-statement.js" + ], + "patch": [ + "diff --git a/return-statement.js b/return-statement.js", + "index f312410..e69de29 100644", + "--- a/return-statement.js", + "+++ b/return-statement.js", + "@@ -1 +0,0 @@", + "-return;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e60ebebf754719b6c7025fd60e409ca738c7dec6..3a0405bd7047ac7693031b2b8fc3060c111cc827" +}] diff --git a/test/corpus/json/javascript/string.json b/test/corpus/json/javascript/string.json new file mode 100644 index 000000000..bec607d5c --- /dev/null +++ b/test/corpus/json/javascript/string.json @@ -0,0 +1,1396 @@ +[{ + "testCaseDescription": "javascript-string-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 33 + ], + "number": 2 + } + ] + ], + "paths": [ + "string.js", + "string.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "ea5bd4251f8205df1cae5ad619f03d5678c1dd27" + ] + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index e69de29..ea5bd42 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -0,0 +1 @@", + "+'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b4b7955f8a8306e856b260875bdf3039b29612a8..1ae82ffe90486e07c465d7ef6d1c187adaea9f57" +} +,{ + "testCaseDescription": "javascript-string-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 41 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 43, + 74 + ] + } + ], + "patch": "insert", + "range": [ + 43, + 75 + ] + } + ], + "range": [ + 43, + 76 + ] + } + ], + "hasChanges": true, + "range": [ + 43, + 76 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 76, + 107 + ] + } + ], + "range": [ + 76, + 108 + ] + } + ], + "range": [ + 76, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 76, + 109 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 109, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 109, + 109 + ], + "number": 4 + } + ] + ], + "paths": [ + "string.js", + "string.js" + ], + "oids": [ + "ea5bd4251f8205df1cae5ad619f03d5678c1dd27", + "5cef047e9e767f816c969a8cd9ea312aaa7651ea" + ] + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index ea5bd42..5cef047 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1 +1,3 @@", + "+'A different string with \"double\" quotes';", + "+'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1ae82ffe90486e07c465d7ef6d1c187adaea9f57..1aaf4eb23170cf9fbb6ba792fcad78a69c7cc718" +} +,{ + "testCaseDescription": "javascript-string-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 43, + 74 + ] + } + ], + "range": [ + 43, + 75 + ] + } + ], + "range": [ + 43, + 76 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 76 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 76, + 107 + ] + } + ], + "range": [ + 76, + 108 + ] + } + ], + "range": [ + 76, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 76, + 109 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 109, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 109, + 109 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + } + ] + ], + "paths": [ + "string.js", + "string.js" + ], + "oids": [ + "5cef047e9e767f816c969a8cd9ea312aaa7651ea", + "7af39a55332095da6a9805ed6ab693ed8fabe6e7" + ] + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 5cef047..7af39a5 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,3 +1,3 @@", + "-'A different string with \"double\" quotes';", + "+'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1aaf4eb23170cf9fbb6ba792fcad78a69c7cc718..f2605de89ead3607784d2290a6c252eb77d19d48" +} +,{ + "testCaseDescription": "javascript-string-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 33, + 64 + ] + } + ], + "range": [ + 33, + 65 + ] + } + ], + "range": [ + 33, + 66 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 66 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 43, + 74 + ] + } + ], + "range": [ + 43, + 75 + ] + } + ], + "range": [ + 43, + 76 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 76 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 66, + 97 + ] + } + ], + "range": [ + 66, + 98 + ] + } + ], + "range": [ + 66, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 66, + 99 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 76, + 107 + ] + } + ], + "range": [ + 76, + 108 + ] + } + ], + "range": [ + 76, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 76, + 109 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 99, + 99 + ] + } + ], + "hasChanges": false, + "range": [ + 99, + 99 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 109, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 109, + 109 + ], + "number": 4 + } + ] + ], + "paths": [ + "string.js", + "string.js" + ], + "oids": [ + "7af39a55332095da6a9805ed6ab693ed8fabe6e7", + "5cef047e9e767f816c969a8cd9ea312aaa7651ea" + ] + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 7af39a5..5cef047 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,3 +1,3 @@", + "-'A string with \"double\" quotes';", + "+'A different string with \"double\" quotes';", + " 'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f2605de89ead3607784d2290a6c252eb77d19d48..0d6c84d2451d8516113faa5e7ba3f7c16d677d77" +} +,{ + "testCaseDescription": "javascript-string-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 41 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 43, + 74 + ] + } + ], + "patch": "delete", + "range": [ + 43, + 75 + ] + } + ], + "range": [ + 43, + 76 + ] + } + ], + "hasChanges": true, + "range": [ + 43, + 76 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 76, + 107 + ] + } + ], + "range": [ + 76, + 108 + ] + } + ], + "range": [ + 76, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 76, + 109 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 31 + ] + } + ], + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 33, + 74 + ] + } + ], + "patch": "insert", + "range": [ + 33, + 75 + ] + } + ], + "range": [ + 33, + 76 + ] + } + ], + "hasChanges": true, + "range": [ + 33, + 76 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 109, + 109 + ] + } + ], + "hasChanges": false, + "range": [ + 109, + 109 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 76, + 76 + ] + } + ], + "hasChanges": false, + "range": [ + 76, + 76 + ], + "number": 3 + } + ] + ], + "paths": [ + "string.js", + "string.js" + ], + "oids": [ + "5cef047e9e767f816c969a8cd9ea312aaa7651ea", + "8dd4514f6c095a130233078e41cc3f60d0b1612e" + ] + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 5cef047..8dd4514 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,3 +1,2 @@", + "-'A different string with \"double\" quotes';", + "-'A string with \"double\" quotes';", + " 'A string with \"double\" quotes';", + "+'A different string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0d6c84d2451d8516113faa5e7ba3f7c16d677d77..487e572b835a23965a17ef170fae6f8923c80207" +} +,{ + "testCaseDescription": "javascript-string-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 31 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 32 + ] + } + ], + "range": [ + 0, + 33 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 33 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 33, + 74 + ] + } + ], + "range": [ + 33, + 75 + ] + } + ], + "range": [ + 33, + 76 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 76 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 76, + 76 + ] + } + ], + "hasChanges": false, + "range": [ + 76, + 76 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 43, + 43 + ] + } + ], + "hasChanges": false, + "range": [ + 43, + 43 + ], + "number": 2 + } + ] + ], + "paths": [ + "string.js", + "string.js" + ], + "oids": [ + "8dd4514f6c095a130233078e41cc3f60d0b1612e", + "95fbde5dc8ec86189b6e5ebce7bcb8de25788390" + ] + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 8dd4514..95fbde5 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1,2 +1 @@", + "-'A string with \"double\" quotes';", + " 'A different string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "487e572b835a23965a17ef170fae6f8923c80207..898024c3d9b85c0c58a8615a308c6064aebaa0b0" +} +,{ + "testCaseDescription": "javascript-string-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "StringLiteral", + "range": [ + 0, + 41 + ] + } + ], + "range": [ + 0, + 42 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 43 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 43, + 43 + ] + } + ], + "hasChanges": true, + "range": [ + 43, + 43 + ], + "number": 2 + } + ] + ], + "paths": [ + "string.js", + "string.js" + ], + "oids": [ + "95fbde5dc8ec86189b6e5ebce7bcb8de25788390", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "string.js" + ], + "patch": [ + "diff --git a/string.js b/string.js", + "index 95fbde5..e69de29 100644", + "--- a/string.js", + "+++ b/string.js", + "@@ -1 +0,0 @@", + "-'A different string with \"double\" quotes';" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "898024c3d9b85c0c58a8615a308c6064aebaa0b0..f099c07f976a3deecc22768c671cc7ff3604a4e7" +}] diff --git a/test/corpus/json/javascript/subscript-access-assignment.json b/test/corpus/json/javascript/subscript-access-assignment.json new file mode 100644 index 000000000..5cd66cabb --- /dev/null +++ b/test/corpus/json/javascript/subscript-access-assignment.json @@ -0,0 +1,2228 @@ +[{ + "testCaseDescription": "javascript-subscript-access-assignment-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 12, + 12 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-assignment.js", + "subscript-access-assignment.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "6b6d48d2b046607da97eaaad0feb91195c3a2fea" + ] + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index e69de29..6b6d48d 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -0,0 +1 @@", + "+y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6a942b8c8b6674795040d75810b847dd6dbf37e4..3ac2b12795f6310d1062f1d3357234b9039ef595" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "patch": "insert", + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 12, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 12 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 29 + ] + } + ], + "range": [ + 24, + 30 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 36 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-assignment.js", + "subscript-access-assignment.js" + ], + "oids": [ + "6b6d48d2b046607da97eaaad0feb91195c3a2fea", + "17d3ff486934142d4ecceba42205dd1fd7b01dd9" + ] + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 6b6d48d..17d3ff4 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1 +1,3 @@", + "+y[\"x\"] = 1;", + "+y[\"x\"] = 0;", + " y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3ac2b12795f6310d1062f1d3357234b9039ef595..e487cba908f3e34fbc0dae932b63d7dfdcf84485" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 24 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 29 + ] + } + ], + "range": [ + 24, + 30 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 36 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 29 + ] + } + ], + "range": [ + 24, + 30 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 36 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-assignment.js", + "subscript-access-assignment.js" + ], + "oids": [ + "17d3ff486934142d4ecceba42205dd1fd7b01dd9", + "d856ac0dc8793e99d8c20158e150163e63098930" + ] + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 17d3ff4..d856ac0 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y[\"x\"] = 1;", + "+y[\"x\"] = 0;", + " y[\"x\"] = 0;", + " y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e487cba908f3e34fbc0dae932b63d7dfdcf84485..1abda3dbd17bb194be11ea0d1e52d66d213a76c6" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 24 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 29 + ] + } + ], + "range": [ + 24, + 30 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 36 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 29 + ] + } + ], + "range": [ + 24, + 30 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 36 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-assignment.js", + "subscript-access-assignment.js" + ], + "oids": [ + "d856ac0dc8793e99d8c20158e150163e63098930", + "17d3ff486934142d4ecceba42205dd1fd7b01dd9" + ] + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index d856ac0..17d3ff4 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,3 +1,3 @@", + "-y[\"x\"] = 0;", + "+y[\"x\"] = 1;", + " y[\"x\"] = 0;", + " y[\"x\"] = 0;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1abda3dbd17bb194be11ea0d1e52d66d213a76c6..049c51e69ba53fe3a11b4936f2454d4c4f648c05" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "patch": "delete", + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 12, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 29 + ] + } + ], + "range": [ + 24, + 30 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 33, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 36 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "patch": "insert", + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 12, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 36, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 36 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 3 + } + ] + ], + "paths": [ + "subscript-access-assignment.js", + "subscript-access-assignment.js" + ], + "oids": [ + "17d3ff486934142d4ecceba42205dd1fd7b01dd9", + "cdcb426e18effec10e46b2f6283a63e87b731e9a" + ] + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 17d3ff4..cdcb426 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,3 +1,2 @@", + "-y[\"x\"] = 1;", + "-y[\"x\"] = 0;", + " y[\"x\"] = 0;", + "+y[\"x\"] = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "049c51e69ba53fe3a11b4936f2454d4c4f648c05..2a80663675514f8ea8a9ee9da926bc5c4d062dd7" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + }, + { + "category": "StringLiteral", + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 12, + 22 + ] + } + ], + "range": [ + 12, + 23 + ] + } + ], + "range": [ + 12, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 24 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 12 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-assignment.js", + "subscript-access-assignment.js" + ], + "oids": [ + "cdcb426e18effec10e46b2f6283a63e87b731e9a", + "0407c3a1afe454d938eaf701c4617a93edf4bdff" + ] + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index cdcb426..0407c3a 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1,2 +1 @@", + "-y[\"x\"] = 0;", + " y[\"x\"] = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2a80663675514f8ea8a9ee9da926bc5c4d062dd7..ad6c13f941554247a24c825e4d6a517fbcf55a69" +} +,{ + "testCaseDescription": "javascript-subscript-access-assignment-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 9, + 10 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 12 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 12, + 12 + ] + } + ], + "hasChanges": true, + "range": [ + 12, + 12 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-assignment.js", + "subscript-access-assignment.js" + ], + "oids": [ + "0407c3a1afe454d938eaf701c4617a93edf4bdff", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "subscript-access-assignment.js" + ], + "patch": [ + "diff --git a/subscript-access-assignment.js b/subscript-access-assignment.js", + "index 0407c3a..e69de29 100644", + "--- a/subscript-access-assignment.js", + "+++ b/subscript-access-assignment.js", + "@@ -1 +0,0 @@", + "-y[\"x\"] = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ad6c13f941554247a24c825e4d6a517fbcf55a69..ac9dba90a6e274a0ed1a230da35e51fd47c0eef4" +}] diff --git a/test/corpus/json/javascript/subscript-access-string.json b/test/corpus/json/javascript/subscript-access-string.json new file mode 100644 index 000000000..dd8a1a2b1 --- /dev/null +++ b/test/corpus/json/javascript/subscript-access-string.json @@ -0,0 +1,1812 @@ +[{ + "testCaseDescription": "javascript-subscript-access-string-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 18 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-string.js", + "subscript-access-string.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "429371721d335f8f5952d657097e24b250b7812e" + ] + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index e69de29..4293717 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -0,0 +1 @@", + "+x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b120fb35e9c89d5480c33ff8e9e5d6e5e3632044..dd9d1fbb38c80adc7d93543e65d007cee202ccda" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 24, + 40 + ] + } + ], + "patch": "insert", + "range": [ + 24, + 41 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 42 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 18 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "StringLiteral", + "range": [ + 44, + 57 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 42, + 59 + ] + } + ], + "range": [ + 42, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 60 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-string.js", + "subscript-access-string.js" + ], + "oids": [ + "429371721d335f8f5952d657097e24b250b7812e", + "42930094b4f069ce252e9beed6e58ea153476f18" + ] + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 4293717..4293009 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1 +1,3 @@", + "+x[\"some-other-string\"];", + "+x[\"some-string\"];", + " x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dd9d1fbb38c80adc7d93543e65d007cee202ccda..5fa07084afb4fe828fd53c393c48c3231ecbe900" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 2, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 2, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 24, + 40 + ] + } + ], + "range": [ + 24, + 41 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 42 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 33 + ] + } + ], + "range": [ + 18, + 34 + ] + } + ], + "range": [ + 18, + 35 + ] + } + ], + "range": [ + 18, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 36 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "StringLiteral", + "range": [ + 44, + 57 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 42, + 59 + ] + } + ], + "range": [ + 42, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 60 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + }, + { + "category": "StringLiteral", + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 36, + 52 + ] + } + ], + "range": [ + 36, + 53 + ] + } + ], + "range": [ + 36, + 54 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 54 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 54, + 54 + ] + } + ], + "hasChanges": false, + "range": [ + 54, + 54 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-string.js", + "subscript-access-string.js" + ], + "oids": [ + "42930094b4f069ce252e9beed6e58ea153476f18", + "c53d07bbc992afb317ee398756c832650830f46d" + ] + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 4293009..c53d07b 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,3 +1,3 @@", + "-x[\"some-other-string\"];", + "+x[\"some-string\"];", + " x[\"some-string\"];", + " x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5fa07084afb4fe828fd53c393c48c3231ecbe900..4489ef48c1815a018870abb9af375cf9e6fcd5d9" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 2, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 2, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 33 + ] + } + ], + "range": [ + 18, + 34 + ] + } + ], + "range": [ + 18, + 35 + ] + } + ], + "range": [ + 18, + 36 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 36 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 24, + 40 + ] + } + ], + "range": [ + 24, + 41 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 42 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 37 + ] + }, + { + "category": "StringLiteral", + "range": [ + 38, + 51 + ] + } + ], + "range": [ + 36, + 52 + ] + } + ], + "range": [ + 36, + 53 + ] + } + ], + "range": [ + 36, + 54 + ] + } + ], + "hasChanges": false, + "range": [ + 36, + 54 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "StringLiteral", + "range": [ + 44, + 57 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 42, + 59 + ] + } + ], + "range": [ + 42, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 60 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 54, + 54 + ] + } + ], + "hasChanges": false, + "range": [ + 54, + 54 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-string.js", + "subscript-access-string.js" + ], + "oids": [ + "c53d07bbc992afb317ee398756c832650830f46d", + "42930094b4f069ce252e9beed6e58ea153476f18" + ] + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index c53d07b..4293009 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,3 +1,3 @@", + "-x[\"some-string\"];", + "+x[\"some-other-string\"];", + " x[\"some-string\"];", + " x[\"some-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4489ef48c1815a018870abb9af375cf9e6fcd5d9..f0af83c1698f1b4d000ab66e4432d87b0620d75c" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 24, + 25 + ] + }, + { + "category": "StringLiteral", + "range": [ + 26, + 39 + ] + } + ], + "range": [ + 24, + 40 + ] + } + ], + "patch": "delete", + "range": [ + 24, + 41 + ] + } + ], + "range": [ + 24, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 42 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 42, + 43 + ] + }, + { + "category": "StringLiteral", + "range": [ + 44, + 57 + ] + } + ], + "range": [ + 42, + 58 + ] + } + ], + "range": [ + 42, + 59 + ] + } + ], + "range": [ + 42, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 60 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 39 + ] + } + ], + "range": [ + 18, + 40 + ] + } + ], + "patch": "insert", + "range": [ + 18, + 41 + ] + } + ], + "range": [ + 18, + 42 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 42 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 42 + ], + "number": 3 + } + ] + ], + "paths": [ + "subscript-access-string.js", + "subscript-access-string.js" + ], + "oids": [ + "42930094b4f069ce252e9beed6e58ea153476f18", + "89c1bc26de340529ad66f499e608dfe2a4bc889b" + ] + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 4293009..89c1bc2 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,3 +1,2 @@", + "-x[\"some-other-string\"];", + "-x[\"some-string\"];", + " x[\"some-string\"];", + "+x[\"some-other-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f0af83c1698f1b4d000ab66e4432d87b0620d75c..e35c768f935b688b4f01e54dd0b370e63c17d745" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "StringLiteral", + "range": [ + 20, + 39 + ] + } + ], + "range": [ + 18, + 40 + ] + } + ], + "range": [ + 18, + 41 + ] + } + ], + "range": [ + 18, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 42 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 42, + 42 + ] + } + ], + "hasChanges": false, + "range": [ + 42, + 42 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-string.js", + "subscript-access-string.js" + ], + "oids": [ + "89c1bc26de340529ad66f499e608dfe2a4bc889b", + "758f8e70bb0ac4bda738fda6de26837148d6c5fe" + ] + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 89c1bc2..758f8e7 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1,2 +1 @@", + "-x[\"some-string\"];", + " x[\"some-other-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e35c768f935b688b4f01e54dd0b370e63c17d745..f09c45712b4b483d42fa9eea14005cfffb916cb9" +} +,{ + "testCaseDescription": "javascript-subscript-access-string-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "StringLiteral", + "range": [ + 2, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "range": [ + 0, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 24 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 24, + 24 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-string.js", + "subscript-access-string.js" + ], + "oids": [ + "758f8e70bb0ac4bda738fda6de26837148d6c5fe", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "subscript-access-string.js" + ], + "patch": [ + "diff --git a/subscript-access-string.js b/subscript-access-string.js", + "index 758f8e7..e69de29 100644", + "--- a/subscript-access-string.js", + "+++ b/subscript-access-string.js", + "@@ -1 +0,0 @@", + "-x[\"some-other-string\"];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f09c45712b4b483d42fa9eea14005cfffb916cb9..6a24d1bc284fee3110e5699439106922f5381fd5" +}] diff --git a/test/corpus/json/javascript/subscript-access-variable.json b/test/corpus/json/javascript/subscript-access-variable.json new file mode 100644 index 000000000..9797ac933 --- /dev/null +++ b/test/corpus/json/javascript/subscript-access-variable.json @@ -0,0 +1,1812 @@ +[{ + "testCaseDescription": "javascript-subscript-access-variable-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 17 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 17 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 17, + 17 + ] + } + ], + "hasChanges": true, + "range": [ + 17, + 17 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-variable.js", + "subscript-access-variable.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "9a7b3d3ecbd9ae9071fa2982c0eaac926089a731" + ] + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index e69de29..9a7b3d3 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -0,0 +1 @@", + "+x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "75ba258ab370ff0efecb47f5f6a2f6a9968e9b8d..23c97f1701f504da098e41630d463fde923ef329" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 36 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "patch": "insert", + "range": [ + 22, + 38 + ] + } + ], + "range": [ + 22, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 39 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 17 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 53 + ] + } + ], + "range": [ + 39, + 54 + ] + } + ], + "range": [ + 39, + 55 + ] + } + ], + "range": [ + 39, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 56 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 17, + 17 + ] + } + ], + "hasChanges": false, + "range": [ + 17, + 17 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 56, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 56 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-variable.js", + "subscript-access-variable.js" + ], + "oids": [ + "9a7b3d3ecbd9ae9071fa2982c0eaac926089a731", + "000d190c91bb13f18455c830ddff5090eedba40b" + ] + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 9a7b3d3..000d190 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1 +1,3 @@", + "+x[someOtherVariable];", + "+x[someVariable];", + " x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "23c97f1701f504da098e41630d463fde923ef329..d31176af5821d8c2be72bfb9313f424b2b21f883" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 17 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 36 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 22, + 38 + ] + } + ], + "range": [ + 22, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 39 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 17, + 18 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 31 + ] + } + ], + "range": [ + 17, + 32 + ] + } + ], + "range": [ + 17, + 33 + ] + } + ], + "range": [ + 17, + 34 + ] + } + ], + "hasChanges": false, + "range": [ + 17, + 34 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 53 + ] + } + ], + "range": [ + 39, + 54 + ] + } + ], + "range": [ + 39, + 55 + ] + } + ], + "range": [ + 39, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 56 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 48 + ] + } + ], + "range": [ + 34, + 49 + ] + } + ], + "range": [ + 34, + 50 + ] + } + ], + "range": [ + 34, + 51 + ] + } + ], + "hasChanges": false, + "range": [ + 34, + 51 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 56, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 56 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 51, + 51 + ] + } + ], + "hasChanges": false, + "range": [ + 51, + 51 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-variable.js", + "subscript-access-variable.js" + ], + "oids": [ + "000d190c91bb13f18455c830ddff5090eedba40b", + "01f61ef9b09f11777de2aaaa0dfc0ed53c2bf9ad" + ] + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 000d190..01f61ef 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,3 +1,3 @@", + "-x[someOtherVariable];", + "+x[someVariable];", + " x[someVariable];", + " x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d31176af5821d8c2be72bfb9313f424b2b21f883..35cfecb96f5660cb9ae603f56d49853d1ab357c0" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 17 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "replace", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 17, + 18 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 31 + ] + } + ], + "range": [ + 17, + 32 + ] + } + ], + "range": [ + 17, + 33 + ] + } + ], + "range": [ + 17, + 34 + ] + } + ], + "hasChanges": false, + "range": [ + 17, + 34 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 36 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "range": [ + 22, + 38 + ] + } + ], + "range": [ + 22, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 39 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + }, + { + "category": "Identifier", + "range": [ + 36, + 48 + ] + } + ], + "range": [ + 34, + 49 + ] + } + ], + "range": [ + 34, + 50 + ] + } + ], + "range": [ + 34, + 51 + ] + } + ], + "hasChanges": false, + "range": [ + 34, + 51 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 53 + ] + } + ], + "range": [ + 39, + 54 + ] + } + ], + "range": [ + 39, + 55 + ] + } + ], + "range": [ + 39, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 56 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 51, + 51 + ] + } + ], + "hasChanges": false, + "range": [ + 51, + 51 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 56, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 56 + ], + "number": 4 + } + ] + ], + "paths": [ + "subscript-access-variable.js", + "subscript-access-variable.js" + ], + "oids": [ + "01f61ef9b09f11777de2aaaa0dfc0ed53c2bf9ad", + "000d190c91bb13f18455c830ddff5090eedba40b" + ] + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 01f61ef..000d190 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,3 +1,3 @@", + "-x[someVariable];", + "+x[someOtherVariable];", + " x[someVariable];", + " x[someVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "35cfecb96f5660cb9ae603f56d49853d1ab357c0..a016d5179e851e36e838d44502bc212e05b27fd0" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "Identifier", + "range": [ + 24, + 36 + ] + } + ], + "range": [ + 22, + 37 + ] + } + ], + "patch": "delete", + "range": [ + 22, + 38 + ] + } + ], + "range": [ + 22, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 39 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 40 + ] + }, + { + "category": "Identifier", + "range": [ + 41, + 53 + ] + } + ], + "range": [ + 39, + 54 + ] + } + ], + "range": [ + 39, + 55 + ] + } + ], + "range": [ + 39, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 56 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 17 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 17, + 18 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 36 + ] + } + ], + "range": [ + 17, + 37 + ] + } + ], + "patch": "insert", + "range": [ + 17, + 38 + ] + } + ], + "range": [ + 17, + 39 + ] + } + ], + "hasChanges": true, + "range": [ + 17, + 39 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 56, + 56 + ] + } + ], + "hasChanges": false, + "range": [ + 56, + 56 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 39, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 39 + ], + "number": 3 + } + ] + ], + "paths": [ + "subscript-access-variable.js", + "subscript-access-variable.js" + ], + "oids": [ + "000d190c91bb13f18455c830ddff5090eedba40b", + "2aaae7e77dd229064fe3b9843c8fa27f0b1a1d62" + ] + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 000d190..2aaae7e 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,3 +1,2 @@", + "-x[someOtherVariable];", + "-x[someVariable];", + " x[someVariable];", + "+x[someOtherVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a016d5179e851e36e838d44502bc212e05b27fd0..6cb518ca4bddfb965e79b029574ca2f66d3ba324" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 14 + ] + } + ], + "range": [ + 0, + 15 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 17 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 17, + 18 + ] + }, + { + "category": "Identifier", + "range": [ + 19, + 36 + ] + } + ], + "range": [ + 17, + 37 + ] + } + ], + "range": [ + 17, + 38 + ] + } + ], + "range": [ + 17, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 17, + 39 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 39, + 39 + ] + } + ], + "hasChanges": false, + "range": [ + 39, + 39 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 22 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-variable.js", + "subscript-access-variable.js" + ], + "oids": [ + "2aaae7e77dd229064fe3b9843c8fa27f0b1a1d62", + "baa3661b2fa0ed916478b9afaf71f2005b8efa5e" + ] + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index 2aaae7e..baa3661 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1,2 +1 @@", + "-x[someVariable];", + " x[someOtherVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6cb518ca4bddfb965e79b029574ca2f66d3ba324..a94c11e468e53c7366ae98264e0e2655f9a239e0" +} +,{ + "testCaseDescription": "javascript-subscript-access-variable-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "SubscriptAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 22 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 22, + 22 + ] + } + ], + "hasChanges": true, + "range": [ + 22, + 22 + ], + "number": 2 + } + ] + ], + "paths": [ + "subscript-access-variable.js", + "subscript-access-variable.js" + ], + "oids": [ + "baa3661b2fa0ed916478b9afaf71f2005b8efa5e", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "subscript-access-variable.js" + ], + "patch": [ + "diff --git a/subscript-access-variable.js b/subscript-access-variable.js", + "index baa3661..e69de29 100644", + "--- a/subscript-access-variable.js", + "+++ b/subscript-access-variable.js", + "@@ -1 +0,0 @@", + "-x[someOtherVariable];" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a94c11e468e53c7366ae98264e0e2655f9a239e0..b120fb35e9c89d5480c33ff8e9e5d6e5e3632044" +}] diff --git a/test/corpus/json/javascript/switch-statement.json b/test/corpus/json/javascript/switch-statement.json new file mode 100644 index 000000000..f8b509644 --- /dev/null +++ b/test/corpus/json/javascript/switch-statement.json @@ -0,0 +1,3896 @@ +[{ + "testCaseDescription": "javascript-switch-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 49, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 49, + 49 + ], + "number": 2 + } + ] + ], + "paths": [ + "switch-statement.js", + "switch-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "5481c49f3a51ee55e0aaa093cd2b16ef18852968" + ] + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index e69de29..5481c49 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -0,0 +1 @@", + "+switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "954df1246c20f230e519c9fb74e256a93cd3e92a..102a1103adca089b9176c54ed7fa1cf8acb4c77f" +} +,{ + "testCaseDescription": "javascript-switch-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "patch": "insert", + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": true, + "range": [ + 49, + 98 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 49 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 106, + 107 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 116, + 117 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 121 + ] + } + ], + "range": [ + 111, + 121 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 127, + 128 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 122, + 132 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 138, + 139 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 141, + 142 + ] + } + ], + "range": [ + 141, + 143 + ] + } + ], + "range": [ + 133, + 143 + ] + } + ], + "range": [ + 98, + 145 + ] + } + ], + "range": [ + 98, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 147 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 49, + 49 + ] + } + ], + "hasChanges": false, + "range": [ + 49, + 49 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 147, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 147, + 147 + ], + "number": 4 + } + ] + ], + "paths": [ + "switch-statement.js", + "switch-statement.js" + ], + "oids": [ + "5481c49f3a51ee55e0aaa093cd2b16ef18852968", + "ffd4a32a83d8f1c5daffc82baaa1b3ae3e17615d" + ] + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 5481c49..ffd4a32 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1 +1,3 @@", + "+switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + "+switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "102a1103adca089b9176c54ed7fa1cf8acb4c77f..6f1d2c228e9cbc259fdfd2026ce0e3960c3bf976" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": false, + "range": [ + 49, + 98 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": false, + "range": [ + 49, + 98 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 106, + 107 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 116, + 117 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 121 + ] + } + ], + "range": [ + 111, + 121 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 127, + 128 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 122, + 132 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 138, + 139 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 141, + 142 + ] + } + ], + "range": [ + 141, + 143 + ] + } + ], + "range": [ + 133, + 143 + ] + } + ], + "range": [ + 98, + 145 + ] + } + ], + "range": [ + 98, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 147 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 106, + 107 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 116, + 117 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 121 + ] + } + ], + "range": [ + 111, + 121 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 127, + 128 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 122, + 132 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 138, + 139 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 141, + 142 + ] + } + ], + "range": [ + 141, + 143 + ] + } + ], + "range": [ + 133, + 143 + ] + } + ], + "range": [ + 98, + 145 + ] + } + ], + "range": [ + 98, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 147 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 147, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 147, + 147 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 147, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 147, + 147 + ], + "number": 4 + } + ] + ], + "paths": [ + "switch-statement.js", + "switch-statement.js" + ], + "oids": [ + "ffd4a32a83d8f1c5daffc82baaa1b3ae3e17615d", + "302fb8bcb5f912b2536298b86f6ef79598e61161" + ] + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index ffd4a32..302fb8b 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,3 +1,3 @@", + "-switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + "+switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6f1d2c228e9cbc259fdfd2026ce0e3960c3bf976..0b3287553c97194548459416885e547386f2197d" +} +,{ + "testCaseDescription": "javascript-switch-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "patch": "replace", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": false, + "range": [ + 49, + 98 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": false, + "range": [ + 49, + 98 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 106, + 107 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 116, + 117 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 121 + ] + } + ], + "range": [ + 111, + 121 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 127, + 128 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 122, + 132 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 138, + 139 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 141, + 142 + ] + } + ], + "range": [ + 141, + 143 + ] + } + ], + "range": [ + 133, + 143 + ] + } + ], + "range": [ + 98, + 145 + ] + } + ], + "range": [ + 98, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 147 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 106, + 107 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 116, + 117 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 121 + ] + } + ], + "range": [ + 111, + 121 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 127, + 128 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 122, + 132 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 138, + 139 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 141, + 142 + ] + } + ], + "range": [ + 141, + 143 + ] + } + ], + "range": [ + 133, + 143 + ] + } + ], + "range": [ + 98, + 145 + ] + } + ], + "range": [ + 98, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 147 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 147, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 147, + 147 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 147, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 147, + 147 + ], + "number": 4 + } + ] + ], + "paths": [ + "switch-statement.js", + "switch-statement.js" + ], + "oids": [ + "302fb8bcb5f912b2536298b86f6ef79598e61161", + "ffd4a32a83d8f1c5daffc82baaa1b3ae3e17615d" + ] + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 302fb8b..ffd4a32 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,3 +1,3 @@", + "-switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + "+switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0b3287553c97194548459416885e547386f2197d..7a73e15cd2ea90a073cc3690e23fe6c0aa6849b2" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "patch": "delete", + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": true, + "range": [ + 49, + 98 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 106, + 107 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 116, + 117 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 119, + 120 + ] + } + ], + "range": [ + 119, + 121 + ] + } + ], + "range": [ + 111, + 121 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 127, + 128 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 130, + 131 + ] + } + ], + "range": [ + 130, + 132 + ] + } + ], + "range": [ + 122, + 132 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 138, + 139 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 141, + 142 + ] + } + ], + "range": [ + 141, + 143 + ] + } + ], + "range": [ + 133, + 143 + ] + } + ], + "range": [ + 98, + 145 + ] + } + ], + "range": [ + 98, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 147 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "patch": "insert", + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": true, + "range": [ + 49, + 98 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 147, + 147 + ] + } + ], + "hasChanges": false, + "range": [ + 147, + 147 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 98, + 98 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 98 + ], + "number": 3 + } + ] + ], + "paths": [ + "switch-statement.js", + "switch-statement.js" + ], + "oids": [ + "ffd4a32a83d8f1c5daffc82baaa1b3ae3e17615d", + "9b60579183ebc74a2e009db29c44eb08ca46f1c1" + ] + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index ffd4a32..9b60579 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,3 +1,2 @@", + "-switch (2) { case 1: 1; case 2: 2; case 3: 3; };", + "-switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + "+switch (2) { case 1: 1; case 2: 2; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "7a73e15cd2ea90a073cc3690e23fe6c0aa6849b2..d076963c4618fdd6dc59aba52ee0d4d9f0273bbd" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 57, + 58 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 67, + 68 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 70, + 71 + ] + } + ], + "range": [ + 70, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 78, + 79 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 81, + 82 + ] + } + ], + "range": [ + 81, + 83 + ] + } + ], + "range": [ + 73, + 83 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 89, + 90 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 92, + 93 + ] + } + ], + "range": [ + 92, + 94 + ] + } + ], + "range": [ + 84, + 94 + ] + } + ], + "range": [ + 49, + 96 + ] + } + ], + "range": [ + 49, + 98 + ] + } + ], + "hasChanges": false, + "range": [ + 49, + 98 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 98, + 98 + ] + } + ], + "hasChanges": false, + "range": [ + 98, + 98 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 49, + 49 + ] + } + ], + "hasChanges": false, + "range": [ + 49, + 49 + ], + "number": 2 + } + ] + ], + "paths": [ + "switch-statement.js", + "switch-statement.js" + ], + "oids": [ + "9b60579183ebc74a2e009db29c44eb08ca46f1c1", + "374091f23100462dd830bbcee156f70da22c58be" + ] + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 9b60579..374091f 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1,2 +1 @@", + "-switch (1) { case 1: 1; case 2: 1; case 3: 3; };", + " switch (2) { case 1: 1; case 2: 2; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d076963c4618fdd6dc59aba52ee0d4d9f0273bbd..3b8a2a002e5cf23fa242fab45be41d23d0269feb" +} +,{ + "testCaseDescription": "javascript-switch-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Switch", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 18, + 19 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 21, + 22 + ] + } + ], + "range": [ + 21, + 23 + ] + } + ], + "range": [ + 13, + 23 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 29, + 30 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 34 + ] + } + ], + "range": [ + 24, + 34 + ] + }, + { + "category": "Case", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 40, + 41 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "NumberLiteral", + "range": [ + 43, + 44 + ] + } + ], + "range": [ + 43, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + } + ], + "range": [ + 0, + 47 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 49 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 49, + 49 + ] + } + ], + "hasChanges": true, + "range": [ + 49, + 49 + ], + "number": 2 + } + ] + ], + "paths": [ + "switch-statement.js", + "switch-statement.js" + ], + "oids": [ + "374091f23100462dd830bbcee156f70da22c58be", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "switch-statement.js" + ], + "patch": [ + "diff --git a/switch-statement.js b/switch-statement.js", + "index 374091f..e69de29 100644", + "--- a/switch-statement.js", + "+++ b/switch-statement.js", + "@@ -1 +0,0 @@", + "-switch (2) { case 1: 1; case 2: 2; case 3: 3; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3b8a2a002e5cf23fa242fab45be41d23d0269feb..5feeb9240c4cfaac7dec387bafe580d79ff959c8" +}] diff --git a/test/corpus/json/javascript/template-string.json b/test/corpus/json/javascript/template-string.json new file mode 100644 index 000000000..9d55e2e5b --- /dev/null +++ b/test/corpus/json/javascript/template-string.json @@ -0,0 +1,1396 @@ +[{ + "testCaseDescription": "javascript-template-string-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 11, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 11, + 11 + ], + "number": 2 + } + ] + ], + "paths": [ + "template-string.js", + "template-string.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "01f859b129cb3334140bbe449811e86cc75c9df9" + ] + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index e69de29..01f859b 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -0,0 +1 @@", + "+`one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c32361c31b256ea32638cead8a9639d9d3bb55d4..eadba66cb97d885739f3686453ed93fc62b92191" +} +,{ + "testCaseDescription": "javascript-template-string-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 12 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 13, + 23 + ] + } + ], + "patch": "insert", + "range": [ + 13, + 24 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 11 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 35 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 11, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 11 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 35 + ], + "number": 4 + } + ] + ], + "paths": [ + "template-string.js", + "template-string.js" + ], + "oids": [ + "01f859b129cb3334140bbe449811e86cc75c9df9", + "777fde681ebad68c77e45fd68ee8389038736407" + ] + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 01f859b..777fde6 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1 +1,3 @@", + "+`multi line`", + "+`one line`", + " `one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "eadba66cb97d885739f3686453ed93fc62b92191..ca0bde0a439c7163f90ffc1bab26d92e478ff307" +} +,{ + "testCaseDescription": "javascript-template-string-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "patch": "replace", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "patch": "replace", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 13, + 23 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 24 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 11, + 21 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 22 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 35 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 22, + 32 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 33 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 35 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 4 + } + ] + ], + "paths": [ + "template-string.js", + "template-string.js" + ], + "oids": [ + "777fde681ebad68c77e45fd68ee8389038736407", + "657129fcb82d906b47bd27ec31a64fbf62bcea24" + ] + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 777fde6..657129f 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,3 +1,3 @@", + "-`multi line`", + "+`one line`", + " `one line`", + " `one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ca0bde0a439c7163f90ffc1bab26d92e478ff307..a3a14c9ce30d30111bd78c7b386af50661fca52b" +} +,{ + "testCaseDescription": "javascript-template-string-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "patch": "replace", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "patch": "replace", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 11, + 21 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 22 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 13, + 23 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 22, + 32 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 33 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 35 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 35 + ], + "number": 4 + } + ] + ], + "paths": [ + "template-string.js", + "template-string.js" + ], + "oids": [ + "657129fcb82d906b47bd27ec31a64fbf62bcea24", + "777fde681ebad68c77e45fd68ee8389038736407" + ] + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 657129f..777fde6 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,3 +1,3 @@", + "-`one line`", + "+`multi line`", + " `one line`", + " `one line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a3a14c9ce30d30111bd78c7b386af50661fca52b..a399a38524f70be2dab1dada1b2ca68a46c824dc" +} +,{ + "testCaseDescription": "javascript-template-string-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 13, + 23 + ] + } + ], + "patch": "delete", + "range": [ + 13, + 24 + ] + } + ], + "range": [ + 13, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 24, + 34 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "range": [ + 24, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 35 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 11, + 23 + ] + } + ], + "patch": "insert", + "range": [ + 11, + 24 + ] + } + ], + "range": [ + 11, + 24 + ] + } + ], + "hasChanges": true, + "range": [ + 11, + 24 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 35, + 35 + ] + } + ], + "hasChanges": false, + "range": [ + 35, + 35 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 3 + } + ] + ], + "paths": [ + "template-string.js", + "template-string.js" + ], + "oids": [ + "777fde681ebad68c77e45fd68ee8389038736407", + "2b8c0ddef64b5053cfd61236aa5fd4787c0526d9" + ] + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 777fde6..2b8c0dd 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,3 +1,2 @@", + "-`multi line`", + "-`one line`", + " `one line`", + "+`multi line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a399a38524f70be2dab1dada1b2ca68a46c824dc..6b3a90c35b12bd9740d672836684fcc748793a5c" +} +,{ + "testCaseDescription": "javascript-template-string-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 10 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 11 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 11, + 23 + ] + } + ], + "range": [ + 11, + 24 + ] + } + ], + "range": [ + 11, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 24 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "template-string.js", + "template-string.js" + ], + "oids": [ + "2b8c0ddef64b5053cfd61236aa5fd4787c0526d9", + "399f1173e725c2f34cb1caa571752dac17d1d941" + ] + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 2b8c0dd..399f117 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1,2 +1 @@", + "-`one line`", + " `multi line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "6b3a90c35b12bd9740d672836684fcc748793a5c..30a0c41d47115adb0e6133f2b347a536a97dc59b" +} +,{ + "testCaseDescription": "javascript-template-string-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "TemplateString", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "template-string.js", + "template-string.js" + ], + "oids": [ + "399f1173e725c2f34cb1caa571752dac17d1d941", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "template-string.js" + ], + "patch": [ + "diff --git a/template-string.js b/template-string.js", + "index 399f117..e69de29 100644", + "--- a/template-string.js", + "+++ b/template-string.js", + "@@ -1 +0,0 @@", + "-`multi line`" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "30a0c41d47115adb0e6133f2b347a536a97dc59b..52f50b42f461e7840a4f2f57f62530561ab97768" +}] diff --git a/test/corpus/json/javascript/ternary.json b/test/corpus/json/javascript/ternary.json new file mode 100644 index 000000000..7fce6360f --- /dev/null +++ b/test/corpus/json/javascript/ternary.json @@ -0,0 +1,2766 @@ +[{ + "testCaseDescription": "javascript-ternary-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 27 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 27 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": true, + "range": [ + 27, + 27 + ], + "number": 2 + } + ] + ], + "paths": [ + "ternary.js", + "ternary.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "a62be2e889a9d188bcbbc97037fb6ff1148a09a1" + ] + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index e69de29..a62be2e 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -0,0 +1 @@", + "+condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "785493d3bbdebc780e436799269cfe3ecd5bbf77..1e5394377cdd9791083eaf414c452e2cb8b6b547" +} +,{ + "testCaseDescription": "javascript-ternary-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 6, + 20 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 28, + 32 + ] + } + ], + "range": [ + 23, + 32 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 50 + ] + } + ], + "range": [ + 35, + 50 + ] + } + ], + "range": [ + 6, + 50 + ] + } + ], + "range": [ + 0, + 50 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 51 + ] + } + ], + "range": [ + 0, + 52 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 52 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 61 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + } + ], + "range": [ + 52, + 77 + ] + } + ], + "patch": "insert", + "range": [ + 52, + 78 + ] + } + ], + "range": [ + 52, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 52, + 79 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 27 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 79, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 99, + 104 + ] + } + ], + "range": [ + 79, + 104 + ] + } + ], + "range": [ + 79, + 105 + ] + } + ], + "range": [ + 79, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 106 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 106, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 106, + 106 + ], + "number": 4 + } + ] + ], + "paths": [ + "ternary.js", + "ternary.js" + ], + "oids": [ + "a62be2e889a9d188bcbbc97037fb6ff1148a09a1", + "17b4f8ecf738666b8023952ede4139c60b5afcfa" + ] + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index a62be2e..17b4f8e 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1 +1,3 @@", + "+x.y = some.condition ? some.case : some.other.case;", + "+condition ? case1 : case2;", + " condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1e5394377cdd9791083eaf414c452e2cb8b6b547..98fa20a80981b0a1d0bd753fa4780cf00cff37a2" +} +,{ + "testCaseDescription": "javascript-ternary-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 6, + 20 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 28, + 32 + ] + } + ], + "range": [ + 23, + 32 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 50 + ] + } + ], + "range": [ + 35, + 50 + ] + } + ], + "range": [ + 6, + 50 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 50 + ] + } + ], + "range": [ + 0, + 51 + ] + } + ], + "range": [ + 0, + 52 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 52 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 25 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 27 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 61 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + } + ], + "range": [ + 52, + 77 + ] + } + ], + "range": [ + 52, + 78 + ] + } + ], + "range": [ + 52, + 79 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 79 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 52 + ] + } + ], + "range": [ + 27, + 52 + ] + } + ], + "range": [ + 27, + 53 + ] + } + ], + "range": [ + 27, + 54 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 54 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 79, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 99, + 104 + ] + } + ], + "range": [ + 79, + 104 + ] + } + ], + "range": [ + 79, + 105 + ] + } + ], + "range": [ + 79, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 106 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 63 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 74, + 79 + ] + } + ], + "range": [ + 54, + 79 + ] + } + ], + "range": [ + 54, + 80 + ] + } + ], + "range": [ + 54, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 54, + 81 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 106, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 106, + 106 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 4 + } + ] + ], + "paths": [ + "ternary.js", + "ternary.js" + ], + "oids": [ + "17b4f8ecf738666b8023952ede4139c60b5afcfa", + "aedee5477bd45bd4a388b3981bb19ab75da634d4" + ] + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index 17b4f8e..aedee54 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,3 +1,3 @@", + "-x.y = some.condition ? some.case : some.other.case;", + "+condition ? case1 : case2;", + " condition ? case1 : case2;", + " condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "98fa20a80981b0a1d0bd753fa4780cf00cff37a2..c4f454f8f233dc5b769f3c33a9a7c385a9e735c1" +} +,{ + "testCaseDescription": "javascript-ternary-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 25 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 27 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 6, + 20 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 28, + 32 + ] + } + ], + "range": [ + 23, + 32 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 50 + ] + } + ], + "range": [ + 35, + 50 + ] + } + ], + "range": [ + 6, + 50 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 50 + ] + } + ], + "range": [ + 0, + 51 + ] + } + ], + "range": [ + 0, + 52 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 52 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 36 + ] + }, + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "Identifier", + "range": [ + 47, + 52 + ] + } + ], + "range": [ + 27, + 52 + ] + } + ], + "range": [ + 27, + 53 + ] + } + ], + "range": [ + 27, + 54 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 54 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 61 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + } + ], + "range": [ + 52, + 77 + ] + } + ], + "range": [ + 52, + 78 + ] + } + ], + "range": [ + 52, + 79 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 79 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 54, + 63 + ] + }, + { + "category": "Identifier", + "range": [ + 66, + 71 + ] + }, + { + "category": "Identifier", + "range": [ + 74, + 79 + ] + } + ], + "range": [ + 54, + 79 + ] + } + ], + "range": [ + 54, + 80 + ] + } + ], + "range": [ + 54, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 54, + 81 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 79, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 99, + 104 + ] + } + ], + "range": [ + 79, + 104 + ] + } + ], + "range": [ + 79, + 105 + ] + } + ], + "range": [ + 79, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 106 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 106, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 106, + 106 + ], + "number": 4 + } + ] + ], + "paths": [ + "ternary.js", + "ternary.js" + ], + "oids": [ + "aedee5477bd45bd4a388b3981bb19ab75da634d4", + "17b4f8ecf738666b8023952ede4139c60b5afcfa" + ] + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index aedee54..17b4f8e 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,3 +1,3 @@", + "-condition ? case1 : case2;", + "+x.y = some.condition ? some.case : some.other.case;", + " condition ? case1 : case2;", + " condition ? case1 : case2;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c4f454f8f233dc5b769f3c33a9a7c385a9e735c1..0c31925fbae7f9350166413775fa9fec2e0434e6" +} +,{ + "testCaseDescription": "javascript-ternary-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 6, + 20 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 28, + 32 + ] + } + ], + "range": [ + 23, + 32 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 50 + ] + } + ], + "range": [ + 35, + 50 + ] + } + ], + "range": [ + 6, + 50 + ] + } + ], + "range": [ + 0, + 50 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 51 + ] + } + ], + "range": [ + 0, + 52 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 52 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 61 + ] + }, + { + "category": "Identifier", + "range": [ + 64, + 69 + ] + }, + { + "category": "Identifier", + "range": [ + 72, + 77 + ] + } + ], + "range": [ + 52, + 77 + ] + } + ], + "patch": "delete", + "range": [ + 52, + 78 + ] + } + ], + "range": [ + 52, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 52, + 79 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 79, + 88 + ] + }, + { + "category": "Identifier", + "range": [ + 91, + 96 + ] + }, + { + "category": "Identifier", + "range": [ + 99, + 104 + ] + } + ], + "range": [ + 79, + 104 + ] + } + ], + "range": [ + 79, + 105 + ] + } + ], + "range": [ + 79, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 106 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 27 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 27, + 30 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "Identifier", + "range": [ + 38, + 47 + ] + } + ], + "range": [ + 33, + 47 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 50, + 59 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 66 + ] + }, + { + "category": "Identifier", + "range": [ + 67, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 62, + 77 + ] + } + ], + "range": [ + 33, + 77 + ] + } + ], + "range": [ + 27, + 77 + ] + } + ], + "patch": "insert", + "range": [ + 27, + 78 + ] + } + ], + "range": [ + 27, + 79 + ] + } + ], + "hasChanges": true, + "range": [ + 27, + 79 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 106, + 106 + ] + } + ], + "hasChanges": false, + "range": [ + 106, + 106 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 79, + 79 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 79 + ], + "number": 3 + } + ] + ], + "paths": [ + "ternary.js", + "ternary.js" + ], + "oids": [ + "17b4f8ecf738666b8023952ede4139c60b5afcfa", + "6fa999d8d1f8afa575b0cfb559c39002218840ea" + ] + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index 17b4f8e..6fa999d 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,3 +1,2 @@", + "-x.y = some.condition ? some.case : some.other.case;", + "-condition ? case1 : case2;", + " condition ? case1 : case2;", + "+x.y = some.condition ? some.case : some.other.case;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0c31925fbae7f9350166413775fa9fec2e0434e6..1692cc99588c25ecae57b8dd68e3dd549ffb2907" +} +,{ + "testCaseDescription": "javascript-ternary-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Ternary", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + }, + { + "category": "Identifier", + "range": [ + 12, + 17 + ] + }, + { + "category": "Identifier", + "range": [ + 20, + 25 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 26 + ] + } + ], + "range": [ + 0, + 27 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 27 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "Identifier", + "range": [ + 29, + 30 + ] + } + ], + "range": [ + 27, + 30 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 37 + ] + }, + { + "category": "Identifier", + "range": [ + 38, + 47 + ] + } + ], + "range": [ + 33, + 47 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 50, + 54 + ] + }, + { + "category": "Identifier", + "range": [ + 55, + 59 + ] + } + ], + "range": [ + 50, + 59 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 66 + ] + }, + { + "category": "Identifier", + "range": [ + 67, + 72 + ] + } + ], + "range": [ + 62, + 72 + ] + }, + { + "category": "Identifier", + "range": [ + 73, + 77 + ] + } + ], + "range": [ + 62, + 77 + ] + } + ], + "range": [ + 33, + 77 + ] + } + ], + "range": [ + 27, + 77 + ] + } + ], + "range": [ + 27, + 78 + ] + } + ], + "range": [ + 27, + 79 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 79 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 6, + 20 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 28, + 32 + ] + } + ], + "range": [ + 23, + 32 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 50 + ] + } + ], + "range": [ + 35, + 50 + ] + } + ], + "range": [ + 6, + 50 + ] + } + ], + "range": [ + 0, + 50 + ] + } + ], + "range": [ + 0, + 51 + ] + } + ], + "range": [ + 0, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 52 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 79, + 79 + ] + } + ], + "hasChanges": false, + "range": [ + 79, + 79 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 52 + ], + "number": 2 + } + ] + ], + "paths": [ + "ternary.js", + "ternary.js" + ], + "oids": [ + "6fa999d8d1f8afa575b0cfb559c39002218840ea", + "b63b46d53f087cea5bd6318789341d780610cae6" + ] + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index 6fa999d..b63b46d 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1,2 +1 @@", + "-condition ? case1 : case2;", + " x.y = some.condition ? some.case : some.other.case;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1692cc99588c25ecae57b8dd68e3dd549ffb2907..401d9a7fba9973bba51744c3bcebdfb16a32ad04" +} +,{ + "testCaseDescription": "javascript-ternary-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Assignment", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 2, + 3 + ] + } + ], + "range": [ + 0, + 3 + ] + }, + { + "category": "Ternary", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + }, + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 6, + 20 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 27 + ] + }, + { + "category": "Identifier", + "range": [ + 28, + 32 + ] + } + ], + "range": [ + 23, + 32 + ] + }, + { + "category": "MemberAccess", + "children": [ + { + "category": "MemberAccess", + "children": [ + { + "category": "Identifier", + "range": [ + 35, + 39 + ] + }, + { + "category": "Identifier", + "range": [ + 40, + 45 + ] + } + ], + "range": [ + 35, + 45 + ] + }, + { + "category": "Identifier", + "range": [ + 46, + 50 + ] + } + ], + "range": [ + 35, + 50 + ] + } + ], + "range": [ + 6, + 50 + ] + } + ], + "range": [ + 0, + 50 + ] + } + ], + "range": [ + 0, + 51 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 52 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 52 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 52, + 52 + ] + } + ], + "hasChanges": true, + "range": [ + 52, + 52 + ], + "number": 2 + } + ] + ], + "paths": [ + "ternary.js", + "ternary.js" + ], + "oids": [ + "b63b46d53f087cea5bd6318789341d780610cae6", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "ternary.js" + ], + "patch": [ + "diff --git a/ternary.js b/ternary.js", + "index b63b46d..e69de29 100644", + "--- a/ternary.js", + "+++ b/ternary.js", + "@@ -1 +0,0 @@", + "-x.y = some.condition ? some.case : some.other.case;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "401d9a7fba9973bba51744c3bcebdfb16a32ad04..0132d01181719553a7cda6f4d242269546faaa62" +}] diff --git a/test/corpus/json/javascript/this-expression.json b/test/corpus/json/javascript/this-expression.json new file mode 100644 index 000000000..96a485470 --- /dev/null +++ b/test/corpus/json/javascript/this-expression.json @@ -0,0 +1,1400 @@ +[{ + "testCaseDescription": "javascript-this-expression-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 6, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 6, + 6 + ], + "number": 2 + } + ] + ], + "paths": [ + "this-expression.js", + "this-expression.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "b251f26b7af5fd0c9cbea299b7e4168fd73781f5" + ] + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index e69de29..b251f26 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -0,0 +1 @@", + "+this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "de56bb89881ee1f97c710b8447f22a479a373692..618c78bcccee5405762867606d7a27bfe59a1bc2" +} +,{ + "testCaseDescription": "javascript-this-expression-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 6 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 6, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 6 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + } + ] + ], + "paths": [ + "this-expression.js", + "this-expression.js" + ], + "oids": [ + "b251f26b7af5fd0c9cbea299b7e4168fd73781f5", + "5804743758fd3bd2f40d0cc9a3af06f11fc16d3f" + ] + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index b251f26..5804743 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1 +1,3 @@", + "+return this;", + "+this;", + " this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "618c78bcccee5405762867606d7a27bfe59a1bc2..623a175dabd13a76401fa44b6a8b91e8b4b3616b" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + } + ], + "range": [ + 6, + 11 + ] + } + ], + "range": [ + 6, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 12 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 18 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 4 + } + ] + ], + "paths": [ + "this-expression.js", + "this-expression.js" + ], + "oids": [ + "5804743758fd3bd2f40d0cc9a3af06f11fc16d3f", + "3c82a23c6c601113ba072922e75dcd892e7629ba" + ] + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 5804743..3c82a23 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,3 +1,3 @@", + "-return this;", + "+this;", + " this;", + " this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "623a175dabd13a76401fa44b6a8b91e8b4b3616b..53a0f9ff9b4ddcf86bb526f92d25948a54a90a62" +} +,{ + "testCaseDescription": "javascript-this-expression-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 10 + ] + } + ], + "range": [ + 6, + 11 + ] + } + ], + "range": [ + 6, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 12 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 18 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + } + ] + ], + "paths": [ + "this-expression.js", + "this-expression.js" + ], + "oids": [ + "3c82a23c6c601113ba072922e75dcd892e7629ba", + "5804743758fd3bd2f40d0cc9a3af06f11fc16d3f" + ] + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 3c82a23..5804743 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,3 +1,3 @@", + "-this;", + "+return this;", + " this;", + " this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "53a0f9ff9b4ddcf86bb526f92d25948a54a90a62..3e09935e8f8001936471b730067f5259b79fd3b2" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 6, + 18 + ] + } + ], + "range": [ + 6, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 6, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 3 + } + ] + ], + "paths": [ + "this-expression.js", + "this-expression.js" + ], + "oids": [ + "5804743758fd3bd2f40d0cc9a3af06f11fc16d3f", + "81aca892150aad969f6b99ea13aeadfc41c94abf" + ] + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 5804743..81aca89 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,3 +1,2 @@", + "-return this;", + "-this;", + " this;", + "+return this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3e09935e8f8001936471b730067f5259b79fd3b2..dd8a39e02b053fa07d0c509a2516a4e0f34ab8da" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 4 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 6, + 18 + ] + } + ], + "range": [ + 6, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "this-expression.js", + "this-expression.js" + ], + "oids": [ + "81aca892150aad969f6b99ea13aeadfc41c94abf", + "45c3231bf8add38010a596322993d0b138d1b1b2" + ] + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 81aca89..45c3231 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1,2 +1 @@", + "-this;", + " return this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "dd8a39e02b053fa07d0c509a2516a4e0f34ab8da..289ffca4faf69ef1b1c2d072bd28a22a88fe8e16" +} +,{ + "testCaseDescription": "javascript-this-expression-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "this-expression.js", + "this-expression.js" + ], + "oids": [ + "45c3231bf8add38010a596322993d0b138d1b1b2", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "this-expression.js" + ], + "patch": [ + "diff --git a/this-expression.js b/this-expression.js", + "index 45c3231..e69de29 100644", + "--- a/this-expression.js", + "+++ b/this-expression.js", + "@@ -1 +0,0 @@", + "-return this;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "289ffca4faf69ef1b1c2d072bd28a22a88fe8e16..32100dbe7cbc819422359a14ab7495be3254310f" +}] diff --git a/test/corpus/json/javascript/throw-statement.json b/test/corpus/json/javascript/throw-statement.json new file mode 100644 index 000000000..2c2ec9338 --- /dev/null +++ b/test/corpus/json/javascript/throw-statement.json @@ -0,0 +1,2046 @@ +[{ + "testCaseDescription": "javascript-throw-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 10, + 24 + ] + } + ], + "range": [ + 6, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 26 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 26, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 26, + 26 + ], + "number": 2 + } + ] + ], + "paths": [ + "throw-statement.js", + "throw-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "e2fcb67ea93292e648039798eba22569dc2d0138" + ] + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index e69de29..e2fcb67 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -0,0 +1 @@", + "+throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5feeb9240c4cfaac7dec387bafe580d79ff959c8..f4f56dd11222632b6dd231901ea27caa19dd049b" +} +,{ + "testCaseDescription": "javascript-throw-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 26 + ] + } + ], + "range": [ + 10, + 27 + ] + } + ], + "range": [ + 6, + 27 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 29 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 45, + 52 + ] + } + ], + "range": [ + 39, + 53 + ] + } + ], + "range": [ + 35, + 53 + ] + } + ], + "patch": "insert", + "range": [ + 29, + 54 + ] + } + ], + "range": [ + 29, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 29, + 55 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 10, + 24 + ] + } + ], + "range": [ + 6, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 26 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 70 + ] + }, + { + "category": "StringLiteral", + "range": [ + 71, + 78 + ] + } + ], + "range": [ + 65, + 79 + ] + } + ], + "range": [ + 61, + 79 + ] + } + ], + "range": [ + 55, + 80 + ] + } + ], + "range": [ + 55, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 81 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 26, + 26 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 26 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 4 + } + ] + ], + "paths": [ + "throw-statement.js", + "throw-statement.js" + ], + "oids": [ + "e2fcb67ea93292e648039798eba22569dc2d0138", + "c0020c895262071db6c99e3ea52554ee17ff3c49" + ] + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index e2fcb67..c0020c8 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1 +1,3 @@", + "+throw new Error(\"oooooops\");", + "+throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f4f56dd11222632b6dd231901ea27caa19dd049b..53022b5b1f89288775172d711942c23c6600e7ea" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 26 + ] + } + ], + "range": [ + 10, + 27 + ] + } + ], + "range": [ + 6, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 29 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 10, + 24 + ] + } + ], + "range": [ + 6, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 26 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 45, + 52 + ] + } + ], + "range": [ + 39, + 53 + ] + } + ], + "range": [ + 35, + 53 + ] + } + ], + "range": [ + 29, + 54 + ] + } + ], + "range": [ + 29, + 55 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 55 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + }, + { + "category": "StringLiteral", + "range": [ + 42, + 49 + ] + } + ], + "range": [ + 36, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 26, + 51 + ] + } + ], + "range": [ + 26, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 52 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 70 + ] + }, + { + "category": "StringLiteral", + "range": [ + 71, + 78 + ] + } + ], + "range": [ + 65, + 79 + ] + } + ], + "range": [ + 61, + 79 + ] + } + ], + "range": [ + 55, + 80 + ] + } + ], + "range": [ + 55, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 81 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "StringLiteral", + "range": [ + 68, + 75 + ] + } + ], + "range": [ + 62, + 76 + ] + } + ], + "range": [ + 58, + 76 + ] + } + ], + "range": [ + 52, + 77 + ] + } + ], + "range": [ + 52, + 78 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 78 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 78, + 78 + ] + } + ], + "hasChanges": false, + "range": [ + 78, + 78 + ], + "number": 4 + } + ] + ], + "paths": [ + "throw-statement.js", + "throw-statement.js" + ], + "oids": [ + "c0020c895262071db6c99e3ea52554ee17ff3c49", + "46442332954a6c0b223aab4467e31cef04dde82d" + ] + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index c0020c8..4644233 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,3 +1,3 @@", + "-throw new Error(\"oooooops\");", + "+throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "53022b5b1f89288775172d711942c23c6600e7ea..f4c157c075f67866be5d801f75c662500a3ffe0d" +} +,{ + "testCaseDescription": "javascript-throw-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 10, + 24 + ] + } + ], + "range": [ + 6, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 26 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "patch": "replace", + "range": [ + 16, + 26 + ] + } + ], + "range": [ + 10, + 27 + ] + } + ], + "range": [ + 6, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 29 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + }, + { + "category": "StringLiteral", + "range": [ + 42, + 49 + ] + } + ], + "range": [ + 36, + 50 + ] + } + ], + "range": [ + 32, + 50 + ] + } + ], + "range": [ + 26, + 51 + ] + } + ], + "range": [ + 26, + 52 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 52 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 45, + 52 + ] + } + ], + "range": [ + 39, + 53 + ] + } + ], + "range": [ + 35, + 53 + ] + } + ], + "range": [ + 29, + 54 + ] + } + ], + "range": [ + 29, + 55 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 55 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 62, + 67 + ] + }, + { + "category": "StringLiteral", + "range": [ + 68, + 75 + ] + } + ], + "range": [ + 62, + 76 + ] + } + ], + "range": [ + 58, + 76 + ] + } + ], + "range": [ + 52, + 77 + ] + } + ], + "range": [ + 52, + 78 + ] + } + ], + "hasChanges": false, + "range": [ + 52, + 78 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 70 + ] + }, + { + "category": "StringLiteral", + "range": [ + 71, + 78 + ] + } + ], + "range": [ + 65, + 79 + ] + } + ], + "range": [ + 61, + 79 + ] + } + ], + "range": [ + 55, + 80 + ] + } + ], + "range": [ + 55, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 81 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 78, + 78 + ] + } + ], + "hasChanges": false, + "range": [ + 78, + 78 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 4 + } + ] + ], + "paths": [ + "throw-statement.js", + "throw-statement.js" + ], + "oids": [ + "46442332954a6c0b223aab4467e31cef04dde82d", + "c0020c895262071db6c99e3ea52554ee17ff3c49" + ] + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index 4644233..c0020c8 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,3 +1,3 @@", + "-throw new Error(\"uh oh\");", + "+throw new Error(\"oooooops\");", + " throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f4c157c075f67866be5d801f75c662500a3ffe0d..958f241f6f3e4321851c930b1408b6c70c78caa7" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 26 + ] + } + ], + "range": [ + 10, + 27 + ] + } + ], + "range": [ + 6, + 27 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 29 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 39, + 44 + ] + }, + { + "category": "StringLiteral", + "range": [ + 45, + 52 + ] + } + ], + "range": [ + 39, + 53 + ] + } + ], + "range": [ + 35, + 53 + ] + } + ], + "patch": "delete", + "range": [ + 29, + 54 + ] + } + ], + "range": [ + 29, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 29, + 55 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 65, + 70 + ] + }, + { + "category": "StringLiteral", + "range": [ + 71, + 78 + ] + } + ], + "range": [ + 65, + 79 + ] + } + ], + "range": [ + 61, + 79 + ] + } + ], + "range": [ + 55, + 80 + ] + } + ], + "range": [ + 55, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 81 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 10, + 24 + ] + } + ], + "range": [ + 6, + 24 + ] + } + ], + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 26 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + }, + { + "category": "StringLiteral", + "range": [ + 42, + 52 + ] + } + ], + "range": [ + 36, + 53 + ] + } + ], + "range": [ + 32, + 53 + ] + } + ], + "patch": "insert", + "range": [ + 26, + 54 + ] + } + ], + "range": [ + 26, + 55 + ] + } + ], + "hasChanges": true, + "range": [ + 26, + 55 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 81, + 81 + ] + } + ], + "hasChanges": false, + "range": [ + 81, + 81 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 55, + 55 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 55 + ], + "number": 3 + } + ] + ], + "paths": [ + "throw-statement.js", + "throw-statement.js" + ], + "oids": [ + "c0020c895262071db6c99e3ea52554ee17ff3c49", + "a1bbf3e1f6f96b955220ec188de47cf41d06ec9f" + ] + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index c0020c8..a1bbf3e 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,3 +1,2 @@", + "-throw new Error(\"oooooops\");", + "-throw new Error(\"uh oh\");", + " throw new Error(\"uh oh\");", + "+throw new Error(\"oooooops\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "958f241f6f3e4321851c930b1408b6c70c78caa7..f7af002e3c9b8d7d09687a49a12d31f98ba32d19" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 10, + 24 + ] + } + ], + "range": [ + 6, + 24 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 25 + ] + } + ], + "range": [ + 0, + 26 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 26 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 36, + 41 + ] + }, + { + "category": "StringLiteral", + "range": [ + 42, + 52 + ] + } + ], + "range": [ + 36, + 53 + ] + } + ], + "range": [ + 32, + 53 + ] + } + ], + "range": [ + 26, + 54 + ] + } + ], + "range": [ + 26, + 55 + ] + } + ], + "hasChanges": false, + "range": [ + 26, + 55 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 26 + ] + } + ], + "range": [ + 10, + 27 + ] + } + ], + "range": [ + 6, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "range": [ + 0, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 29 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 55, + 55 + ] + } + ], + "hasChanges": false, + "range": [ + 55, + 55 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 29, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 29 + ], + "number": 2 + } + ] + ], + "paths": [ + "throw-statement.js", + "throw-statement.js" + ], + "oids": [ + "a1bbf3e1f6f96b955220ec188de47cf41d06ec9f", + "cc3c531246597a50e37b9760c7a6d45989e4583c" + ] + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index a1bbf3e..cc3c531 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1,2 +1 @@", + "-throw new Error(\"uh oh\");", + " throw new Error(\"oooooops\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f7af002e3c9b8d7d09687a49a12d31f98ba32d19..ea612e0a3b13b75a009a60b24db85afe61e73534" +} +,{ + "testCaseDescription": "javascript-throw-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Throw", + "children": [ + { + "category": "Constructor", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 15 + ] + }, + { + "category": "StringLiteral", + "range": [ + 16, + 26 + ] + } + ], + "range": [ + 10, + 27 + ] + } + ], + "range": [ + 6, + 27 + ] + } + ], + "range": [ + 0, + 28 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 29 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 29, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 29, + 29 + ], + "number": 2 + } + ] + ], + "paths": [ + "throw-statement.js", + "throw-statement.js" + ], + "oids": [ + "cc3c531246597a50e37b9760c7a6d45989e4583c", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "throw-statement.js" + ], + "patch": [ + "diff --git a/throw-statement.js b/throw-statement.js", + "index cc3c531..e69de29 100644", + "--- a/throw-statement.js", + "+++ b/throw-statement.js", + "@@ -1 +0,0 @@", + "-throw new Error(\"oooooops\");" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ea612e0a3b13b75a009a60b24db85afe61e73534..3a1f9b51fe7092afcbd5589b8987d6e91e2100a5" +}] diff --git a/test/corpus/json/javascript/true.json b/test/corpus/json/javascript/true.json new file mode 100644 index 000000000..efdebd182 --- /dev/null +++ b/test/corpus/json/javascript/true.json @@ -0,0 +1,1400 @@ +[{ + "testCaseDescription": "javascript-true-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 6, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 6, + 6 + ], + "number": 2 + } + ] + ], + "paths": [ + "true.js", + "true.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "4203d4b4a3d7a7ffe249a29e7bd2e88140be59dd" + ] + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index e69de29..4203d4b 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -0,0 +1 @@", + "+true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e4ca78655510a1ab2e5ceade62c77bd39b3a9599..5d6753ca7b13ffb0a2ae8fbc6c2802f0df420bdc" +} +,{ + "testCaseDescription": "javascript-true-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 13, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 6 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 6, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 6 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + } + ] + ], + "paths": [ + "true.js", + "true.js" + ], + "oids": [ + "4203d4b4a3d7a7ffe249a29e7bd2e88140be59dd", + "65b6323fa6e3d1d5f619b0742e311333eb88bc52" + ] + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 4203d4b..65b6323 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1 +1,3 @@", + "+return true;", + "+true;", + " true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5d6753ca7b13ffb0a2ae8fbc6c2802f0df420bdc..d5b3f9cb8b018c4ec3217ce23bba60ce976121d7" +} +,{ + "testCaseDescription": "javascript-true-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 4 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 6, + 10 + ] + } + ], + "range": [ + 6, + 11 + ] + } + ], + "range": [ + 6, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 12 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 18 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 4 + } + ] + ], + "paths": [ + "true.js", + "true.js" + ], + "oids": [ + "65b6323fa6e3d1d5f619b0742e311333eb88bc52", + "91e1cfc76c4e40fc45d40374371ccc035bb02ff0" + ] + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 65b6323..91e1cfc 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,3 +1,3 @@", + "-return true;", + "+true;", + " true;", + " true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d5b3f9cb8b018c4ec3217ce23bba60ce976121d7..0f95d640ec3548f65364f95e8204bd1e7ac92093" +} +,{ + "testCaseDescription": "javascript-true-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 4 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 11 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 6, + 10 + ] + } + ], + "range": [ + 6, + 11 + ] + } + ], + "range": [ + 6, + 12 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 12 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 12, + 17 + ] + } + ], + "range": [ + 12, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 12, + 18 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + } + ] + ], + "paths": [ + "true.js", + "true.js" + ], + "oids": [ + "91e1cfc76c4e40fc45d40374371ccc035bb02ff0", + "65b6323fa6e3d1d5f619b0742e311333eb88bc52" + ] + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 91e1cfc..65b6323 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,3 +1,3 @@", + "-true;", + "+return true;", + " true;", + " true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0f95d640ec3548f65364f95e8204bd1e7ac92093..751ec53c1e7c260a1d8dd6ca3a97b721c66b4d01" +} +,{ + "testCaseDescription": "javascript-true-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 11 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 13, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 13, + 18 + ] + } + ], + "range": [ + 13, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 19, + 23 + ] + } + ], + "range": [ + 19, + 24 + ] + } + ], + "range": [ + 19, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 25 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 4 + ] + } + ], + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 13, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 6, + 18 + ] + } + ], + "range": [ + 6, + 19 + ] + } + ], + "hasChanges": true, + "range": [ + 6, + 19 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 25, + 25 + ] + } + ], + "hasChanges": false, + "range": [ + 25, + 25 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 3 + } + ] + ], + "paths": [ + "true.js", + "true.js" + ], + "oids": [ + "65b6323fa6e3d1d5f619b0742e311333eb88bc52", + "48a44d128292e7de57cb187c6f86aa892945c737" + ] + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 65b6323..48a44d1 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,3 +1,2 @@", + "-return true;", + "-true;", + " true;", + "+return true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "751ec53c1e7c260a1d8dd6ca3a97b721c66b4d01..c887bfabde24ba6883a0f5d005d90410e0d0390d" +} +,{ + "testCaseDescription": "javascript-true-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Boolean", + "range": [ + 0, + 4 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 5 + ] + } + ], + "range": [ + 0, + 6 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 6 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 13, + 17 + ] + } + ], + "range": [ + 6, + 18 + ] + } + ], + "range": [ + 6, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 6, + 19 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 19, + 19 + ] + } + ], + "hasChanges": false, + "range": [ + 19, + 19 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": false, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "true.js", + "true.js" + ], + "oids": [ + "48a44d128292e7de57cb187c6f86aa892945c737", + "c1c6922d1dfea3f2e582e55796f6fdf98eaeaad3" + ] + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index 48a44d1..c1c6922 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1,2 +1 @@", + "-true;", + " return true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c887bfabde24ba6883a0f5d005d90410e0d0390d..905bf8f5fbf76c06792709acaffd8b9190a45199" +} +,{ + "testCaseDescription": "javascript-true-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Boolean", + "range": [ + 7, + 11 + ] + } + ], + "range": [ + 0, + 12 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 13 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 13, + 13 + ] + } + ], + "hasChanges": true, + "range": [ + 13, + 13 + ], + "number": 2 + } + ] + ], + "paths": [ + "true.js", + "true.js" + ], + "oids": [ + "c1c6922d1dfea3f2e582e55796f6fdf98eaeaad3", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "true.js" + ], + "patch": [ + "diff --git a/true.js b/true.js", + "index c1c6922..e69de29 100644", + "--- a/true.js", + "+++ b/true.js", + "@@ -1 +0,0 @@", + "-return true;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "905bf8f5fbf76c06792709acaffd8b9190a45199..163b832af7eb86fe2d319810d137565e70a924f4" +}] diff --git a/test/corpus/json/javascript/try-statement.json b/test/corpus/json/javascript/try-statement.json new file mode 100644 index 000000000..4a58d0d43 --- /dev/null +++ b/test/corpus/json/javascript/try-statement.json @@ -0,0 +1,3636 @@ +[{ + "testCaseDescription": "javascript-try-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 40, + 40 + ], + "number": 2 + } + ] + ], + "paths": [ + "try-statement.js", + "try-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "9826f7c23a092147c0e2d41fa30e01368854185c" + ] + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index e69de29..9826f7c 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -0,0 +1 @@", + "+try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3a1f9b51fe7092afcbd5589b8987d6e91e2100a5..04e89cbdebc69c9f36d421f5d0d659f992ea0eb9" +} +,{ + "testCaseDescription": "javascript-try-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "patch": "insert", + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": true, + "range": [ + 40, + 80 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 40 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + } + ], + "range": [ + 97, + 103 + ] + } + ], + "range": [ + 91, + 103 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 112, + 118 + ] + } + ], + "range": [ + 104, + 118 + ] + } + ], + "range": [ + 80, + 118 + ] + } + ], + "range": [ + 80, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 120 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + } + ] + ], + "paths": [ + "try-statement.js", + "try-statement.js" + ], + "oids": [ + "9826f7c23a092147c0e2d41fa30e01368854185c", + "7befc1c1ffbbbbb543c7e2b0fa79575d9e12429b" + ] + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 9826f7c..7befc1c 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1 +1,3 @@", + "+try { f; } catch { h; } finally { g; };", + "+try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "04e89cbdebc69c9f36d421f5d0d659f992ea0eb9..477a60f5691efb5cb5a92bc21fca69d9124043cf" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 80 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 80 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + } + ], + "range": [ + 97, + 103 + ] + } + ], + "range": [ + 91, + 103 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 112, + 118 + ] + } + ], + "range": [ + 104, + 118 + ] + } + ], + "range": [ + 80, + 118 + ] + } + ], + "range": [ + 80, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 120 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + } + ], + "range": [ + 97, + 103 + ] + } + ], + "range": [ + 91, + 103 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 112, + 118 + ] + } + ], + "range": [ + 104, + 118 + ] + } + ], + "range": [ + 80, + 118 + ] + } + ], + "range": [ + 80, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 120 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + } + ] + ], + "paths": [ + "try-statement.js", + "try-statement.js" + ], + "oids": [ + "7befc1c1ffbbbbb543c7e2b0fa79575d9e12429b", + "94fed9cea7775eba2899ae21d00d9d2237363bac" + ] + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 7befc1c..94fed9c 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,3 +1,3 @@", + "-try { f; } catch { h; } finally { g; };", + "+try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "477a60f5691efb5cb5a92bc21fca69d9124043cf..b3caa1e2ca9c36a64f26eb1bcb13ae0313670c8b" +} +,{ + "testCaseDescription": "javascript-try-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 80 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 80 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + } + ], + "range": [ + 97, + 103 + ] + } + ], + "range": [ + 91, + 103 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 112, + 118 + ] + } + ], + "range": [ + 104, + 118 + ] + } + ], + "range": [ + 80, + 118 + ] + } + ], + "range": [ + 80, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 120 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + } + ], + "range": [ + 97, + 103 + ] + } + ], + "range": [ + 91, + 103 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 112, + 118 + ] + } + ], + "range": [ + 104, + 118 + ] + } + ], + "range": [ + 80, + 118 + ] + } + ], + "range": [ + 80, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 120 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + } + ] + ], + "paths": [ + "try-statement.js", + "try-statement.js" + ], + "oids": [ + "94fed9cea7775eba2899ae21d00d9d2237363bac", + "7befc1c1ffbbbbb543c7e2b0fa79575d9e12429b" + ] + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 94fed9c..7befc1c 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,3 +1,3 @@", + "-try { f; } catch { g; } finally { h; };", + "+try { f; } catch { h; } finally { g; };", + " try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b3caa1e2ca9c36a64f26eb1bcb13ae0313670c8b..2148f052267ba61fe0924e6eb49b33e0767715c9" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "patch": "delete", + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": true, + "range": [ + 40, + 80 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 86, + 87 + ] + } + ], + "range": [ + 86, + 88 + ] + } + ], + "range": [ + 84, + 90 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 99, + 100 + ] + } + ], + "range": [ + 99, + 101 + ] + } + ], + "range": [ + 97, + 103 + ] + } + ], + "range": [ + 91, + 103 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 114, + 115 + ] + } + ], + "range": [ + 114, + 116 + ] + } + ], + "range": [ + 112, + 118 + ] + } + ], + "range": [ + 104, + 118 + ] + } + ], + "range": [ + 80, + 118 + ] + } + ], + "range": [ + 80, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 120 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "patch": "insert", + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": true, + "range": [ + 40, + 80 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 120, + 120 + ] + } + ], + "hasChanges": false, + "range": [ + 120, + 120 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 80, + 80 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 80 + ], + "number": 3 + } + ] + ], + "paths": [ + "try-statement.js", + "try-statement.js" + ], + "oids": [ + "7befc1c1ffbbbbb543c7e2b0fa79575d9e12429b", + "8ab70e04ac9c82aa5602fc2d13ea6dda4f7e58f2" + ] + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 7befc1c..8ab70e0 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,3 +1,2 @@", + "-try { f; } catch { h; } finally { g; };", + "-try { f; } catch { g; } finally { h; };", + " try { f; } catch { g; } finally { h; };", + "+try { f; } catch { h; } finally { g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "2148f052267ba61fe0924e6eb49b33e0767715c9..d45069cac6de6cc64641b935485492fd1b8ddebd" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 46, + 47 + ] + } + ], + "range": [ + 46, + 48 + ] + } + ], + "range": [ + 44, + 50 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 59, + 60 + ] + } + ], + "range": [ + 59, + 61 + ] + } + ], + "range": [ + 57, + 63 + ] + } + ], + "range": [ + 51, + 63 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 74, + 75 + ] + } + ], + "range": [ + 74, + 76 + ] + } + ], + "range": [ + 72, + 78 + ] + } + ], + "range": [ + 64, + 78 + ] + } + ], + "range": [ + 40, + 78 + ] + } + ], + "range": [ + 40, + 80 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 80 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 80, + 80 + ] + } + ], + "hasChanges": false, + "range": [ + 80, + 80 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 2 + } + ] + ], + "paths": [ + "try-statement.js", + "try-statement.js" + ], + "oids": [ + "8ab70e04ac9c82aa5602fc2d13ea6dda4f7e58f2", + "024f88ab94ea5a8291f587dc2241a2a78ed67d3b" + ] + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 8ab70e0..024f88a 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1,2 +1 @@", + "-try { f; } catch { g; } finally { h; };", + " try { f; } catch { h; } finally { g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d45069cac6de6cc64641b935485492fd1b8ddebd..b5c850a8cdd8a0342c396c81e695099ab61ef4e0" +} +,{ + "testCaseDescription": "javascript-try-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Try", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 6, + 7 + ] + } + ], + "range": [ + 6, + 8 + ] + } + ], + "range": [ + 4, + 10 + ] + }, + { + "category": "Catch", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 19, + 21 + ] + } + ], + "range": [ + 17, + 23 + ] + } + ], + "range": [ + 11, + 23 + ] + }, + { + "category": "Finally", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 34, + 36 + ] + } + ], + "range": [ + 32, + 38 + ] + } + ], + "range": [ + 24, + 38 + ] + } + ], + "range": [ + 0, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 40 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 40, + 40 + ], + "number": 2 + } + ] + ], + "paths": [ + "try-statement.js", + "try-statement.js" + ], + "oids": [ + "024f88ab94ea5a8291f587dc2241a2a78ed67d3b", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "try-statement.js" + ], + "patch": [ + "diff --git a/try-statement.js b/try-statement.js", + "index 024f88a..e69de29 100644", + "--- a/try-statement.js", + "+++ b/try-statement.js", + "@@ -1 +0,0 @@", + "-try { f; } catch { h; } finally { g; };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b5c850a8cdd8a0342c396c81e695099ab61ef4e0..38a4e343f701a84082bcd768e0389e8f827f85af" +}] diff --git a/test/corpus/json/javascript/type-operator.json b/test/corpus/json/javascript/type-operator.json new file mode 100644 index 000000000..c30e23e57 --- /dev/null +++ b/test/corpus/json/javascript/type-operator.json @@ -0,0 +1,1684 @@ +[{ + "testCaseDescription": "javascript-type-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 10, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 10, + 10 + ], + "number": 2 + } + ] + ], + "paths": [ + "type-operator.js", + "type-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "08d2bf54a81604b9d932873dc155fd5357dc0dfc" + ] + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index e69de29..08d2bf5 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -0,0 +1 @@", + "+typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "0132d01181719553a7cda6f4d242269546faaa62..57023fbb649ca8b26f0f1c82e121ef508349116e" +} +,{ + "testCaseDescription": "javascript-type-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 21 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 21, + 29 + ] + } + ], + "patch": "insert", + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 21, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 21, + 31 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 10 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + } + ], + "range": [ + 31, + 39 + ] + } + ], + "range": [ + 31, + 40 + ] + } + ], + "range": [ + 31, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 41 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 10, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 10 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 41, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 41, + 41 + ], + "number": 4 + } + ] + ], + "paths": [ + "type-operator.js", + "type-operator.js" + ], + "oids": [ + "08d2bf54a81604b9d932873dc155fd5357dc0dfc", + "8b9c2f4aa556b1526a1a0742d0c320c8051f8be7" + ] + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 08d2bf5..8b9c2f4 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1 +1,3 @@", + "+x instanceof String;", + "+typeof x;", + " typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "57023fbb649ca8b26f0f1c82e121ef508349116e..9933e14451e53c5bcf8a7d55b2ce626b78c81253" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "delete", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 21 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 21, + 29 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 21, + 31 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 31 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 17, + 18 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 10, + 19 + ] + } + ], + "range": [ + 10, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 20 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + } + ], + "range": [ + 31, + 39 + ] + } + ], + "range": [ + 31, + 40 + ] + } + ], + "range": [ + 31, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 41 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 20, + 28 + ] + } + ], + "range": [ + 20, + 29 + ] + } + ], + "range": [ + 20, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 30 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 41, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 41, + 41 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 30, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 30, + 30 + ], + "number": 4 + } + ] + ], + "paths": [ + "type-operator.js", + "type-operator.js" + ], + "oids": [ + "8b9c2f4aa556b1526a1a0742d0c320c8051f8be7", + "6a5be18cc2d44d0e41a46e7c8590dcd814e00bfb" + ] + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 8b9c2f4..6a5be18 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,3 +1,3 @@", + "-x instanceof String;", + "+typeof x;", + " typeof x;", + " typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9933e14451e53c5bcf8a7d55b2ce626b78c81253..e92145581e653212c7afef3c6edac5b99a243a9a" +} +,{ + "testCaseDescription": "javascript-type-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 10 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "patch": "insert", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 21 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 17, + 18 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 10, + 19 + ] + } + ], + "range": [ + 10, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 20 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 21, + 29 + ] + } + ], + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 21, + 31 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 31 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + } + ], + "range": [ + 20, + 28 + ] + } + ], + "range": [ + 20, + 29 + ] + } + ], + "range": [ + 20, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 30 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + } + ], + "range": [ + 31, + 39 + ] + } + ], + "range": [ + 31, + 40 + ] + } + ], + "range": [ + 31, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 41 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 30, + 30 + ] + } + ], + "hasChanges": false, + "range": [ + 30, + 30 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 41, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 41, + 41 + ], + "number": 4 + } + ] + ], + "paths": [ + "type-operator.js", + "type-operator.js" + ], + "oids": [ + "6a5be18cc2d44d0e41a46e7c8590dcd814e00bfb", + "8b9c2f4aa556b1526a1a0742d0c320c8051f8be7" + ] + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 6a5be18..8b9c2f4 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,3 +1,3 @@", + "-typeof x;", + "+x instanceof String;", + " typeof x;", + " typeof x;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e92145581e653212c7afef3c6edac5b99a243a9a..c8db5777eaf4621e21460a72b51347db2f040d3d" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 21 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 28, + 29 + ] + } + ], + "range": [ + 21, + 29 + ] + } + ], + "patch": "delete", + "range": [ + 21, + 30 + ] + } + ], + "range": [ + 21, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 21, + 31 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 38, + 39 + ] + } + ], + "range": [ + 31, + 39 + ] + } + ], + "range": [ + 31, + 40 + ] + } + ], + "range": [ + 31, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 41 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 11 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 29 + ] + } + ], + "range": [ + 10, + 29 + ] + } + ], + "patch": "insert", + "range": [ + 10, + 30 + ] + } + ], + "range": [ + 10, + 31 + ] + } + ], + "hasChanges": true, + "range": [ + 10, + 31 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 41, + 41 + ] + } + ], + "hasChanges": false, + "range": [ + 41, + 41 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 31, + 31 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 31 + ], + "number": 3 + } + ] + ], + "paths": [ + "type-operator.js", + "type-operator.js" + ], + "oids": [ + "8b9c2f4aa556b1526a1a0742d0c320c8051f8be7", + "d438f9f34a534a29b2381b452eaac65888b47736" + ] + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 8b9c2f4..d438f9f 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,3 +1,2 @@", + "-x instanceof String;", + "-typeof x;", + " typeof x;", + "+x instanceof String;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c8db5777eaf4621e21460a72b51347db2f040d3d..bd9c107414acd6170b2764d2e848579bacdb0e3f" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 10 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 10, + 11 + ] + }, + { + "category": "Identifier", + "range": [ + 23, + 29 + ] + } + ], + "range": [ + 10, + 29 + ] + } + ], + "range": [ + 10, + 30 + ] + } + ], + "range": [ + 10, + 31 + ] + } + ], + "hasChanges": false, + "range": [ + 10, + 31 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "range": [ + 0, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 21 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 31, + 31 + ] + } + ], + "hasChanges": false, + "range": [ + 31, + 31 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": false, + "range": [ + 21, + 21 + ], + "number": 2 + } + ] + ], + "paths": [ + "type-operator.js", + "type-operator.js" + ], + "oids": [ + "d438f9f34a534a29b2381b452eaac65888b47736", + "0bf527541c160794e610d071971ab33963816dd3" + ] + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index d438f9f..0bf5275 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1,2 +1 @@", + "-typeof x;", + " x instanceof String;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "bd9c107414acd6170b2764d2e848579bacdb0e3f..9f099fdb1dc747aae4a61b31087eda99a218b8a1" +} +,{ + "testCaseDescription": "javascript-type-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 1 + ] + }, + { + "category": "Identifier", + "range": [ + 13, + 19 + ] + } + ], + "range": [ + 0, + 19 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 21 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 21, + 21 + ] + } + ], + "hasChanges": true, + "range": [ + 21, + 21 + ], + "number": 2 + } + ] + ], + "paths": [ + "type-operator.js", + "type-operator.js" + ], + "oids": [ + "0bf527541c160794e610d071971ab33963816dd3", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "type-operator.js" + ], + "patch": [ + "diff --git a/type-operator.js b/type-operator.js", + "index 0bf5275..e69de29 100644", + "--- a/type-operator.js", + "+++ b/type-operator.js", + "@@ -1 +0,0 @@", + "-x instanceof String;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "9f099fdb1dc747aae4a61b31087eda99a218b8a1..ef3e803a7f48d3ce5e8de0ca9017609664e7ef16" +}] diff --git a/test/corpus/json/javascript/undefined.json b/test/corpus/json/javascript/undefined.json new file mode 100644 index 000000000..7a52af5ef --- /dev/null +++ b/test/corpus/json/javascript/undefined.json @@ -0,0 +1,1400 @@ +[{ + "testCaseDescription": "javascript-undefined-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 11, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 11, + 11 + ], + "number": 2 + } + ] + ], + "paths": [ + "undefined.js", + "undefined.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "c2ca02c0e25c62262bca12b6f3c05f572570f427" + ] + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index e69de29..c2ca02c 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -0,0 +1 @@", + "+undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "61695447b9d6c99d6fbee197c961837045e9237b..4934441f9dfeeaa135562268f75a96859b0348ec" +} +,{ + "testCaseDescription": "javascript-undefined-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 27 + ] + } + ], + "patch": "insert", + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 11 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 11, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 11 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + } + ] + ], + "paths": [ + "undefined.js", + "undefined.js" + ], + "oids": [ + "c2ca02c0e25c62262bca12b6f3c05f572570f427", + "a4352cc6bbfeae2fa8d00a541438a36377b97c1e" + ] + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index c2ca02c..a4352cc 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1 +1,3 @@", + "+return undefined;", + "+undefined;", + " undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "4934441f9dfeeaa135562268f75a96859b0348ec..bd30c0f337fea623e026c46dd81f07c5bd939c39" +} +,{ + "testCaseDescription": "javascript-undefined-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 16 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 29 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 11, + 21 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 22 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 31 + ] + } + ], + "range": [ + 22, + 32 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 33 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 4 + } + ] + ], + "paths": [ + "undefined.js", + "undefined.js" + ], + "oids": [ + "a4352cc6bbfeae2fa8d00a541438a36377b97c1e", + "52ea2570918458867713f5d04ff2e9affb0394ab" + ] + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index a4352cc..52ea257 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,3 +1,3 @@", + "-return undefined;", + "+undefined;", + " undefined;", + " undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "bd30c0f337fea623e026c46dd81f07c5bd939c39..8933579c6ec5e19655165fdc6dfc67c2f56c6458" +} +,{ + "testCaseDescription": "javascript-undefined-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 11, + 20 + ] + } + ], + "range": [ + 11, + 21 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 22 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 31 + ] + } + ], + "range": [ + 22, + 32 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 33 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + } + ] + ], + "paths": [ + "undefined.js", + "undefined.js" + ], + "oids": [ + "52ea2570918458867713f5d04ff2e9affb0394ab", + "a4352cc6bbfeae2fa8d00a541438a36377b97c1e" + ] + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index 52ea257..a4352cc 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,3 +1,3 @@", + "-undefined;", + "+return undefined;", + " undefined;", + " undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8933579c6ec5e19655165fdc6dfc67c2f56c6458..d25d4c09aba8b5c49cadb2dccdc776a9f1fbe009" +} +,{ + "testCaseDescription": "javascript-undefined-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 16 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 27 + ] + } + ], + "patch": "delete", + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 29, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 27 + ] + } + ], + "patch": "insert", + "range": [ + 11, + 28 + ] + } + ], + "range": [ + 11, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 11, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 29, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 29 + ], + "number": 3 + } + ] + ], + "paths": [ + "undefined.js", + "undefined.js" + ], + "oids": [ + "a4352cc6bbfeae2fa8d00a541438a36377b97c1e", + "a16e7474247c8fe2bd14b257579e7130547e0f50" + ] + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index a4352cc..a16e747 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,3 +1,2 @@", + "-return undefined;", + "-undefined;", + " undefined;", + "+return undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d25d4c09aba8b5c49cadb2dccdc776a9f1fbe009..04a2c6b24a79d6334f7076d6593c15bf9390fc7c" +} +,{ + "testCaseDescription": "javascript-undefined-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 9 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 11, + 28 + ] + } + ], + "range": [ + 11, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 29 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 29, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 29 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 2 + } + ] + ], + "paths": [ + "undefined.js", + "undefined.js" + ], + "oids": [ + "a16e7474247c8fe2bd14b257579e7130547e0f50", + "fb505bb3a7ace63b8b37db2399a689b120aa9e3b" + ] + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index a16e747..fb505bb 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1,2 +1 @@", + "-undefined;", + " return undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "04a2c6b24a79d6334f7076d6593c15bf9390fc7c..8b75a6f10906ce72cbcac5b8460569fc12d1d46a" +} +,{ + "testCaseDescription": "javascript-undefined-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "Return", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 18 + ], + "number": 2 + } + ] + ], + "paths": [ + "undefined.js", + "undefined.js" + ], + "oids": [ + "fb505bb3a7ace63b8b37db2399a689b120aa9e3b", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "undefined.js" + ], + "patch": [ + "diff --git a/undefined.js b/undefined.js", + "index fb505bb..e69de29 100644", + "--- a/undefined.js", + "+++ b/undefined.js", + "@@ -1 +0,0 @@", + "-return undefined;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "8b75a6f10906ce72cbcac5b8460569fc12d1d46a..e4ca78655510a1ab2e5ceade62c77bd39b3a9599" +}] diff --git a/test/corpus/json/javascript/var-declaration.json b/test/corpus/json/javascript/var-declaration.json new file mode 100644 index 000000000..bb1647316 --- /dev/null +++ b/test/corpus/json/javascript/var-declaration.json @@ -0,0 +1,2316 @@ +[{ + "testCaseDescription": "javascript-var-declaration-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 11, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 11, + 11 + ], + "number": 2 + } + ] + ], + "paths": [ + "var-declaration.js", + "var-declaration.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "b506100a909fbf6e4369c496c17b688d66f72fca" + ] + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index e69de29..b506100 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -0,0 +1 @@", + "+var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3a0405bd7047ac7693031b2b8fc3060c111cc827..ab5d42f4a2d689a4448905b382347800f7d8c0c9" +} +,{ + "testCaseDescription": "javascript-var-declaration-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 4, + 5 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 11, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 15, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 26, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "patch": "insert", + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 11 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 11, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 11 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + } + ] + ], + "paths": [ + "var-declaration.js", + "var-declaration.js" + ], + "oids": [ + "b506100a909fbf6e4369c496c17b688d66f72fca", + "b08ebfb51dc7e85b82b345943ec87f1b8737f0ea" + ] + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index b506100..b08ebfb 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1 +1,3 @@", + "+var x, y = {}, z;", + "+var x = 1;", + " var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ab5d42f4a2d689a4448905b382347800f7d8c0c9..c54a7dd6f18d6ff9b1ae61cfbc435bb8f48698f9" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "patch": "delete", + "range": [ + 4, + 5 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 11, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "patch": "delete", + "range": [ + 7, + 13 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "patch": "delete", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "patch": "insert", + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 26, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 29 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 11, + 21 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 22 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 22, + 32 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 33 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 4 + } + ] + ], + "paths": [ + "var-declaration.js", + "var-declaration.js" + ], + "oids": [ + "b08ebfb51dc7e85b82b345943ec87f1b8737f0ea", + "adc261e063c76aaa8d2314878fb928c9fbc1f64c" + ] + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index b08ebfb..adc261e 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,3 +1,3 @@", + "-var x, y = {}, z;", + "+var x = 1;", + " var x = 1;", + " var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c54a7dd6f18d6ff9b1ae61cfbc435bb8f48698f9..fe6f08e48bcf737ef622d9d18ae7ecb168274987" +} +,{ + "testCaseDescription": "javascript-var-declaration-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "patch": "replace", + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "patch": "insert", + "range": [ + 4, + 5 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 11, + 13 + ] + } + ], + "patch": "replace", + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "patch": "insert", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 15, + 20 + ] + } + ], + "range": [ + 11, + 21 + ] + } + ], + "range": [ + 11, + 22 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 22 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 26, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 26, + 31 + ] + } + ], + "range": [ + 22, + 32 + ] + } + ], + "range": [ + 22, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 22, + 33 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 33, + 33 + ] + } + ], + "hasChanges": false, + "range": [ + 33, + 33 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + } + ] + ], + "paths": [ + "var-declaration.js", + "var-declaration.js" + ], + "oids": [ + "adc261e063c76aaa8d2314878fb928c9fbc1f64c", + "b08ebfb51dc7e85b82b345943ec87f1b8737f0ea" + ] + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index adc261e..b08ebfb 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,3 +1,3 @@", + "-var x = 1;", + "+var x, y = {}, z;", + " var x = 1;", + " var x = 1;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "fe6f08e48bcf737ef622d9d18ae7ecb168274987..e290ad684f68c0d4ff70e4a3a505ffa93eced8c3" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 4, + 5 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 11, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 15, + 16 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 22, + 23 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 26, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "range": [ + 22, + 27 + ] + } + ], + "patch": "delete", + "range": [ + 18, + 28 + ] + } + ], + "range": [ + 18, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 33, + 34 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 37, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 33, + 38 + ] + } + ], + "range": [ + 29, + 39 + ] + } + ], + "range": [ + 29, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 40 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 15, + 16 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 22, + 24 + ] + } + ], + "range": [ + 18, + 24 + ] + } + ], + "range": [ + 18, + 24 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + } + ], + "range": [ + 26, + 27 + ] + } + ], + "patch": "insert", + "range": [ + 11, + 28 + ] + } + ], + "range": [ + 11, + 29 + ] + } + ], + "hasChanges": true, + "range": [ + 11, + 29 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 29, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 29 + ], + "number": 3 + } + ] + ], + "paths": [ + "var-declaration.js", + "var-declaration.js" + ], + "oids": [ + "b08ebfb51dc7e85b82b345943ec87f1b8737f0ea", + "514f7c48ab10f0af9683cdeacbc1a8fa7c593782" + ] + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index b08ebfb..514f7c4 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,3 +1,2 @@", + "-var x, y = {}, z;", + "-var x = 1;", + " var x = 1;", + "+var x, y = {}, z;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "e290ad684f68c0d4ff70e4a3a505ffa93eced8c3..1f92f8cb789fcf43a3de3151f441bf92bf2f6212" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + }, + { + "category": "NumberLiteral", + "range": [ + 8, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "range": [ + 4, + 9 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 10 + ] + } + ], + "range": [ + 0, + 11 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 11 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 15, + 16 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 18, + 19 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 22, + 24 + ] + } + ], + "range": [ + 18, + 24 + ] + } + ], + "range": [ + 18, + 24 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 26, + 27 + ] + } + ], + "range": [ + 26, + 27 + ] + } + ], + "range": [ + 11, + 28 + ] + } + ], + "range": [ + 11, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 11, + 29 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 4, + 5 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 11, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 29, + 29 + ] + } + ], + "hasChanges": false, + "range": [ + 29, + 29 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 2 + } + ] + ], + "paths": [ + "var-declaration.js", + "var-declaration.js" + ], + "oids": [ + "514f7c48ab10f0af9683cdeacbc1a8fa7c593782", + "9fc69e2ff003350e601930d96926d9439a84817d" + ] + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index 514f7c4..9fc69e2 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1,2 +1 @@", + "-var x = 1;", + " var x, y = {}, z;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1f92f8cb789fcf43a3de3151f441bf92bf2f6212..97c9ad09f6e9588c444fb049007997105d30b491" +} +,{ + "testCaseDescription": "javascript-var-declaration-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 4, + 5 + ] + } + ], + "range": [ + 4, + 5 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "VarAssignment", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "Object", + "children": [], + "range": [ + 11, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + } + ], + "range": [ + 7, + 13 + ] + }, + { + "category": "VarDecl", + "children": [ + { + "category": "Identifier", + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 15, + 16 + ] + } + ], + "range": [ + 0, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 18 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 18, + 18 + ], + "number": 2 + } + ] + ], + "paths": [ + "var-declaration.js", + "var-declaration.js" + ], + "oids": [ + "9fc69e2ff003350e601930d96926d9439a84817d", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "var-declaration.js" + ], + "patch": [ + "diff --git a/var-declaration.js b/var-declaration.js", + "index 9fc69e2..e69de29 100644", + "--- a/var-declaration.js", + "+++ b/var-declaration.js", + "@@ -1 +0,0 @@", + "-var x, y = {}, z;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "97c9ad09f6e9588c444fb049007997105d30b491..b7c92617e1bc8e5fbcf483a8ea69e94339a33a4a" +}] diff --git a/test/corpus/json/javascript/variable.json b/test/corpus/json/javascript/variable.json new file mode 100644 index 000000000..863b5bef0 --- /dev/null +++ b/test/corpus/json/javascript/variable.json @@ -0,0 +1,1396 @@ +[{ + "testCaseDescription": "javascript-variable-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "variable.js", + "variable.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "1cf4ad05ef284fd6411546e5ddfb1938c9151cb1" + ] + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index e69de29..1cf4ad0 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -0,0 +1 @@", + "+theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "3accaff544c4d4e390ec737b8c076a43e5d56563..49c032f849f019e32d810e49774f40a58f567df8" +} +,{ + "testCaseDescription": "javascript-variable-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "variable.js", + "variable.js" + ], + "oids": [ + "1cf4ad05ef284fd6411546e5ddfb1938c9151cb1", + "888855ad41100937e0019b87e0a81fb922b040b7" + ] + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 1cf4ad0..888855a 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1 +1,3 @@", + "+theVar2", + "+theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "49c032f849f019e32d810e49774f40a58f567df8..ae375a014a72082ea44bed596598c1e12a348025" +} +,{ + "testCaseDescription": "javascript-variable-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "variable.js", + "variable.js" + ], + "oids": [ + "888855ad41100937e0019b87e0a81fb922b040b7", + "60e041c1f5c995232ea415ada7796a8fc59cf50a" + ] + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 888855a..60e041c 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,3 +1,3 @@", + "-theVar2", + "+theVar;", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "ae375a014a72082ea44bed596598c1e12a348025..c5b76769a302fcd3a48d68f455a991c01d58a0c5" +} +,{ + "testCaseDescription": "javascript-variable-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + } + ] + ], + "paths": [ + "variable.js", + "variable.js" + ], + "oids": [ + "60e041c1f5c995232ea415ada7796a8fc59cf50a", + "888855ad41100937e0019b87e0a81fb922b040b7" + ] + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 60e041c..888855a 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,3 +1,3 @@", + "-theVar;", + "+theVar2", + " theVar;", + " theVar;" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c5b76769a302fcd3a48d68f455a991c01d58a0c5..99fc27128f2bcedf21b589afe5d355c8f01b1673" +} +,{ + "testCaseDescription": "javascript-variable-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 14 + ] + } + ], + "patch": "delete", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 16, + 22 + ] + } + ], + "range": [ + 16, + 23 + ] + } + ], + "range": [ + 16, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 24 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 15 + ] + } + ], + "patch": "insert", + "range": [ + 8, + 16 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 16 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 24, + 24 + ] + } + ], + "hasChanges": false, + "range": [ + 24, + 24 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + } + ] + ], + "paths": [ + "variable.js", + "variable.js" + ], + "oids": [ + "888855ad41100937e0019b87e0a81fb922b040b7", + "fbc7b28e28030a5474633484e56cfb97fbba5102" + ] + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 888855a..fbc7b28 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,3 +1,2 @@", + "-theVar2", + "-theVar;", + " theVar;", + "+theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "99fc27128f2bcedf21b589afe5d355c8f01b1673..1ec955cdacef1045e39f487523b6b11245f31137" +} +,{ + "testCaseDescription": "javascript-variable-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 6 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 8, + 15 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "range": [ + 8, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 16 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 16, + 16 + ] + } + ], + "hasChanges": false, + "range": [ + 16, + 16 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": false, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "variable.js", + "variable.js" + ], + "oids": [ + "fbc7b28e28030a5474633484e56cfb97fbba5102", + "7276d95d4675eba989693d641b606c19e5c1e6ba" + ] + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index fbc7b28..7276d95 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1,2 +1 @@", + "-theVar;", + " theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "1ec955cdacef1045e39f487523b6b11245f31137..b64e131430cad9f2e1b958fe3ee4cd577de5381b" +} +,{ + "testCaseDescription": "javascript-variable-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Identifier", + "range": [ + 0, + 7 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 8 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 8, + 8 + ] + } + ], + "hasChanges": true, + "range": [ + 8, + 8 + ], + "number": 2 + } + ] + ], + "paths": [ + "variable.js", + "variable.js" + ], + "oids": [ + "7276d95d4675eba989693d641b606c19e5c1e6ba", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "variable.js" + ], + "patch": [ + "diff --git a/variable.js b/variable.js", + "index 7276d95..e69de29 100644", + "--- a/variable.js", + "+++ b/variable.js", + "@@ -1 +0,0 @@", + "-theVar2" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "b64e131430cad9f2e1b958fe3ee4cd577de5381b..1b8151602239d34159506d5d6e55de712e8c0d10" +}] diff --git a/test/corpus/json/javascript/void-operator.json b/test/corpus/json/javascript/void-operator.json new file mode 100644 index 000000000..592a3226a --- /dev/null +++ b/test/corpus/json/javascript/void-operator.json @@ -0,0 +1,1864 @@ +[{ + "testCaseDescription": "javascript-void-operator-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 9 + ], + "number": 2 + } + ] + ], + "paths": [ + "void-operator.js", + "void-operator.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "02aa7503dc8ff53da9bbc799ec096fab6722a710" + ] + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index e69de29..02aa750 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -0,0 +1 @@", + "+void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "5434e42ccac5d681cef511be2131960ba1884c93..d2c8feb20f4e031a07c804b491cb8cd197207001" +} +,{ + "testCaseDescription": "javascript-void-operator-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 9 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 9 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + } + ] + ], + "paths": [ + "void-operator.js", + "void-operator.js" + ], + "oids": [ + "02aa7503dc8ff53da9bbc799ec096fab6722a710", + "c493dc5b297d4a28578405f7595136bc5c45b142" + ] + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index 02aa750..c493dc5 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1 +1,3 @@", + "+void c()", + "+void b()", + " void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d2c8feb20f4e031a07c804b491cb8cd197207001..326fbe86306ade49a42c236b7fee399fdf4bbbf0" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + } + ] + ], + "paths": [ + "void-operator.js", + "void-operator.js" + ], + "oids": [ + "c493dc5b297d4a28578405f7595136bc5c45b142", + "aae2f63329410ef98f4308a4f7e48412dee52573" + ] + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index c493dc5..aae2f63 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,3 +1,3 @@", + "-void c()", + "+void b()", + " void b()", + " void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "326fbe86306ade49a42c236b7fee399fdf4bbbf0..f61550ca1975a2f502e51f68f86b6e68f009af0d" +} +,{ + "testCaseDescription": "javascript-void-operator-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + } + ] + ], + "paths": [ + "void-operator.js", + "void-operator.js" + ], + "oids": [ + "aae2f63329410ef98f4308a4f7e48412dee52573", + "c493dc5b297d4a28578405f7595136bc5c45b142" + ] + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index aae2f63..c493dc5 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,3 +1,3 @@", + "-void b()", + "+void c()", + " void b()", + " void b()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f61550ca1975a2f502e51f68f86b6e68f009af0d..603c9f8e59b701207a79ca13ab0fb65d37b50457" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "patch": "delete", + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 23, + 24 + ] + } + ], + "range": [ + 23, + 26 + ] + } + ], + "range": [ + 18, + 26 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "range": [ + 18, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 27 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "patch": "insert", + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 18 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 27, + 27 + ] + } + ], + "hasChanges": false, + "range": [ + 27, + 27 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 3 + } + ] + ], + "paths": [ + "void-operator.js", + "void-operator.js" + ], + "oids": [ + "c493dc5b297d4a28578405f7595136bc5c45b142", + "738c34a4b4b1bec1034d08b39dbb4e6ae84d0969" + ] + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index c493dc5..738c34a 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,3 +1,2 @@", + "-void c()", + "-void b()", + " void b()", + "+void c()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "603c9f8e59b701207a79ca13ab0fb65d37b50457..d92e2722c6444ac458e1eba9620cde9f358bcb18" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 14, + 15 + ] + } + ], + "range": [ + 14, + 17 + ] + } + ], + "range": [ + 9, + 17 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "range": [ + 9, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 18 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 18, + 18 + ] + } + ], + "hasChanges": false, + "range": [ + 18, + 18 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": false, + "range": [ + 9, + 9 + ], + "number": 2 + } + ] + ], + "paths": [ + "void-operator.js", + "void-operator.js" + ], + "oids": [ + "738c34a4b4b1bec1034d08b39dbb4e6ae84d0969", + "8e9ceba22d3880a43e333fe0d6b5c7d34cdb1e41" + ] + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index 738c34a..8e9ceba 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1,2 +1 @@", + "-void b()", + " void c()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "d92e2722c6444ac458e1eba9620cde9f358bcb18..481a0d93af0bead516e6e6b6e19dbef8697ae903" +} +,{ + "testCaseDescription": "javascript-void-operator-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "Operator", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 5, + 6 + ] + } + ], + "range": [ + 5, + 8 + ] + } + ], + "range": [ + 0, + 8 + ] + } + ], + "range": [ + 0, + 9 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 9 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 9, + 9 + ] + } + ], + "hasChanges": true, + "range": [ + 9, + 9 + ], + "number": 2 + } + ] + ], + "paths": [ + "void-operator.js", + "void-operator.js" + ], + "oids": [ + "8e9ceba22d3880a43e333fe0d6b5c7d34cdb1e41", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "void-operator.js" + ], + "patch": [ + "diff --git a/void-operator.js b/void-operator.js", + "index 8e9ceba..e69de29 100644", + "--- a/void-operator.js", + "+++ b/void-operator.js", + "@@ -1 +0,0 @@", + "-void c()" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "481a0d93af0bead516e6e6b6e19dbef8697ae903..2dd315197d728e8efdfc502c8ec48dac3ee8a4b7" +}] diff --git a/test/corpus/json/javascript/while-statement.json b/test/corpus/json/javascript/while-statement.json new file mode 100644 index 000000000..d1ab7c349 --- /dev/null +++ b/test/corpus/json/javascript/while-statement.json @@ -0,0 +1,2284 @@ +[{ + "testCaseDescription": "javascript-while-statement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "insert", + "range": [ + 20, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 20 + ], + "number": 2 + } + ] + ], + "paths": [ + "while-statement.js", + "while-statement.js" + ], + "oids": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "1ea2800e0ca7a6b41ac577d898eec51c21ad962a" + ] + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index e69de29..1ea2800 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -0,0 +1 @@", + "+while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "02fd2e5dc8f8de3c7dfdb7fc35ffa79ecc5a9711..48365cd31ce4a57900b5ca49962d184b15c9f70e" +} +,{ + "testCaseDescription": "javascript-while-statement-replacement-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "patch": "insert", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "patch": "insert", + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 20 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 55 + ] + } + ], + "range": [ + 52, + 56 + ] + } + ], + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 40, + 58 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 60 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 20, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 20 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + } + ] + ], + "paths": [ + "while-statement.js", + "while-statement.js" + ], + "oids": [ + "1ea2800e0ca7a6b41ac577d898eec51c21ad962a", + "c322323db2c1f69ea9937e346fe02f353d747421" + ] + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index 1ea2800..c322323 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1 +1,3 @@", + "+while (b) { a(); };", + "+while (a) { b(); };", + " while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "48365cd31ce4a57900b5ca49962d184b15c9f70e..86345f2375bc709f3fc6ea8887e18d1e5060d2e4" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-insert-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 40 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 55 + ] + } + ], + "range": [ + 52, + 56 + ] + } + ], + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 40, + 58 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 60 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 55 + ] + } + ], + "range": [ + 52, + 56 + ] + } + ], + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 40, + 58 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 60 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + } + ] + ], + "paths": [ + "while-statement.js", + "while-statement.js" + ], + "oids": [ + "c322323db2c1f69ea9937e346fe02f353d747421", + "ea967164613fa8014fc806c3847699f5a0b4a2ce" + ] + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index c322323..ea96716 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,3 +1,3 @@", + "-while (b) { a(); };", + "+while (a) { b(); };", + " while (a) { b(); };", + " while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "86345f2375bc709f3fc6ea8887e18d1e5060d2e4..a64a57b19839fdebcbdb61f4a5642a4bdfd48665" +} +,{ + "testCaseDescription": "javascript-while-statement-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "patch": "replace", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 40 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 55 + ] + } + ], + "range": [ + 52, + 56 + ] + } + ], + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 40, + 58 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 60 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 55 + ] + } + ], + "range": [ + 52, + 56 + ] + } + ], + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 40, + 58 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 60 + ], + "number": 3 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + } + ] + ], + "paths": [ + "while-statement.js", + "while-statement.js" + ], + "oids": [ + "ea967164613fa8014fc806c3847699f5a0b4a2ce", + "c322323db2c1f69ea9937e346fe02f353d747421" + ] + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index ea96716..c322323 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,3 +1,3 @@", + "-while (a) { b(); };", + "+while (b) { a(); };", + " while (a) { b(); };", + " while (a) { b(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "a64a57b19839fdebcbdb61f4a5642a4bdfd48665..f3fcb2d82f063979f6ef99e5d5a929717c439e1e" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-replacement-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "patch": "delete", + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 47, + 48 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 52, + 53 + ] + } + ], + "range": [ + 52, + 55 + ] + } + ], + "range": [ + 52, + 56 + ] + } + ], + "range": [ + 50, + 58 + ] + } + ], + "range": [ + 40, + 58 + ] + } + ], + "range": [ + 40, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 60 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "patch": "insert", + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 40 + ], + "number": 2 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 60, + 60 + ] + } + ], + "hasChanges": false, + "range": [ + 60, + 60 + ], + "number": 4 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 3 + } + ] + ], + "paths": [ + "while-statement.js", + "while-statement.js" + ], + "oids": [ + "c322323db2c1f69ea9937e346fe02f353d747421", + "28f4b2107aeca302af288a59f29d76c30c9dc0ed" + ] + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index c322323..28f4b21 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,3 +1,2 @@", + "-while (b) { a(); };", + "-while (a) { b(); };", + " while (a) { b(); };", + "+while (b) { a(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "f3fcb2d82f063979f6ef99e5d5a929717c439e1e..417ef021cba8565bf05177eee6db64ed17d9a93b" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 27, + 28 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 32, + 33 + ] + } + ], + "range": [ + 32, + 35 + ] + } + ], + "range": [ + 32, + 36 + ] + } + ], + "range": [ + 30, + 38 + ] + } + ], + "range": [ + 20, + 38 + ] + } + ], + "range": [ + 20, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 40 + ], + "number": 2 + }, + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 40, + 40 + ] + } + ], + "hasChanges": false, + "range": [ + 40, + 40 + ], + "number": 3 + }, + { + "terms": [ + { + "category": "Program", + "children": [], + "range": [ + 20, + 20 + ] + } + ], + "hasChanges": false, + "range": [ + 20, + 20 + ], + "number": 2 + } + ] + ], + "paths": [ + "while-statement.js", + "while-statement.js" + ], + "oids": [ + "28f4b2107aeca302af288a59f29d76c30c9dc0ed", + "e185b25d092e4a5402a6033691dcc52be2c7a8aa" + ] + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index 28f4b21..e185b25 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1,2 +1 @@", + "-while (a) { b(); };", + " while (b) { a(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "417ef021cba8565bf05177eee6db64ed17d9a93b..c8b46cd494ffd16d1119cab7f07db437b173b372" +} +,{ + "testCaseDescription": "javascript-while-statement-delete-rest-test", + "expectedResult": { + "rows": [ + [ + { + "terms": [ + { + "category": "Program", + "children": [ + { + "category": "While", + "children": [ + { + "category": "Identifier", + "range": [ + 7, + 8 + ] + }, + { + "category": "ExpressionStatements", + "children": [ + { + "category": "ExpressionStatements", + "children": [ + { + "category": "FunctionCall", + "children": [ + { + "category": "Identifier", + "range": [ + 12, + 13 + ] + } + ], + "range": [ + 12, + 15 + ] + } + ], + "range": [ + 12, + 16 + ] + } + ], + "range": [ + 10, + 18 + ] + } + ], + "range": [ + 0, + 18 + ] + } + ], + "patch": "delete", + "range": [ + 0, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 0, + 20 + ], + "number": 1 + } + ], + [ + { + "terms": [ + { + "category": "Program", + "children": [], + "patch": "delete", + "range": [ + 20, + 20 + ] + } + ], + "hasChanges": true, + "range": [ + 20, + 20 + ], + "number": 2 + } + ] + ], + "paths": [ + "while-statement.js", + "while-statement.js" + ], + "oids": [ + "e185b25d092e4a5402a6033691dcc52be2c7a8aa", + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + ] + }, + "filePaths": [ + "while-statement.js" + ], + "patch": [ + "diff --git a/while-statement.js b/while-statement.js", + "index e185b25..e69de29 100644", + "--- a/while-statement.js", + "+++ b/while-statement.js", + "@@ -1 +0,0 @@", + "-while (b) { a(); };" + ], + "gitDir": "test/corpus/repos/javascript", + "shas": "c8b46cd494ffd16d1119cab7f07db437b173b372..a22f0481bc6a70fba4f09d450abc7b2787f85762" +}] diff --git a/test/corpus/profile b/test/corpus/profile new file mode 160000 index 000000000..0abfd2c8b --- /dev/null +++ b/test/corpus/profile @@ -0,0 +1 @@ +Subproject commit 0abfd2c8bbb78433b6a3d297a00c0bc302040829 diff --git a/test/corpus/repos/go b/test/corpus/repos/go new file mode 160000 index 000000000..7edc6135a --- /dev/null +++ b/test/corpus/repos/go @@ -0,0 +1 @@ +Subproject commit 7edc6135ad00c9c21d6159bf897deac80d7f7b99 diff --git a/test/corpus/repos/javascript b/test/corpus/repos/javascript new file mode 160000 index 000000000..b325b0598 --- /dev/null +++ b/test/corpus/repos/javascript @@ -0,0 +1 @@ +Subproject commit b325b0598f3778c6c970adad5ed229e1b5633f8d diff --git a/test/corpus/repos/ruby b/test/corpus/repos/ruby new file mode 160000 index 000000000..bdea1962c --- /dev/null +++ b/test/corpus/repos/ruby @@ -0,0 +1 @@ +Subproject commit bdea1962c3afcde91a03aede5401db0e943ab608 diff --git a/test/crashers/573.A.js b/test/crashers/573.A.js new file mode 100644 index 000000000..013a570e0 --- /dev/null +++ b/test/crashers/573.A.js @@ -0,0 +1,2 @@ +if (a && + b) {} diff --git a/test/crashers/573.B.js b/test/crashers/573.B.js new file mode 100644 index 000000000..c9e37d4c8 --- /dev/null +++ b/test/crashers/573.B.js @@ -0,0 +1 @@ +if (a && b) {} diff --git a/test/diffs-todo/asymmetrical-context.split.js b/test/diffs-todo/asymmetrical-context.split.js deleted file mode 100644 index 79cb2251f..000000000 --- a/test/diffs-todo/asymmetrical-context.split.js +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -
1
        • console
        • .
        • log
      • (
          • '
          • hello
          • '
      • )
    • ;
1
        • console
        • .
        • log
      • (
          • '
          • hello
          • '
      • )
    • ;
  • -
2
    -
3
    -
4
    -
5
    -
2
        • console
        • .
        • log
      • (
          • '
          • world
          • '
      • )
    • ;
  • -
6
        • console
        • .
        • log
      • (
          • '
          • world
          • '
      • )
    • ;
  • -
3
    7
      \ No newline at end of file diff --git a/test/diffs-todo/insert.split.js b/test/diffs-todo/insert.split.js deleted file mode 100644 index 7b7f6a775..000000000 --- a/test/diffs-todo/insert.split.js +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - -
      1
            • console
            • .
            • log
          • (
              • '
              • hello
              • '
          • )
        • ;
      • -
      1
            • console
            • .
            • log
          • (
              • '
              • hello
              • '
          • )
        • ;
      • -
      2
            • console
            • .
            • log
          • (
              • '
              • world
              • '
          • )
        • ;
      • -
      2
        3
          \ No newline at end of file diff --git a/test/diffs-todo/multiline-insert.split.js b/test/diffs-todo/multiline-insert.split.js deleted file mode 100644 index cf44d4f07..000000000 --- a/test/diffs-todo/multiline-insert.split.js +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
          1
                • console
                • .
                • log
              • (
                  • '
                  • hello
                  • '
              • )
            • ;
          • -
          1
                • console
                • .
                • log
              • (
                  • '
                  • hello
                  • '
              • )
            • ;
          • -
          2
            • if (
            • true
            • )
              • { -
          3
                    • console
                    • .
                    • log
                  • (
                      • '
                      • cruel
                      • '
                  • )
                • ;
              • -
          4
              • }
          • -
          2
                • console
                • .
                • log
              • (
                  • '
                  • world
                  • '
              • )
            • ;
          • -
          5
                • console
                • .
                • log
              • (
                  • '
                  • world
                  • '
              • )
            • ;
          • -
          3
            6
              \ No newline at end of file diff --git a/test/diffs-todo/nested-insert.split.js b/test/diffs-todo/nested-insert.split.js deleted file mode 100644 index e0b59fff9..000000000 --- a/test/diffs-todo/nested-insert.split.js +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - -
              1
                • if (
                • true
                • )
                  • { -
              1
                • if (
                • true
                • )
                  • { -
              2
                        • console
                        • .
                        • log
                      • (
                          • '
                          • hello
                          • '
                      • )
                    • ;
                  • -
              2
                        • console
                        • .
                        • log
                      • (
                          • '
                          • hello
                          • '
                      • )
                    • ;
                  • -
              3
                        • console
                        • .
                        • log
                      • (
                          • '
                          • world
                          • '
                      • )
                    • ;
                  • -
              3
                  • }
                • -
                4
                    • }
                • -
                4
                  5
                    \ No newline at end of file diff --git a/test/diffs-todo/newline-at-eof.json.js b/test/diffs-todo/newline-at-eof.json.js deleted file mode 100644 index 2d1f16148..000000000 --- a/test/diffs-todo/newline-at-eof.json.js +++ /dev/null @@ -1 +0,0 @@ -{"rows":[[{"number":1,"terms":[{"range":[0,29],"categories":["program"],"children":[{"range":[0,28],"categories":["expression_statement"],"children":[{"range":[0,27],"categories":["FunctionCall"],"children":[{"range":[0,11],"categories":["member_access"],"children":[{"range":[0,7],"categories":["identifier"]},{"range":[8,11],"categories":["identifier"]}]},{"range":[12,26],"categories":["arguments"],"children":[{"range":[12,26],"categories":["StringLiteral"],"children":[{"range":[12,13],"categories":["StringLiteral"]},{"range":[13,18],"categories":["StringLiteral"]},{"range":[18,19],"categories":["StringLiteral"]},{"range":[20,25],"categories":["StringLiteral"]},{"range":[25,26],"categories":["StringLiteral"]}]}]}]}]}]}],"range":[0,29],"hasChanges":false},{"number":1,"terms":[{"range":[0,29],"categories":["program"],"children":[{"range":[0,28],"categories":["expression_statement"],"children":[{"range":[0,27],"categories":["FunctionCall"],"children":[{"range":[0,11],"categories":["member_access"],"children":[{"range":[0,7],"categories":["identifier"]},{"range":[8,11],"categories":["identifier"]}]},{"range":[12,26],"categories":["arguments"],"children":[{"range":[12,26],"categories":["StringLiteral"],"children":[{"range":[12,13],"categories":["StringLiteral"]},{"range":[13,18],"categories":["StringLiteral"]},{"range":[18,19],"categories":["StringLiteral"]},{"range":[20,25],"categories":["StringLiteral"]},{"range":[25,26],"categories":["StringLiteral"]}]}]}]}]}]}],"range":[0,29],"hasChanges":false}],[{"number":2,"terms":[{"range":[29,29],"categories":["program"],"children":[]}],"range":[29,29],"hasChanges":false},{"number":2,"terms":[{"range":[29,30],"categories":["program"],"children":[]}],"range":[29,30],"hasChanges":false}],[{},{"number":3,"terms":[{"range":[30,56],"categories":["program"],"children":[{"patch":"insert","range":[30,55],"categories":["expression_statement"],"children":[{"range":[30,54],"categories":["FunctionCall"],"children":[{"range":[30,41],"categories":["member_access"],"children":[{"range":[30,37],"categories":["identifier"]},{"range":[38,41],"categories":["identifier"]}]},{"range":[42,53],"categories":["arguments"],"children":[{"range":[42,53],"categories":["StringLiteral"],"children":[{"range":[42,43],"categories":["StringLiteral"]},{"range":[43,52],"categories":["StringLiteral"]},{"range":[52,53],"categories":["StringLiteral"]}]}]}]}]}]}],"range":[30,56],"hasChanges":true}],[{},{"number":4,"terms":[{"range":[56,56],"categories":["program"],"children":[]}],"range":[56,56],"hasChanges":false}]],"oids":["",""],"paths":["test/diffs/newline-at-eof.A.js","test/diffs/newline-at-eof.B.js"]} \ No newline at end of file diff --git a/test/diffs-todo/newline-at-eof.split.js b/test/diffs-todo/newline-at-eof.split.js deleted file mode 100644 index 6ef60a83f..000000000 --- a/test/diffs-todo/newline-at-eof.split.js +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - -
                    1
                          • console
                          • .
                          • log
                        • (
                            • "
                            • hello
                            • ,
                            • world
                            • "
                        • )
                      • ;
                    • -
                    1
                          • console
                          • .
                          • log
                        • (
                            • "
                            • hello
                            • ,
                            • world
                            • "
                        • )
                      • ;
                    • -
                    2
                      2
                        -
                      3
                            • console
                            • .
                            • log
                          • (
                              • "
                              • insertion
                              • "
                          • )
                        • ;
                      • -
                      4
                        \ No newline at end of file diff --git a/test/diffs-todo/no-newline-at-eof.A.js b/test/diffs-todo/no-newline-at-eof.A.js deleted file mode 100644 index 4336a74b3..000000000 --- a/test/diffs-todo/no-newline-at-eof.A.js +++ /dev/null @@ -1 +0,0 @@ -console.log("hello, world"); \ No newline at end of file diff --git a/test/diffs-todo/no-newline-at-eof.B.js b/test/diffs-todo/no-newline-at-eof.B.js deleted file mode 100644 index 3dc95cb30..000000000 --- a/test/diffs-todo/no-newline-at-eof.B.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log("hello, world"); - -console.log("insertion"); \ No newline at end of file diff --git a/test/diffs-todo/no-newline-at-eof.json.js b/test/diffs-todo/no-newline-at-eof.json.js deleted file mode 100644 index eb4963be2..000000000 --- a/test/diffs-todo/no-newline-at-eof.json.js +++ /dev/null @@ -1 +0,0 @@ -{"rows":[[{"number":1,"terms":[{"range":[0,28],"categories":["program"],"children":[{"range":[0,28],"categories":["expression_statement"],"children":[{"range":[0,27],"categories":["FunctionCall"],"children":[{"range":[0,11],"categories":["member_access"],"children":[{"range":[0,7],"categories":["identifier"]},{"range":[8,11],"categories":["identifier"]}]},{"range":[12,26],"categories":["arguments"],"children":[{"range":[12,26],"categories":["StringLiteral"],"children":[{"range":[12,13],"categories":["StringLiteral"]},{"range":[13,18],"categories":["StringLiteral"]},{"range":[18,19],"categories":["StringLiteral"]},{"range":[20,25],"categories":["StringLiteral"]},{"range":[25,26],"categories":["StringLiteral"]}]}]}]}]}]}],"range":[0,28],"hasChanges":false},{"number":1,"terms":[{"range":[0,29],"categories":["program"],"children":[{"range":[0,28],"categories":["expression_statement"],"children":[{"range":[0,27],"categories":["FunctionCall"],"children":[{"range":[0,11],"categories":["member_access"],"children":[{"range":[0,7],"categories":["identifier"]},{"range":[8,11],"categories":["identifier"]}]},{"range":[12,26],"categories":["arguments"],"children":[{"range":[12,26],"categories":["StringLiteral"],"children":[{"range":[12,13],"categories":["StringLiteral"]},{"range":[13,18],"categories":["StringLiteral"]},{"range":[18,19],"categories":["StringLiteral"]},{"range":[20,25],"categories":["StringLiteral"]},{"range":[25,26],"categories":["StringLiteral"]}]}]}]}]}]}],"range":[0,29],"hasChanges":false}],[{},{"number":2,"terms":[{"range":[29,30],"categories":["program"],"children":[]}],"range":[29,30],"hasChanges":false}],[{},{"number":3,"terms":[{"range":[30,55],"categories":["program"],"children":[{"patch":"insert","range":[30,55],"categories":["expression_statement"],"children":[{"range":[30,54],"categories":["FunctionCall"],"children":[{"range":[30,41],"categories":["member_access"],"children":[{"range":[30,37],"categories":["identifier"]},{"range":[38,41],"categories":["identifier"]}]},{"range":[42,53],"categories":["arguments"],"children":[{"range":[42,53],"categories":["StringLiteral"],"children":[{"range":[42,43],"categories":["StringLiteral"]},{"range":[43,52],"categories":["StringLiteral"]},{"range":[52,53],"categories":["StringLiteral"]}]}]}]}]}]}],"range":[30,55],"hasChanges":true}]],"oids":["",""],"paths":["test/diffs/no-newline-at-eof.A.js","test/diffs/no-newline-at-eof.B.js"]} \ No newline at end of file diff --git a/test/diffs-todo/no-newline-at-eof.split.js b/test/diffs-todo/no-newline-at-eof.split.js deleted file mode 100644 index bec74f6ec..000000000 --- a/test/diffs-todo/no-newline-at-eof.split.js +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - -
                        1
                              • console
                              • .
                              • log
                            • (
                                • "
                                • hello
                                • ,
                                • world
                                • "
                            • )
                          • ;
                        1
                              • console
                              • .
                              • log
                            • (
                                • "
                                • hello
                                • ,
                                • world
                                • "
                            • )
                          • ;
                        • -
                        2
                          -
                        3
                              • console
                              • .
                              • log
                            • (
                                • "
                                • insertion
                                • "
                            • )
                          • ;
                        \ No newline at end of file diff --git a/test/diffs-todo/reformat.A.js b/test/diffs-todo/reformat.A.js deleted file mode 100644 index 70ac6c53e..000000000 --- a/test/diffs-todo/reformat.A.js +++ /dev/null @@ -1 +0,0 @@ -[ bar ] diff --git a/test/diffs-todo/reformat.split.js b/test/diffs-todo/reformat.split.js deleted file mode 100644 index d0a66b896..000000000 --- a/test/diffs-todo/reformat.split.js +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - -
                        1
                            • [
                            • bar
                            • ]
                        1
                            • [ -
                        2
                            • bar
                            • -
                        3
                            • ]
                          • -
                        2
                          4
                            \ No newline at end of file diff --git a/test/diffs-todo/asymmetrical-context.A.js b/test/diffs/asymmetrical-context.A.js similarity index 100% rename from test/diffs-todo/asymmetrical-context.A.js rename to test/diffs/asymmetrical-context.A.js diff --git a/test/diffs-todo/asymmetrical-context.B.js b/test/diffs/asymmetrical-context.B.js similarity index 100% rename from test/diffs-todo/asymmetrical-context.B.js rename to test/diffs/asymmetrical-context.B.js diff --git a/test/diffs/asymmetrical-context.split.js b/test/diffs/asymmetrical-context.split.js new file mode 100644 index 000000000..4bdc27d55 --- /dev/null +++ b/test/diffs/asymmetrical-context.split.js @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + +
                            1
                                • console
                                • .
                                • log
                                • (
                                • 'hello'
                                • )
                              • ;
                            • +
                            1
                                • console
                                • .
                                • log
                                • (
                                • 'hello'
                                • )
                              • ;
                            • +
                            2
                              +
                            3
                              +
                            4
                              +
                            5
                              +
                            2
                                • console
                                • .
                                • log
                                • (
                                • 'world'
                                • )
                              • ;
                            • +
                            6
                                • console
                                • .
                                • log
                                • (
                                • 'world'
                                • )
                              • ;
                            • +
                            3
                              7
                                \ No newline at end of file diff --git a/test/diffs/dictionary.json.js b/test/diffs/dictionary.json.js index 0fd2f4ee8..851fb9973 100644 --- a/test/diffs/dictionary.json.js +++ b/test/diffs/dictionary.json.js @@ -1 +1 @@ -{"rows":[[{"number":1,"terms":[{"range":[0,2],"categories":["program"],"children":[{"range":[0,2],"categories":["expression_statement"],"children":[{"range":[0,2],"categories":["DictionaryLiteral"],"children":{}}]}]}],"range":[0,2],"hasChanges":false},{"number":1,"terms":[{"range":[0,2],"categories":["program"],"children":[{"range":[0,2],"categories":["expression_statement"],"children":[{"range":[0,2],"categories":["DictionaryLiteral"],"children":{}}]}]}],"range":[0,2],"hasChanges":false}],[{"number":2,"terms":[{"range":[2,12],"categories":["program"],"children":[{"range":[2,12],"categories":["expression_statement"],"children":[{"range":[2,12],"categories":["DictionaryLiteral"],"children":{"\"b\"":{"range":[4,10],"categories":["Pair"],"children":[{"range":[4,7],"categories":["StringLiteral"],"children":[{"range":[4,5],"categories":["StringLiteral"]},{"range":[5,6],"categories":["StringLiteral"]},{"range":[6,7],"categories":["StringLiteral"]}]},{"patch":"replace","range":[9,10],"categories":["number"]}]}}}]}]}],"range":[2,12],"hasChanges":true},{"number":2,"terms":[{"range":[2,12],"categories":["program"],"children":[{"range":[2,12],"categories":["expression_statement"],"children":[{"range":[2,12],"categories":["DictionaryLiteral"],"children":{"\"b\"":{"range":[4,10],"categories":["Pair"],"children":[{"range":[4,7],"categories":["StringLiteral"],"children":[{"range":[4,5],"categories":["StringLiteral"]},{"range":[5,6],"categories":["StringLiteral"]},{"range":[6,7],"categories":["StringLiteral"]}]},{"patch":"replace","range":[9,10],"categories":["number"]}]}}}]}]}],"range":[2,12],"hasChanges":true}],[{"number":3,"terms":[{"range":[12,21],"categories":["program"],"children":[{"range":[12,21],"categories":["expression_statement"],"children":[{"range":[12,21],"categories":["DictionaryLiteral"],"children":{"\"a\"":{"range":[14,20],"categories":["Pair"],"children":[{"range":[14,17],"categories":["StringLiteral"],"children":[{"range":[14,15],"categories":["StringLiteral"]},{"range":[15,16],"categories":["StringLiteral"]},{"range":[16,17],"categories":["StringLiteral"]}]},{"range":[19,20],"categories":["number"]}]}}}]}]}],"range":[12,21],"hasChanges":false},{"number":3,"terms":[{"range":[12,21],"categories":["program"],"children":[{"range":[12,21],"categories":["expression_statement"],"children":[{"range":[12,21],"categories":["DictionaryLiteral"],"children":{"\"a\"":{"range":[14,20],"categories":["Pair"],"children":[{"range":[14,17],"categories":["StringLiteral"],"children":[{"range":[14,15],"categories":["StringLiteral"]},{"range":[15,16],"categories":["StringLiteral"]},{"range":[16,17],"categories":["StringLiteral"]}]},{"range":[19,20],"categories":["number"]}]}}}]}]}],"range":[12,21],"hasChanges":false}],[{"number":4,"terms":[{"range":[21,23],"categories":["program"],"children":[{"range":[21,23],"categories":["expression_statement"],"children":[{"range":[21,22],"categories":["DictionaryLiteral"],"children":{}}]}]}],"range":[21,23],"hasChanges":false},{"number":4,"terms":[{"range":[21,23],"categories":["program"],"children":[{"range":[21,23],"categories":["expression_statement"],"children":[{"range":[21,22],"categories":["DictionaryLiteral"],"children":{}}]}]}],"range":[21,23],"hasChanges":false}],[{"number":5,"terms":[{"range":[23,23],"categories":["program"],"children":[{"range":[23,23],"categories":["expression_statement"],"children":[]}]}],"range":[23,23],"hasChanges":false},{"number":5,"terms":[{"range":[23,23],"categories":["program"],"children":[{"range":[23,23],"categories":["expression_statement"],"children":[]}]}],"range":[23,23],"hasChanges":false}]],"oids":["",""],"paths":["test/diffs/dictionary.A.js","test/diffs/dictionary.B.js"]} \ No newline at end of file +{"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}]]} \ No newline at end of file diff --git a/test/diffs/dictionary.patch.js b/test/diffs/dictionary.patch.js new file mode 100644 index 000000000..49351e5ae --- /dev/null +++ b/test/diffs/dictionary.patch.js @@ -0,0 +1,10 @@ +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 + } diff --git a/test/diffs/dictionary.split.js b/test/diffs/dictionary.split.js index 9738b3985..a2e6497e3 100644 --- a/test/diffs/dictionary.split.js +++ b/test/diffs/dictionary.split.js @@ -1,25 +1,25 @@ - - +
                                1
                                  • { -
                                1
                                  • { -
                                + - - + + - - + + - - - - + +
                                1
                                    • { +
                                1
                                    • { +
                                2
                                      • "
                                      • b
                                      • "
                                    • :
                                    • 4
                                    , -
                                2
                                      • "
                                      • b
                                      • "
                                    • :
                                    • 5
                                    , -
                                2
                                      • "b"
                                      • :
                                      • 4
                                    • , +
                                2
                                      • "b"
                                      • :
                                      • 5
                                    • , +
                                3
                                      • "
                                      • a
                                      • "
                                    • :
                                    • 5
                                    -
                                3
                                      • "
                                      • a
                                      • "
                                    • :
                                    • 5
                                    -
                                3
                                      • "a"
                                      • :
                                      • 5
                                    • +
                                3
                                      • "a"
                                      • :
                                      • 5
                                    • +
                                4
                                  • }
                                  • +
                                4
                                    • }
                                4
                                  • }
                                  • +
                                4
                                    • }
                                5
                                  5
                                    5
                                      5
                                        \ No newline at end of file diff --git a/test/diffs/file-addition.B.js b/test/diffs/file-addition.B.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/diffs/file-addition.patch.js b/test/diffs/file-addition.patch.js new file mode 100644 index 000000000..6c04a8f0f --- /dev/null +++ b/test/diffs/file-addition.patch.js @@ -0,0 +1,3 @@ +diff --git a/test/diffs/file-addition.B.js b/test/diffs/file-addition.B.js +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/test/diffs/file-deletion.A.js b/test/diffs/file-deletion.A.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/diffs/file-deletion.patch.js b/test/diffs/file-deletion.patch.js new file mode 100644 index 000000000..dea2c8982 --- /dev/null +++ b/test/diffs/file-deletion.patch.js @@ -0,0 +1,3 @@ +diff --git a/test/diffs/file-deletion.A.js b/test/diffs/file-deletion.A.js +deleted file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/test/diffs-todo/insert.A.js b/test/diffs/insert.A.js similarity index 100% rename from test/diffs-todo/insert.A.js rename to test/diffs/insert.A.js diff --git a/test/diffs-todo/insert.B.js b/test/diffs/insert.B.js similarity index 100% rename from test/diffs-todo/insert.B.js rename to test/diffs/insert.B.js diff --git a/test/diffs/insert.split.js b/test/diffs/insert.split.js new file mode 100644 index 000000000..4b247c35f --- /dev/null +++ b/test/diffs/insert.split.js @@ -0,0 +1,14 @@ + + + + + + + + + + +
                                        1
                                            • console
                                            • .
                                            • log
                                            • (
                                            • 'hello'
                                            • )
                                          • ;
                                        • +
                                        1
                                            • console
                                            • .
                                            • log
                                            • (
                                            • 'hello'
                                            • )
                                          • ;
                                        • +
                                        2
                                            • console
                                            • .
                                            • log
                                            • (
                                            • 'world'
                                            • )
                                          • ;
                                        • +
                                        2
                                          3
                                            \ No newline at end of file diff --git a/test/diffs/jquery.A.js b/test/diffs/jquery.A.js new file mode 100644 index 000000000..0c451e49a --- /dev/null +++ b/test/diffs/jquery.A.js @@ -0,0 +1,27 @@ +define( function() { + + // We have to close these tags to support XHTML (#13200) + var wrapMap = { + + // Support: IE9 + option: [ 1, "" ], + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. + thead: [ 1, "", "
                                            " ], + col: [ 2, "", "
                                            " ], + tr: [ 2, "", "
                                            " ], + td: [ 3, "", "
                                            " ], + + _default: [ 0, "", "" ] + }; + + // Support: IE9 + wrapMap.optgroup = wrapMap.option; + + wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; + wrapMap.th = wrapMap.td; + + return wrapMap; +} ); diff --git a/test/diffs/jquery.B.js b/test/diffs/jquery.B.js new file mode 100644 index 000000000..bdf906733 --- /dev/null +++ b/test/diffs/jquery.B.js @@ -0,0 +1,27 @@ +define( function() { + + // We have to close these tags to support XHTML (#13200) + var wrapMap = { + + // Support: IE <=9 only + option: [ 1, "" ], + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. + thead: [ 1, "", "
                                            " ], + col: [ 2, "", "
                                            " ], + tr: [ 2, "", "
                                            " ], + td: [ 3, "", "
                                            " ], + + _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; +} ); diff --git a/test/diffs/jquery.patch.js b/test/diffs/jquery.patch.js new file mode 100644 index 000000000..c71be0b2c --- /dev/null +++ b/test/diffs/jquery.patch.js @@ -0,0 +1,22 @@ +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, "" ], + + // 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; diff --git a/test/diffs-todo/multiline-insert.A.js b/test/diffs/multiline-insert.A.js similarity index 100% rename from test/diffs-todo/multiline-insert.A.js rename to test/diffs/multiline-insert.A.js diff --git a/test/diffs-todo/multiline-insert.B.js b/test/diffs/multiline-insert.B.js similarity index 100% rename from test/diffs-todo/multiline-insert.B.js rename to test/diffs/multiline-insert.B.js diff --git a/test/diffs/multiline-insert.split.js b/test/diffs/multiline-insert.split.js new file mode 100644 index 000000000..d3e951207 --- /dev/null +++ b/test/diffs/multiline-insert.split.js @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + +
                                            1
                                                • console
                                                • .
                                                • log
                                                • (
                                                • 'hello'
                                                • )
                                              • ;
                                            • +
                                            1
                                                • console
                                                • .
                                                • log
                                                • (
                                                • 'hello'
                                                • )
                                              • ;
                                            • +
                                            2
                                              • if (
                                              • true
                                              • )
                                                • { +
                                            3
                                                    • console
                                                    • .
                                                    • log
                                                    • (
                                                    • 'cruel'
                                                    • )
                                                  • ;
                                                • +
                                            4
                                                • }
                                            • +
                                            2
                                                • console
                                                • .
                                                • log
                                                • (
                                                • 'world'
                                                • )
                                              • ;
                                            • +
                                            5
                                                • console
                                                • .
                                                • log
                                                • (
                                                • 'world'
                                                • )
                                              • ;
                                            • +
                                            3
                                              6
                                                \ No newline at end of file diff --git a/test/diffs/multiple-hunks.A.js b/test/diffs/multiple-hunks.A.js new file mode 100644 index 000000000..27c9a9eb1 --- /dev/null +++ b/test/diffs/multiple-hunks.A.js @@ -0,0 +1,13 @@ +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"); +}); diff --git a/test/diffs/multiple-hunks.B.js b/test/diffs/multiple-hunks.B.js new file mode 100644 index 000000000..523aa0703 --- /dev/null +++ b/test/diffs/multiple-hunks.B.js @@ -0,0 +1,13 @@ +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"); +}); diff --git a/test/diffs/multiple-hunks.patch.js b/test/diffs/multiple-hunks.patch.js new file mode 100644 index 000000000..e923eb62e --- /dev/null +++ b/test/diffs/multiple-hunks.patch.js @@ -0,0 +1,18 @@ +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"); + }); diff --git a/test/diffs-todo/nested-insert.A.js b/test/diffs/nested-insert.A.js similarity index 100% rename from test/diffs-todo/nested-insert.A.js rename to test/diffs/nested-insert.A.js diff --git a/test/diffs-todo/nested-insert.B.js b/test/diffs/nested-insert.B.js similarity index 100% rename from test/diffs-todo/nested-insert.B.js rename to test/diffs/nested-insert.B.js diff --git a/test/diffs/nested-insert.split.js b/test/diffs/nested-insert.split.js new file mode 100644 index 000000000..98fffccd4 --- /dev/null +++ b/test/diffs/nested-insert.split.js @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + +
                                                1
                                                  • if (
                                                  • true
                                                  • )
                                                    • { +
                                                1
                                                  • if (
                                                  • true
                                                  • )
                                                    • { +
                                                2
                                                        • console
                                                        • .
                                                        • log
                                                        • (
                                                        • 'hello'
                                                        • )
                                                      • ;
                                                    • +
                                                2
                                                        • console
                                                        • .
                                                        • log
                                                        • (
                                                        • 'hello'
                                                        • )
                                                      • ;
                                                    • +
                                                3
                                                        • console
                                                        • .
                                                        • log
                                                        • (
                                                        • 'world'
                                                        • )
                                                      • ;
                                                    • +
                                                3
                                                    • }
                                                • +
                                                4
                                                    • }
                                                • +
                                                4
                                                  5
                                                    \ No newline at end of file diff --git a/test/diffs-todo/newline-at-eof.A.js b/test/diffs/newline-at-eof.A.js similarity index 100% rename from test/diffs-todo/newline-at-eof.A.js rename to test/diffs/newline-at-eof.A.js diff --git a/test/diffs-todo/newline-at-eof.B.js b/test/diffs/newline-at-eof.B.js similarity index 100% rename from test/diffs-todo/newline-at-eof.B.js rename to test/diffs/newline-at-eof.B.js diff --git a/test/diffs/newline-at-eof.json.js b/test/diffs/newline-at-eof.json.js new file mode 100644 index 000000000..aa7265b10 --- /dev/null +++ b/test/diffs/newline-at-eof.json.js @@ -0,0 +1 @@ +{"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}]]} \ No newline at end of file diff --git a/test/diffs-todo/newline-at-eof.patch.js b/test/diffs/newline-at-eof.patch.js similarity index 70% rename from test/diffs-todo/newline-at-eof.patch.js rename to test/diffs/newline-at-eof.patch.js index 9a6735771..ff7530a52 100644 --- a/test/diffs-todo/newline-at-eof.patch.js +++ b/test/diffs/newline-at-eof.patch.js @@ -1,5 +1,5 @@ diff --git a/test/diffs/newline-at-eof.A.js b/test/diffs/newline-at-eof.B.js -index .. 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/test/diffs/newline-at-eof.A.js +++ b/test/diffs/newline-at-eof.B.js @@ -1,2 +1,4 @@ diff --git a/test/diffs/newline-at-eof.split.js b/test/diffs/newline-at-eof.split.js new file mode 100644 index 000000000..8415e6b28 --- /dev/null +++ b/test/diffs/newline-at-eof.split.js @@ -0,0 +1,18 @@ + + + + + + + + + + + + + +
                                                    1
                                                        • console
                                                        • .
                                                        • log
                                                        • (
                                                        • "hello, world"
                                                        • )
                                                      • ;
                                                    • +
                                                    1
                                                        • console
                                                        • .
                                                        • log
                                                        • (
                                                        • "hello, world"
                                                        • )
                                                      • ;
                                                    • +
                                                    2
                                                      2
                                                        +
                                                      3
                                                          • console
                                                          • .
                                                          • log
                                                          • (
                                                          • "insertion"
                                                          • )
                                                        • ;
                                                      • +
                                                      4
                                                        \ No newline at end of file diff --git a/test/diffs/no-newline-at-eof.json.js b/test/diffs/no-newline-at-eof.json.js new file mode 100644 index 000000000..f2344694e --- /dev/null +++ b/test/diffs/no-newline-at-eof.json.js @@ -0,0 +1 @@ +{"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}]]} \ No newline at end of file diff --git a/test/diffs/no-newline-at-eof.patch.js b/test/diffs/no-newline-at-eof.patch.js index c01e8c9d0..19dabe4b3 100644 --- a/test/diffs/no-newline-at-eof.patch.js +++ b/test/diffs/no-newline-at-eof.patch.js @@ -1,8 +1,8 @@ diff --git a/test/diffs/no-newline-at-eof.A.js b/test/diffs/no-newline-at-eof.B.js -index .. 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/test/diffs/no-newline-at-eof.A.js +++ b/test/diffs/no-newline-at-eof.B.js -@@ -1,2 +1,3 @@ +@@ -1,1 +1,3 @@ console.log("hello, world"); +console.log("insertion"); diff --git a/test/diffs/no-newline-at-eof.split.js b/test/diffs/no-newline-at-eof.split.js new file mode 100644 index 000000000..1e0778e6a --- /dev/null +++ b/test/diffs/no-newline-at-eof.split.js @@ -0,0 +1,13 @@ + + + + + + + + + + +
                                                        1
                                                            • console
                                                            • .
                                                            • log
                                                            • (
                                                            • "hello, world"
                                                            • )
                                                          • ;
                                                        1
                                                            • console
                                                            • .
                                                            • log
                                                            • (
                                                            • "hello, world"
                                                            • )
                                                          • ;
                                                        • +
                                                        2
                                                          +
                                                        3
                                                            • console
                                                            • .
                                                            • log
                                                            • (
                                                            • "insertion"
                                                            • )
                                                          • ;
                                                        \ No newline at end of file diff --git a/test/diffs/reformat.A.js b/test/diffs/reformat.A.js new file mode 100644 index 000000000..4a30a36c8 --- /dev/null +++ b/test/diffs/reformat.A.js @@ -0,0 +1 @@ +[ bar ]; \ No newline at end of file diff --git a/test/diffs-todo/reformat.B.js b/test/diffs/reformat.B.js similarity index 80% rename from test/diffs-todo/reformat.B.js rename to test/diffs/reformat.B.js index ac51c14fa..e128a5f99 100644 --- a/test/diffs-todo/reformat.B.js +++ b/test/diffs/reformat.B.js @@ -1,3 +1,3 @@ [ bar -] +]; \ No newline at end of file diff --git a/test/diffs/reformat.split.js b/test/diffs/reformat.split.js new file mode 100644 index 000000000..2b799ebb2 --- /dev/null +++ b/test/diffs/reformat.split.js @@ -0,0 +1,13 @@ + + + + + + + + + + +
                                                        1
                                                            • [ +
                                                        1
                                                            • [
                                                            • bar
                                                            • ]
                                                          • ;
                                                        2
                                                            • bar
                                                            • +
                                                        3
                                                            • ]
                                                          • ;
                                                        \ No newline at end of file diff --git a/test/repos/backbone b/test/repos/backbone new file mode 160000 index 000000000..85b9774e9 --- /dev/null +++ b/test/repos/backbone @@ -0,0 +1 @@ +Subproject commit 85b9774e905d4ccf6eb048917ade3c52498e6252 diff --git a/test/repos/jquery b/test/repos/jquery new file mode 160000 index 000000000..e5ffcb083 --- /dev/null +++ b/test/repos/jquery @@ -0,0 +1 @@ +Subproject commit e5ffcb0838c894e26f4ff32dfec162cf624d8d7d diff --git a/test/repos/js-test b/test/repos/js-test new file mode 160000 index 000000000..45875c177 --- /dev/null +++ b/test/repos/js-test @@ -0,0 +1 @@ +Subproject commit 45875c177feba7e9c25f780669e6719c59441a42 diff --git a/vendor/effects b/vendor/effects new file mode 160000 index 000000000..de7961dd6 --- /dev/null +++ b/vendor/effects @@ -0,0 +1 @@ +Subproject commit de7961dd6884565dfc9e45309a0c56539a00af17 diff --git a/vendor/gitlib b/vendor/gitlib index 0a9bb2671..77df9cce6 160000 --- a/vendor/gitlib +++ b/vendor/gitlib @@ -1 +1 @@ -Subproject commit 0a9bb2671d8adfc6117173d46ca10fa8b8e94559 +Subproject commit 77df9cce6bbc37f36f4554a31b36336ba887fcd2 diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter new file mode 160000 index 000000000..8116ff5ec --- /dev/null +++ b/vendor/haskell-tree-sitter @@ -0,0 +1 @@ +Subproject commit 8116ff5ec37cae106ed78771a9676057ad702b80 diff --git a/vendor/hspec-expectations-pretty-diff b/vendor/hspec-expectations-pretty-diff new file mode 160000 index 000000000..8762cd516 --- /dev/null +++ b/vendor/hspec-expectations-pretty-diff @@ -0,0 +1 @@ +Subproject commit 8762cd516394091b20f8b7e041e3ca29bd3aec90 diff --git a/vendor/text-icu b/vendor/text-icu index a660194e2..b851ba283 160000 --- a/vendor/text-icu +++ b/vendor/text-icu @@ -1 +1 @@ -Subproject commit a660194e2358ffcc86a9fe11a67fc3223c316007 +Subproject commit b851ba283cd1bb02f57f9c939219b75bea69afeb diff --git a/vendor/tree-sitter-parsers b/vendor/tree-sitter-parsers deleted file mode 160000 index 40a3d5376..000000000 --- a/vendor/tree-sitter-parsers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 40a3d5376f56e76f4530c3fa3a86f857e457c30f diff --git a/weekly/2016-05-16.md b/weekly/2016-05-16.md new file mode 100644 index 000000000..d2652eb71 --- /dev/null +++ b/weekly/2016-05-16.md @@ -0,0 +1,50 @@ +# May 16th, 2016 + +## What we were even doing here + +This was our inaugural weekly. + +We’re sort of looking at this meeting as a retrospective on the previous week. We’re very aiming very roughly at ~10min, but since we’ve never done this before, and since Rick is starting new this week, we’ll see how it goes. + +We went in first name alphabetical order, and shared three things from the last week: + +1. What went well. +2. What went less well. +3. What we learned. + + +## Retrospective + +@joshvera: + +- Diff summaries! We now have a functional way of mapping diffs to their summaries. Tricky path to get to it, but pretty simple completed. +- Also worked on alignment stuff. Tricky stuff, possibly undecidable stuff. +- We’ve been learning about recursion schemes, and different ways to tear down and build up finite & infinite data structures in versatile & structured ways. + + +@rewinfrey (on his first week with us! :tada:): + +- Last week was wrapping up some work on a tenant scoping problem. Handed that off to @bryanaknight. +- Ran through `semantic-diff` setup, and `stack test` is all green. +- Also spending some time configuring Atom for Haskell &c. +- Excited to be here! :tada: (**Ed:** And we’re excited to have you! :heart:) + +@robrix: + +- Diff summaries went well. +- Working on alignment also went well, thanks to :pear:ing w/ @joshvera. +- I was reminded that at its best, :pear:ing is a “greater than the sum of its parts” sort of thing. +- Forgot to note that syncing up w/ @jbarnette on the meta-discussion around alignment was incredibly valuable. I spent a lot of time Writing Things Down last week, and I’m very glad I did. + +The above took us 8min. Nice! + + +## Metaretrospective + +Since this was our inaugural weekly chat, we also did a retrospective on the retrospective: + +- @joshvera observed that even if he’s not working closely with @rewinfrey & @robrix, he’ll have some idea of what we were working on, but less of an idea of what we learned; it’s both more interesting & harder to discover. +- @rewinfrey pointed out that this can help us discover unknown unknowns; “I learned x” gives others a chance to say “have you heard of y, which supersedes x?” +- @rewinfrey further noted that this is sort of a “what would be worth learning?” question, which sets us up nicely for this week. It’s a good chance to confirm that goals for the week are useful! +- @robrix was very glad to get the above feedback; this metaretrospective was super valuable. +- @robrix later realized he forgot to set down what the goals of this meeting are (in his opinion), which would be worth talking about. diff --git a/weekly/2016-05-24.md b/weekly/2016-05-24.md new file mode 100644 index 000000000..20f3b3b88 --- /dev/null +++ b/weekly/2016-05-24.md @@ -0,0 +1,119 @@ +# May 24th, 2016 + +NB: On Tuesday this week since Monday was Victoria Day. + +## Agenda + +1. @robrix to describe a couple of tweaks he’d like to make to this meeting, followed by discussion of same: + - Adding “what did you enjoy” question. + - Rotate facilitator & note-taking tasks weekly. + - Going through the retro questions point by point instead of person by person. +2. Retrospective on last week: + - What went well? + - What was challenging? + - What did you learn? + - What did you enjoy? (If we didn’t decide not to do this.) +3. (Meta)retrospective on the format &c. + + +## Tweaks to the format + +- :+1: to trying it out. + + +## What went well? + +@joshvera: + +- Diff summary meeting on Wed. +- Finished up a lot of the skeleton of diff summaries. +- Yesterday paired w/ @rewinfrey & shared context about summaries. + + +@rewinfrey: + +- Pairing w/ @robrix last week. +- Asking questions! +- Learned a lot. +- Came out of the week feeling hopeful rather than defeated. +- Pairing w/ @joshvera yesterday on diff summaries. Got context about shapes, helped solidify intuitions re: the datatypes &c. + + +@robrix: + +- Pairing! +- Made a lot of progress on the alignment stuff, which was a secondary goal, so it’s a pretty great bonus. +- Particularly interesting building the infrastructure to do property tests around alignment stuff. + + +## What was challenging? + +@joshvera: + +- Stubbing out parts of diff summaries that we don’t have good answers for. E.g. productions, what type of info we’ll get out of parent annotations/contexts when constructing summaries. + + +@rewinfrey: + +- Newness to Haskell & the project. Trying to solidify understanding of Haskell at the same time as the shapes of the data, especially in contexts like the Alignment problem. Challenge is diminishing over time. + + +@robrix: + +- Pairing as much as we did was exhausting, just because I have to be “on” for extended periods of time; worried that I tired @rewinfrey out too. Feel like this will be ameliorated organically what with long weekends and schedule tweaks and @joshvera being freed up a bit. Also just getting used to it will help. +- There are some question marks about parts of the alignment stuff that are making me a bit nervous. Adding test cases for a couple of those will definitely help! + + +## What did you learn? + +@joshvera: + +- There’s a ton more stuff to do to get the types of diff summaries that we actually want as opposed to the ones that our current system produces, e.g. w.r.t. `tree-sitter`. + + +@rewinfrey: + +- Learned a lot. +- The transition from thinking about function application to thinking about function composition was an eye-opener. +- Understanding a lot more about why certain shapes are advantageous. + + +@robrix: + +- The halting problem applies to human analysis of programs too; sometimes you still have to go through a problem step by step in your head to understand it. +- Analyzing infinite loops in terms of general recursion/primitive recursion is pretty clarifying; e.g. “why isn’t this primitive recursive? Can this be strictly positive?” +- Reminded that I don’t _really_ understand a thing til I’ve articulated it clearly. + + +## What did you enjoy? + +@joshvera: + +- Pairing w/ @rewinfrey yesterday. +- Giving the demo Wednesday. +- Voicing how I think about the structures we use. + + +@rewinfrey: + +- > I feel like everything is pretty awesome. +- Getting paid to do Haskell is a dream come true. +- > Haskell honeymoon. +- Learning. +- Working w/ @joshvera & @robrix. Patience; willingness to share; egolessness. **Ed:** 💟 + + +@robrix: + +- Pairing w/ @rewinfrey. +- @rewinfrey’s questions! +- Articulating approaches taken; e.g. the meta-level of the function application to function composition transition. I hadn’t really been conscious of that transition until @rewinfrey asked why I used pointfree style in one part of the code, or how I decide whether to write a function tacitly or not. Being forced to articulate it helped me understand that this had happened, which in turn sheds light on the difference between “can” and “should” for this particular problem. + + +## Metaretro + +- @joshvera: Some of the questions felt like I was repeating thoughts by rephrasing through a different lens. +- @rewinfrey: I think I might keep these questions in mind throughout the week. +- @robrix: All of the above. + +In response, going to drop the “What did you enjoy?” question, & have the facilitator/note-taker for the next meeting open the agenda PR for it the week before (i.e. today). diff --git a/weekly/2016-05-31.md b/weekly/2016-05-31.md new file mode 100644 index 000000000..70510d2da --- /dev/null +++ b/weekly/2016-05-31.md @@ -0,0 +1,81 @@ +# May 31th, 2016 + +NB: On Tuesday this week since Monday was Memorial Day. + +## Agenda + +1. Retrospective on last week: + - What went well? + - What was challenging? + - What did you learn? + + +## What went well? + +@joshvera: + +- Diff summaries merged. +- Introduced a new prelude. +- Pairing with Rick. +- Alignment! + +@rewinfrey: + +- Pairing with Josh. +- Was at MoonConf and enjoyed the conference. +- Almost finished with Haskell Tic Tac Toe. + +@robrix: + +- Alignment resolved! +- Getting diff summaries merged. + + +## What was challenging? + +@joshvera: + +- Didn't make as much progress on the structure of diff summaries as desired. + +@rewinfrey: + +- Continuing to adjust to the project. +- Hit an edge case in Minimax that is tricky. + +@robrix: + +- Not sure why the line approach in alignment solved the problem. +- In stack 1.1 you cannot rely on it rebuilding internal packages (must clean and rebuild semantic diff tool) + + +## What did you learn? + +@joshvera: + +- Learned about the different types of preludes. +- Learned about an extension in GHC 8.0 that introduces Applicative Do syntax, but is tricky to use in parallel computations because of the order of executation. + +@rewinfrey: + +- Learned about different recursion schemes (zygotmorphism +- The transition from thinking about function application to thinking about function composition was an eye-opener. +- Understanding a lot more about why certain shapes are advantageous. +- http://livestream.com/accounts/16500216/events/5467460 (first video) + - Greg Pfeil's talk: 02:24 Recursion Where FP Hits Bottom + - Amar Shah's talk: 04:24 Point Free or Die + - Ashley Powell's talk: 05:57 Negotiating Salary for Women in Tech + - Patrick Thomson's talk: 06:25 Bracer: Transforming Real-World Languages with Coproducts and Recursion Schemes + +@robrix: + +- Learned a lot about GHCi debugging. +- Remembered to question assumptions, specifically about alignment property tests that were throwing results off. +- Using Arbitrary for purposes other than QuickCheck. + + +## Other Items + +@robrix: + +- Planning this week about the timeline for staffshipping diff summaries. +- Planning for a possible mini-summit in late June. diff --git a/weekly/2016-06-01.md b/weekly/2016-06-01.md new file mode 100644 index 000000000..efd0d540b --- /dev/null +++ b/weekly/2016-06-01.md @@ -0,0 +1,35 @@ +# Planning Meeting June 1, 2016 + +## Observations + +@robrix: + + - Since Alignment Diff PR was merged, it offers a good chance to step back and look at what would be most valuable in support of Diff Summaries and the 90 day goals. + - Want to triage Diff Summaries and if we should be reprioritizing staff shipping Semantic Diff now that Alignment is merged. + +@joshvera: + + - Reviewed open issues to prepare for planning meeting while evaluating how they fit into our milestones. + - Thinking about how we can ensure resilience if Semantic Diff times out, or fails and having fall back to traditional diffing. + - Also thinking about how to ensure Semantic Diff can render correctly. + +## Focus Points + + - Update semantic diff sha in github/github so semantic diff can be updated in github local development environments [PR](https://github.com/github/github/pull/56240) + - Improving Diff Summaries (performance and structure) + - Profiling and algorithm improvements to SES (Performance label) + - Fix Ruby Parser + - Unicorn Timeouts (algorithmic improvement, better fallback (should probably be driven by workflow tools)) + - Benchmarking + - Other Features: detecting and rendering moves (as part of DotCom milestone) + +## Plan + +@robrix & @joshvera: + + - Rob to set aside Benchmarking for now, focus on profiling (pair with Rick). + - Josh and Rick to pair on Diff Summary performance while Rob is out. + - Have Rick take a look at the Unicorn timeouts (involving some profiling to identify where things are slowest). + - Rob on vacation starting Tuesday June 7th (for 10 days) + - Schedule mini-summit for week of June 20th. + - Longer term planning including solidifying a road map will be held at the mini-summit. diff --git a/weekly/2016-06-06.md b/weekly/2016-06-06.md new file mode 100644 index 000000000..fb419b189 --- /dev/null +++ b/weekly/2016-06-06.md @@ -0,0 +1,63 @@ +# May 31th, 2016 + +## Agenda + +1. Retrospective on last week: + - What went well? + - What was challenging? + - What did you learn? + + +## What went well? + +@robrix: + +- As of this morning we’re pushing data to graphite. +- There's a 2 hour window of when data is pulled in to graphite. +- We have a much more thorough understanding of the shape of the SES problems. + +@rewinfrey: +- Came away with a much more thorough understanding of SES. +- Pairing with Rob on the profiling issues. + +@joshvera +- Exploring the current productions of tree-sitter output. +- Got an airbnb for the Mini-Summit. + + +## What was challenging? + +@robrix: +- SES performance has been a problem. Briefly confused into thinking we had solved the problem. We’re profiling semantic-diff-tool and running the tests on semantic-diff. If we don’t clean semantic-diff-tool then it doesn’t know that semantic-diff has been rebuilt and it doesn’t try to relink it. Happens specifically when changing branches. +- SES performance depends on O(n) cost function. + +@rewinfrey: +- Heartbreaking to discover that a huge performance win was a bad build. +- Felt like it was hard to contribute to the deployment and build process. +- Do we have a fallback in place in case S3 fails? + +@joshvera: +- Error productions from tree-sitter are difficult to debug and obscure diff summary output. +- Understanding and communicating how our deployment process works to other people. Maybe this means we need better documentation? + + +## What did you learn? + +@robrix: +- Learning about parallelism because we have large asymptotic factors in SES. +- Developed a stronger intuition for why cost has to be linear with respect to the size of the diff tree. + +@rewinfrey: +- Learned a lot about profiling in Haskell. +- Learned how to use Profiteur to visualize the space and time costs for a given computation. +- Trying to use the Eval monad to parallelize the Minimax algorithm. + +@joshvera: +- Learned about designing CRISPR proteins that can be edited into bacteria to defend against viruses and plasmids. +- Read up on GHC's Core language in order to understand some of the optimizations GHC performs. + + +## Other Items + +- Mini-Summit plans set for the week of June 20th. +- Rob on vacation starting Tuesday June 7th! :sunglasses: diff --git a/weekly/2016-06-21.md b/weekly/2016-06-21.md new file mode 100644 index 000000000..14242a5fa --- /dev/null +++ b/weekly/2016-06-21.md @@ -0,0 +1,74 @@ +# Semantic Diff Problems (Mini-Summit) + +### Performance (most significant problem) + + - SES / Alignment are biggest time / space consumers. + - Profiling small subsets of code paths rather than the full context. + - Adding more criterion benchmarks for code paths not currently profiled (like Diff Summaries). + +##### Alignment performance + + - Has to visit each child of each remaining line. + +##### [SES](https://github.com/github/semantic-diff/files/22485/An.O.ND.Difference.Algorithm.and.its.Variations.pdf) Performance + + - n^3 the size of the tree. + - Can try bounded SES (looks ahead by a fixed size of nodes). + - Identify more comparisons we can skip (i.e. don't compare functions with array literals). + - Does not look like there are more easy wins here (algorithm is already implemented to prevent unnecessary comparisions). + - In some cases, the diffing is expensive because we don't have more fine-grain identifiers for certain diffs. (e.g. a test file with 100 statement expressions). + - Diffing against identifiers (use the edit distance to determine whether to compare terms with SES or not). + - This could result in us missing a function rename though. + - Not a catchall, but it can help increase performance in a larger number of cases. + +##### [RWS](https://github.com/github/semantic-diff/files/325837/RWS-Diff.Flexible.and.Efficient.Change.Detection.in.Hierarchical.Data.pdf) Performance + + - Random Walk Similarity. + - computes approximation to the minimal edit script. + - O(log N) rather than O(n^3). + - RWS does not rely on identifiers. + - RWS solves our performance problem in the general form. + - Can allow us to diff patches of patches (something we cannot do currently with our implementation of SES). + +##### Diff summaries performance + + - Performance of DS is dependent on diffing (Diff Terms, Interpreter, cost functions) + +### Failing too hard + + - Request is not completing if Semantic Diff fails. + - How can we fail better on dotcom? + - How can we fail better when parsing? (both in Semantic Diff and dotcom) + +### Responsiveness + + - Async fetch diff summaries / diffs / progressive diffs or diff summaries + +### Improving grammars + + - Fix Ruby parser. + - Testing and verifying other grammars. + +### Measure effectiveness of grammars + +### Tooling + + - Why isn't parallelization of SES having the expected effect? + - Should focus on low hanging fruit but we're not going to write a debugger. + +### Time limitations with respect to solutions and team + +### Ramp up time is extremely variable. + +### Onboarding + + - Pairing has been fantastic. + - SES algorithm requires some context and background to understand the code at the general / macro level. + - Plan a bit before pairing to gain context. + +### Pre-launch Ideas + + - Test on a couple file server nodes and run semantic diff on javascript repos. + - Collect repos, files, shas that contain error nodes to gain a % of error rates and expose errors in tree sitter grammars. + - If sources have errors, can we use a parser that validates the source is correct? + - Configure a script that is as language independent as possible that can automate the error collection process but allows us to specify an independent validating parser for each language. diff --git a/weekly/2016-06-27.md b/weekly/2016-06-27.md new file mode 100644 index 000000000..de844a09e --- /dev/null +++ b/weekly/2016-06-27.md @@ -0,0 +1,36 @@ +# June 27th, 2016 weekly + +## What went well? + +@joshvera: Pairing, minisummitting, RWS discussions. + +@rewinfrey: Pairing, context on recursion schemes, started independent work on the project, minisummitting. Defined what to work on next + +@robrix: Minisummit: got to know both of you better & really enjoyed that. Before that I was on vacation but you both did a great job! + + +## What went less well? + +@joshvera: Lots more problems turned up. Lots of stuff that has taken on more importance as we’ve thought about it more. Feel like I could’ve made more progress on diff summaries by now. Some of that has been minisummit, some of that has been every time we do more work on it there seems to be new layers peeling off exposing other issues & more work needing to be done. + +@rewinfrey: Maybe I’m overly optimistic but I don’t have anything to point to that I didn’t think went well. The challenges we identified during minisummit felt like a good sign of the project moving forward. + +@robrix: Ditto. May end up being a bit distracted over the next couple of weeks figuring out some stuff re: summit & my attendance of it. + + +## What did you learn? + +@joshvera: Type ∋ Type isn’t as easy as it sounds. Learned about you both too! + +@rewinfrey: Learned about you both. Recursion schemes! Relationships between algebras & projections, coalgebras & embeddings, and recursion-scheme’s `Base` type family. Further explored some other morphisms. RWS (albeit misreading some of it). + +@robrix: Learned about you both! RWS. Some stuff about derivative-parsing. Learned a lot about communication too. + + +## Anything else? + +@joshvera: Out Thursday/Friday. + +@rewinfrey: Josh, how did the blue suit fit? (“Really well.”) + +@robrix: Canada Day on Friday. You’re both invited to celebrate it as well, by being as Canadian as possible. diff --git a/weekly/2016-07-12.md b/weekly/2016-07-12.md new file mode 100644 index 000000000..b98a10a87 --- /dev/null +++ b/weekly/2016-07-12.md @@ -0,0 +1,29 @@ +# July 12th, 2016 weekly + +## What went well? + +@joshvera: Glad to see objects working, and the test harness was helpful for that. + +@robrix: RWS work went well, specifically about ordering. Also confirming that RWS does not conflict with moves, although we do not support moves yet. Also generics with zipping turned out well! + +@rewinfrey: The move went well, more or less. + +## What went less well? + +@joshvera: Was sick and would have liked to contribute to test harness earlier. + +@robrix: Scrap your boilerplate style of generic programming in Haskell is tough. + +@rewinfrey: Adding test cases manually is tough. Want to find a way to automate that process. + +## What did you learn? + +@joshvera: Learned a lot about RWS, and generics in Haskell. + +@robrix: Learned about natural transformations. Understood RWS ordering problem. How to metaprogram in Haskell without headaches! Wrote a catamorphism that annotates every element in the structure with the result of the fold up to that element. + +@rewinfrey: Learned how to install curtains, and visiting Ikea is ideal on the 4th of July. + +## Anything else? + +@robrix: Reminder about Q3 goals, will be the focus of 1:1's for the next couple weeks. Checkin with how weekly format is going (@joshvera & @rewinfrey no complaints). Also see everyone at Summit! diff --git a/weekly/2016-07-26.md b/weekly/2016-07-26.md new file mode 100644 index 000000000..ef27cf40a --- /dev/null +++ b/weekly/2016-07-26.md @@ -0,0 +1,30 @@ +# July 26, 2016 weekly + +Last week was Summit. + +## What went well? + +@rewinfrey - Pairing w/ @joshvera. Made significant progress on diff summary property tests. And the PR got merged! + +@joshvera - Pairing. Summit! + +@robrix - Summit! @joshvera & @rewinfrey really came together on the diff summary stuff, too ❤️ + + + +## What was challenging? + +@rewinfrey - How to add more test cases in a non-manual way. + +@joshvera - Figuring out how much the JS parser covers. If we improved our error handling to cover more cases that might get us partway to staff shipping. + +@robrix - **After the fact:** I don’t remember what I said, now, nor what was challenging that week. + + +## What did you learn? + +@rewinfrey - All the things at Summit! Learned a lot about property testing while pairing with @joshvera. + +@joshvera - Learned about property tests. Been reading about probabilities through this machine learning book. Onto continuous probability. + +@robrix - Some stuff about derivative parsers, probably? diff --git a/weekly/2016-08-02.md b/weekly/2016-08-02.md new file mode 100644 index 000000000..0db29970f --- /dev/null +++ b/weekly/2016-08-02.md @@ -0,0 +1,45 @@ +## What went well? + +@rewinfrey + +* Made a lot of progress on auto generation of test cases. + +@robrix + +* Mergeable PR went well. A pretty big step for maintenance costs. +Self-assessment forms are really streamlined compared to last time. + +@joshvera + +* Adding remaining cases to Syntax is going pretty well. + +## What went less well? + +@rewinfrey + +* Initial confusion for being on platform support was confusing. By the end of the week we knocked out a production bug that was affecting customers. + +@robrix + +* Though the self-assessment training was more streamlined, there was a lot of training involved. + +@joshvera + +* Realized mapping C into Syntax will be more trouble than anticipated. + +## What did you learn? + +@rewinfrey + +* Learned a lot about Haskell’s shell interactions. +* Specifically creating process and how Haskell abstracts from communicating with the shell. +* Learned about Yesod to do web programming in Haskell. + +@robrix + +* Reinforced knowledge of generic programing and property tests for laws governing new type classes. In the case of Mergeable, it’s difficult to describe the powerset behavior Mergeable has, and property tests helped with that. + +@joshvera + +* Learned about probability distributions and recalled the `suchThat` is kind of like filter for Arbitrary types in quickcheck. + diff --git a/weekly/2016-08-08.md b/weekly/2016-08-08.md new file mode 100644 index 000000000..f0fcc0c4d --- /dev/null +++ b/weekly/2016-08-08.md @@ -0,0 +1,37 @@ +### What went well? + +@robrix: Interpreter stuff was effective in cleaning up / clarifying some previously messy code. diffing algorithm is now a little scripting language. + +@joshvera: Javascript syntaxes went well. Self assessments were more streamlined. + +@rewinfrey: Self assessments were simple. Pairing with Rob went well (first time really driving). + +### What didn't go well? + +@robrix: Ancillary tasks not going so well (patent process). + +@joshvera: Self assessments took time away from working on minor diff summary tasks. Getting C into syntax is going to be difficult. + +@rewinfrey: Recognizing that there is a better way to handle the effects in the test generator in the types, but not quite there skillwise to implement it (but also recognize I will get there :) ). + +### What did you learn? + +@robrix: Cemented understanding of free monad and interpreters. learned about type families and type classes for derivative parsers. keep things in single module and break out as needed to avoid orphan instances. + +@joshvera: Learned about tradeoffs of performance of free monads we currently use, and learned more about effects. over the weekend read about comonads as pointed spaces. + +@rewinfrey: Learned about how to model effects in the type system (via free and cofree), and learned foundational Yesod (routing, controllers, models / migrations, etc.). + +### Other things? + +@robrix: Re: Staff shipping in two weeks -- how do we feel? Our performance issues are still a concern, but responsiveness is being looked at outside the team. + +@joshvera: Feeling okay with staff shipping, but performance should be addressed before staff shipping. This seems possible. + +@robrix: Please keep in mind the following: + - If we can't meet the deadline, can we punt? + - No death marches please. + +@joshvera: Let's reconvene later this week and update status of deliverables. + +@robrix: Goal is to get to smaller, more regular releases. Right now that is hard, because the initial staffship of Diff Summaries frontloads a lot of functionality that future releases will benefit from. diff --git a/weekly/2016-08-15.md b/weekly/2016-08-15.md new file mode 100644 index 000000000..78d0d43f8 --- /dev/null +++ b/weekly/2016-08-15.md @@ -0,0 +1,27 @@ +# August 15th, 2016 weekly + +## What went well? + +@rewinfrey: Test generation branch got merged in. Completion of the syntax for JS! Progress on diff summaries <3 + +@joshvera: Deploying `semantic-diff` went pretty well. Added a bunch of issues for the remaining tasks. It’s a manageable chunk of work for this week. + +@robrix: The _p_,_q_-gram precomputation branch got merged. Also resolved RWS bias, and got a chance to bounce that off @jbarnette ❤️ + + +## What went …less well? + +@rewinfrey: We aren’t producing replacement patches, which is a bit of a question mark. + +@joshvera: Some `nil`s in Ruby causing some exceptions (tho they were easy to resolve). Almost botched a deploy, that could’ve gone better. + +@robrix: Running into #683 at the last mile of the precomputing _p_,_q_-grams branch was frankly a bit of a shock. + + +## What did we learn? + +@rewinfrey: Learned a lot about ambiguity & contradiction in Haskell’s typechecking & type inference. Very cool seeing how unification is able to resolve types at the very last. Did some pairing coercing a monadic value into a monadic wrapper. + +@joshvera: Composing effects in `freer`. Also that we rotate into platform support on Sunday, as I did, so I’ll be doing that this week. + +@robrix: Discovered #683! Also learned that the RWS-Diff paper’s implementation suffers this problem, but they didn’t notice (or at least didn’t note it), probably due to some ameliorating factors (they match up equalities in an earlier pass which we lack, meaning that the most obvious effects of this wouldn’t be felt). This was also a good reminder that some of our correct behaviour is only incidentally captured in our tests (if at all), partly because it’s often difficult extracting a precise property to test given an intuitive grasp of what a correct diff should look like. **Edit:** Bonus round: `.jbarnette me` exists! diff --git a/weekly/2016-08-22.md b/weekly/2016-08-22.md new file mode 100644 index 000000000..573beaa0e --- /dev/null +++ b/weekly/2016-08-22.md @@ -0,0 +1,42 @@ +# August 22nd, 2016 weekly + +## What Went Well? + +@joshvera: A lot of pull requests, a lot of changes. Hard to remember everything we covered, but covered a lot of bug fixes, a lot of testing and improving term productions in preparation for staff shipping diff summaries. + +@robrix: We covered a lot of ground especially in RWS. + +@rewinfrey: Great to dive into the meat of RWS, and also make so much progress on diff summaries. Good week of work. + + +## What Went Less Well? + +@joshvera: Would have liked to get error reporting into diff summaries. Also on platform support the week before staff shipping so in hindsight, timing could have been better. + +@robrix: Some concern that changes to RWS have overfitted it to our fixtures rather than maintaining general applicability. I have changes in mind, but those changes are on the magnitude of weeks, not days. Also apologies for pushing back reviews. + +@rewinfrey: Programming by coincidence to improve our RWS output. + +## What did we learn? + +@joshvera: Learned more about RWS. Also updates to RWS and test output allows us to verify if our models are correct in a loose machine learning analogous way. The pruning step before running RWS was interesting to learn about. + +@robrix: Learned about biases RWS has and that our implementation has, and why the paper didn't run into them or describe them as much. Want to introduce a proportional feature vector rather than a stochastic feature vector so we can make comparisons more meaningful between tree nodes. + +@rewinfrey: Learned about xml diff subscription and querying. + +## Other items + +Staff Ship Plan: + +- Write blog post + +- Test github/github locally + +- Unless something major happens, we'll staff ship this afternoon (probably around 2pm EST) + +- Follow up with people in the #javascript for repo suggestions diff summaries + +- Reprioritize / add issues in the milestone for post staffship + +- Look at improving error messages and refining the diff summary productions diff --git a/weekly/2016-09-09.md b/weekly/2016-09-09.md new file mode 100644 index 000000000..ce4a031df --- /dev/null +++ b/weekly/2016-09-09.md @@ -0,0 +1,100 @@ +# September 9th, 2016 + +- Hack week was last week and we skipped the weekly. +- We moved the weekly to the end of the week to try to cut down on the “wait, what _did_ happen last week?” thing. +- This ended up being @tclem’s first weekly 👋 + + +#### What went well? + +@joshvera: + +Hack week: + +- Made a lot of progress on the TypeScript parser. +- May be able to use that as the basis for a more rigorous JavaScript parser as well. + +This week: + +- Understand RWS & some other diffing algos a lot better than before. + + +@rewinfrey: + +- Pairing w/ @tclem. +- Updating test cases is much more efficient. +- Modelling effects in Free. + + +@tclem: + +- Little fixes. +- Static linking of ICU in dev. +- statsd client. + + +@robrix: + +- semantic-diffd +- Docker +- kubes +- Markdown + + +#### What were the challenges? + +@joshvera: + +- Integrating a pass before RWS. Using constant-time (per-subtree)SES before RWS to match up equal things. There are some ordering problems with the result. +- Ambiguities in the TypeScript grammar. Possibly due to JS actually being context-sensitive. @maxbrunsfeld advises parsing a superset of the language… but which superset? + + +@rewinfrey: + +- Trying to get an effect system in Free. Got it, but tricky. +- Also picked up an issue with template strings which defies debugging. + + +@tclem: + +- > My head hurts by the end of the day. +- Being challenged by some of the new concepts, the vernacular &c. +- Hard to know when to jump down the rabbit hole and learn a thing or when to gloss over it. +- Have a queue of things to read. + + +@robrix: + +- Converting between line/column ranges and character ranges. + + +#### What did you learn? + +@joshvera: + +- > I became one with the TypeScript grammar. +- > Maybe we should find a way to have the grammars write themselves. +- Working on this `effects` package (formerly called `freer`) & its `Eff` type. It uses an open union data structure, which `Data.Record` is sort of an approximation of. `Eff` has this detail where it’s list of function types are “type-aligned.” Every item in the list is a function type where they all chain together, a -> b, b -> c, etc. Adding, removing, & replacing effects is constant-time. + +@rewinfrey: + +- Free, and how to model effects in Free. +- Straight-up category theory stuff. Compositions of natural transformations &c. + +@tclem: + +- Post about functors, applicatives, and monads shown in pictures. +- How this manages to be a bridge between pure & stateful functions. +- Helped explain the optparse-applicative syntax. + +@robrix: + +- CMark exists, which is cool. +- Parsing/term ingestion had been producing errors for weirdly-formatted for loops &c. Not only were we hitting this on a regular basis, it was also causing confusing/poor change summaries. + + +#### Meta + +“What were the challenges?” can be a bit redundant with “what did you learn?” Should we focus this on challenges that we need help with? Gonna give that a try. + +Next week: @joshvera, @rewinfrey, & @robrix are off to ICFP. @tclem may or may not hold weekly solo at his discretion. diff --git a/weekly/2016-09-30.md b/weekly/2016-09-30.md new file mode 100644 index 000000000..7c6a7f630 --- /dev/null +++ b/weekly/2016-09-30.md @@ -0,0 +1,64 @@ +#09-30-2018 + +**What went well?** + +@tclem: Quiet week with everyone in Japan. Was heads down in parsing issues, identifying determiners. Tackled some other harder issues (ongoing now around tooling and command line parsing). + +@joshvera: ICFP was spectacular. There's a lot to write down, and ideas that could potentially apply to future features or techniques in general that would be useful. Testing RWS has gone well. Issue came up with small RWS / SES diff ordering. + +@rewinfrey: ICFP also amazing. This week small issues and started looking at keeping parent contexts for nested contexts (and have a RFC out). + +@pengwynn: Good to interface with everyone, and to see if we provide further support with platform and integrating with dotcom. + +**What were the challenges?** + +@tclem: Challenging being totally on my own a couple weeks into the project. Some issues came up that required some heavy investigation (like monad transformers). + +@joshvera: Coming back has been surprisingly difficult to have normal hours (going to Japan was easy). RWS bug with ordering terms is concerning, but should be manageable. Some PRs on master fail and think they are problems that come up in our property tests rarely (should look back and get those seeds so we can reproduce them). We have to make our diffs commute, so that if we're producing the same diff terms, they should always be in the same order. Sometimes surrounding context will change or alter diffs. + +@rewinfrey: I'm not looking at RWS so things are going well :p + +**What did you learn?** + +@tclem: Studying folds and algebraic data types. Learning about binary tree operations. Understanding of the entire architecture stack. + +@joshvera: Learned a lot at ICFP - specifically about effects and coeffects (reifying as types in a language). Effects do something to a context, coeffects reach into and look at a context. For example, a high security program that communicates with a low security program could allow the low security program to use a coeffect to understand something about what happened in the high security program, but wouldn't reveal the sensitive information. + +@rewinfrey: Learned a lot about freer monad and effects in general. Another big take away was homotopy type theory. + +---- + +@pengwynn: So I'd like to ask what are we missing on the team? + +@joshvera: The help we get from dotcom (mclark and brianmario) is very helpful so we don't have to spend as much time diving into dotcom. We haven't received a lot of design attention - have a couple technical reasons why semantic diff is currently disabled. Would like to follow up with Fabian on design next week. Would like to find people with more Haskell experience, or with stronger background in diffing in general outside of the context of version control. One of the bigger technical areas of work we will have to do is writing parsers and ensuring they are correct. + +@pengwynn: How do we leverage data to make autonomous coding a reality? As we move closer to 2017 what's the team make up look like? + +@joshvera: We're getting to a point where semantic diffing is stable. Figuring out a way to generate a corpus from the information we have would be a really hard technical solution, but would pay back in dividends. Things like semantic merging. Also Rob has ideas about how we would compare structures across different languages, and code navigation (semantic click through to definition). What are the most useful features for people we could develop immediately? It would be good to have a stronger interface with product people than we currently do. + +@tclem: We could have a dedicated effort on parsing. + +@pengwynn: Is that a polyglot or Haskeller? + +@joshvera: That's someone like Max (Max Brunsfeld) at the moment -- but in general that means a polyglot. + +@tclem: I would +1 for fabian or product design. Having someone that can help us understand the context of the future of PR's, and where that general set of features are going. + +@pengwynn: What would it take once we launch diff summaries to go from 2 languages to 25? If that's one hire we can make that happen. Want to +poll the group to determine what our holes are and what we should look for when hiring for the next teammate. + +@tclem: Looking at parsers is a good thing. + +@joshvera: Getting someone to be able to write parsers from a specification (which is researched). Taking existing stuff and putting it into a system that works for us. Also integrating with existing compilers, so we don't have to manually update our parsers every time a language change would be very beneficial. Automating that problem away would be beneficial, too. Hooking into different compilers would be something that would save us effort and energy in the future. + +@pengwynn: This is awesome, and spurs some conversations with JD's team. + +---- + +@rewinfrey: Where are we with getting diff summaries staff shipped and also out to gen pop? Would it be good to have a conversation about that early next week to clarify the direction for prioritization? + +@joshvera: RWS and platform interface issues are the two main things preventing us from staff shipping again. Also want to talk with product design to take existing feedback and adjust accordingly. There are a few things in the summer eyes milestone that I think would be most useful, but maybe those aren't what product thinks is most useful. There could be more tiny bugs that only come up in certain contexts that we might not be aware of since we only do 100 property tests. + +@tclem: It feels like we're close, and that it's really product and design and incorporating diff summaries into the new focus on code review. + +@joshvera: I'm planning to talk with Fabian early next week to sync up on design. diff --git a/weekly/2016-10-07.md b/weekly/2016-10-07.md new file mode 100644 index 000000000..919416288 --- /dev/null +++ b/weekly/2016-10-07.md @@ -0,0 +1,48 @@ +# Oct 7th, 2016 + +## What went well? + +@tclem +- productive week! Fixed lots of little bugs, project reorg finished +- Sorted out a variety of dotcom issues +- Tracking latest tree-sitter again + +@rewinfrey +- getting out annotated nested parent context. Thanks @joshvera! +- import/export syntax (new stuff, personally rewarding) + +@joshvera +- happy with all the PRs that got merged in this week +- pairing went well this week (time well spent to unblock people) + +## What were the challenges? + +@tclem +- not getting to do Haskell book (too heads down on other stuff) +- dotcom deploys hard with env var changes (need work here) + +@rewinfrey +- translating tree sitter productions for import/export syntax. How to de-structure stuff correctly. + +@joshvera +- not a lot to report that didn't go well! +- would like to have more design conversations at beginning of week +- lost track a little bit on where progressive diff and related projects are + +all +- a bit hard to track various teams + +## What did you learn? + +@tclem +- how tree-sitter works. the base library, the node compiler, each of the grammars. + +@rewinfrey +- api difference between named nodes in tree-sitter +- better understanding of how we tie into tree-sitter API via the FFI + +@joshvera +- tree-sitter APIs that we aren't using +- split diff output is slow! +- about measures of probability distributions that are multi-dimensional +- difference between variance and volatility diff --git a/weekly/2016-10-14.md b/weekly/2016-10-14.md new file mode 100644 index 000000000..a2d8ba86c --- /dev/null +++ b/weekly/2016-10-14.md @@ -0,0 +1,27 @@ +# What went well + +Rick - A lot that got accomplished this week. Take apart the structure when we’re parsing terms in the Javascript module. Pairing with Tim and Josh. Getting a bit more confidence when manipulating cofree structures. + +Tim - Feel like we’re in a good place for next staff-ship. Knowing that there will be a few more design iterations. Fixed a number of remaining issues. A bit of UI polish on the .com side. Felt like it was a good week for pairing. + +Josh - Pairing, performance improvements were straightforward and pointed the way to further improvements. + +# What didn’t go well + +Rick - Hitting a weird source slicing error when adding import statements. Feels like navigating the project or adding features is a sometimes a back and forth with current mental model. + +Tim - Felt like it was a slow week, out Monday and feeling sick. Would appreciate a concrete list of things to dive into next. + +Josh - Sick for the first half of the week. Wished there was lower hanging frut in terms of performance. + +# What did we learn + +Rick - Reading a book called Thinking like a Mathematician. An overview of how to think in proofs. Understanding universal quantification has shed light on equational reasoning. How simple the hspec-expectations module is, and what improvements could be made. + +Tim - From pairing with Rick, learned about extracting and unwrapping data structures. Dealing with and extracting things from cofree. Learning about Ripper and s-expressions. + +Josh - The curse of dimensionality will end us. + +# Other things + +It’s probably more important to get a Ruby parser now whether it’s in Haskell, Javascript, or Ripper output, than whether or not users can contribute to it. \ No newline at end of file diff --git a/weekly/2017-01-06.md b/weekly/2017-01-06.md new file mode 100644 index 000000000..2c2e238a3 --- /dev/null +++ b/weekly/2017-01-06.md @@ -0,0 +1,63 @@ +January 6, 2017 + +Welcome back @robrix! + +In place of our usual format we had an informal conversation identifying status of projects, concerns, and potential projects for the future. Also @joshvera gave us an excellent introduction to finding persistent homologies. + +Below are the main talking points of the conversation (speakers are not identified): + +---- + +Want to identify a mile stone for what to do next for diff summaries. + - What's the minimal work necessary to get this in front of customers? + - Dependents feature shipped only with Ruby support, so shipping only with JavaScript, Markdown, Ruby (?!) should be fine. + - Possible rubric for evaluating a summary statement's value: can a screen reader easily understand the statement? + - Consider limiting diff summary statements to only those statements with significant meaning. + - Create heuristics to determine what "significant" means in the context of diff summaries. + - View diff summaries through other lenses (i.e. security). Example: does a change to this regex represent a security concern? + - Par down feature to essential 2 or 3 aspects that drive most value for customer. Use this to drive conversations with product going forward. + +What project or work can we identify and prioritize next for data-science? + +Current approach to adding parsers is not scalable. Can we generate mappings somehow programmatically? @robrix possibly to look into this problem starting next week. + + +---- + +Persistent Homologies + +Motivating problem: + +**The problem with all machine learning models is error correction must be done via an error-correcting step. Even then, bias and skewing occur as a natural bi-product of the data samples used to train and test the models.** + +Motivating questions: + +**Is there a way to find significant dimensions in a high dimensional data set that do not rely on probability?** + +**Can we use linear functions and stochastic properties to determine what those significant features are?** + +Homologies: + +Given a data set, a homology is a cycle or loop of points in that data set that are significant given a significance function (e.g. distance function). + +With these data points, or topological invariants, we can use filtration to further refine the cycles or loops to find the most significant cycles. These are the strongest, or longest living, cycles. This helps us see what points in the n-dimensional data set are most important in relation to one another (rather than in relation to an assumption that is reified through a probabilistic test or approach). + +How does one measure how "good" a persistent homology is? One can use a stability distance function to measure the stability of the distance function used to identify cycles. + +---- + +Future project ideas + +Semantic index: a semantically structured index of a GitHub project. Like ctags, the goal would be to create a link-based index of symbols, names or definitions of classes, methods, functions and vars. + +This would allow a GitHub user to browse a project based on its semantic index to understand the projects layout, including its classes, methods contained within a class, and from where methods are invoked. + +Other possible uses of this could be: + +1. Visualize the weight of a class or method name based on its frequency of invocation in a project. + +2. Visualize the churn weight of a class or method based on its frequency of change over time. + +3. Security implications / risk assessment for the health and stability of a project: given that we know the most important classes and methods of a project (based on point 1), those that are most significant and change the most (point 2) represent a risk to the stability of the project. Projects with main code paths with high degree of churn represent projects that may not provide production level stability and safety for end users. Or indicate that they are still "works in progress" and not ready to be used in a production environment. + +4. Indexed project would link to the source code (e.g. method name links to current master's method definition).