{"action":"created","issue":{"url":"https://api.github.com/repos/emacs-ess/ESS/issues/174","labels_url":"https://api.github.com/repos/emacs-ess/ESS/issues/174/labels{/name}","comments_url":"https://api.github.com/repos/emacs-ess/ESS/issues/174/comments","events_url":"https://api.github.com/repos/emacs-ess/ESS/issues/174/events","html_url":"https://github.com/emacs-ess/ESS/issues/174","id":73429858,"number":174,"title":"Test cases for indentation","user":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars.githubusercontent.com/u/4465050?v=3","gravatar_id":"","url":"https://api.github.com/users/lionel-","html_url":"https://github.com/lionel-","followers_url":"https://api.github.com/users/lionel-/followers","following_url":"https://api.github.com/users/lionel-/following{/other_user}","gists_url":"https://api.github.com/users/lionel-/gists{/gist_id}","starred_url":"https://api.github.com/users/lionel-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionel-/subscriptions","organizations_url":"https://api.github.com/users/lionel-/orgs","repos_url":"https://api.github.com/users/lionel-/repos","events_url":"https://api.github.com/users/lionel-/events{/privacy}","received_events_url":"https://api.github.com/users/lionel-/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-05T20:57:12Z","updated_at":"2015-05-06T11:02:35Z","closed_at":null,"body":"Since the indentation code is rather meaty, it is difficult to change it without breaking things. It would be great to have systematic tests for indentation to reduce the probability of regressions. I will write a PR for this later this week.\r\n\r\nI put together this collection of test cases, but I probably forgot many things. Feel free to complete the list:\r\n```r\r\n### Function declarations\r\n\r\nfun <- function(arg,\r\n                arg) {\r\n    body\r\n}\r\n\r\nfunction(\r\n    arg,\r\n    arg\r\n    )\r\n    {\r\n        body\r\n    }\r\n\r\nfunction(arg_fun(sub_arg,\r\n                 sub_arg),\r\n         arg) {}\r\n\r\nfunction(arg, x = fun(\r\n                  arg),\r\n         arg) {}\r\n\r\n\r\n\r\n### Function calls\r\n\r\nfun_call(arg,\r\n         arg)\r\n\r\nfun_call(\r\n    arg,\r\n    arg\r\n    )\r\n\r\nfun_call(arg = (\r\n    stuff         # bug?\r\n    ),            #\r\n         arg)\r\n\r\nfun_call(arg = fun(\r\n             stuff\r\n    ),\r\n         arg)\r\n\r\n\r\n\r\n### Blocks\r\n\r\nfunction()\r\n    {\r\n        body\r\n    }\r\n\r\nfun_call(arg = {\r\n             stuff\r\n         },\r\n         {\r\n             stuff\r\n         }, arg = {\r\n             stuff\r\n         }, {\r\n             stuff\r\n         }\r\n         arg)\r\n\r\nfun <- call({\r\n    stuff\r\n}, {\r\n    stuff\r\n},\r\n            {          # bug\r\n                stuff  #\r\n            }          #\r\n            )          #\r\n\r\nfun_call(function(x) {\r\n             body\r\n         },\r\n         function(x) {\r\n             body\r\n         })\r\n\r\n{\r\n    {\r\n        stuff\r\n    }\r\n}\r\n\r\n{{\r\n     stuff\r\n }\r\n}\r\n\r\n\r\n### Control flow\r\n\r\nif (cond) {\r\n    stuff\r\n} else {\r\n    stuff\r\n}\r\n\r\nif (cond) {\r\n    stuff\r\n}\r\nelse {\r\n    stuff\r\n}\r\n\r\nif (cond)\r\n    {\r\n        stuff\r\n    } else\r\n        {\r\n            stuff\r\n        }\r\n\r\nif (cond)\r\n    {\r\n        stuff\r\n    }\r\nelse\r\n    {\r\n        stuff\r\n    }\r\n\r\nfor (seq)\r\n    {\r\n        stuff\r\n    }\r\n\r\nfor (seq) {\r\n    stuff\r\n}\r\n\r\n\r\n\r\n### Continuation lines\r\n\r\nstuff %>%\r\n    stuff %>%\r\n        stuff\r\n\r\n{\r\n    stuff %>%\r\n        stuff %>%\r\n            stuff\r\n} %>%\r\n    stuff %>%\r\n        stuff\r\n\r\n(\r\n    stuff %>%\r\n        stuff %>%\r\n            stuff\r\n    ) %>%\r\n    stuff %>%\r\n        stuff\r\n\r\n\r\n[\r\n stuff %>%\r\n     stuff %>%\r\n         stuff\r\n ] %>%\r\n     stuff %>%\r\n         stuff\r\n\r\nstuff %>%\r\n    stuff %>%\r\n        if (cond) {\r\n            stuff %>%\r\n                stuff %>%\r\n                    stuff\r\n        } else {\r\n            stuff %>%\r\n                stuff %>%\r\n                    for (vec) {\r\n                        stuff\r\n                    } %>%\r\n                        stuff %>%\r\n                            stuff\r\n        } %>%\r\n            stuff %>%\r\n                stuff\r\n\r\n\r\nggplot() +\r\n    geom(lhs -\r\n             rhs\r\n         ) +\r\n        geom()\r\n\r\n{\r\n    ggplot() +\r\n        geom() +\r\n            geom()\r\n}\r\n\r\nstuff +\r\n    fun(x = arg,\r\n        fun((lhs - rhs\r\n             arg\r\n             ) /\r\n                arg)\r\n        )\r\n```\r\n\r\nThese examples are indented using RRR style, but we also need tests tailored to other styles/settings."},"comment":{"url":"https://api.github.com/repos/emacs-ess/ESS/issues/comments/99418523","html_url":"https://github.com/emacs-ess/ESS/issues/174#issuecomment-99418523","issue_url":"https://api.github.com/repos/emacs-ess/ESS/issues/174","id":99418523,"user":{"login":"vspinu","id":1363467,"avatar_url":"https://avatars.githubusercontent.com/u/1363467?v=3","gravatar_id":"","url":"https://api.github.com/users/vspinu","html_url":"https://github.com/vspinu","followers_url":"https://api.github.com/users/vspinu/followers","following_url":"https://api.github.com/users/vspinu/following{/other_user}","gists_url":"https://api.github.com/users/vspinu/gists{/gist_id}","starred_url":"https://api.github.com/users/vspinu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vspinu/subscriptions","organizations_url":"https://api.github.com/users/vspinu/orgs","repos_url":"https://api.github.com/users/vspinu/repos","events_url":"https://api.github.com/users/vspinu/events{/privacy}","received_events_url":"https://api.github.com/users/vspinu/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T11:02:34Z","updated_at":"2015-05-06T11:02:34Z","body":"> So, please start your new file by moving the indentation examples from R-ESS-bugs.R to the new file.\r\n\r\n@lionel-  is aware of that file and he used it as a reference.That file is for bug tracking and is frequently modified which makes it unsuitable for automated testing (see the my comment on automated replication). \r\n\r\nWe also want the file to be structured by indentation type so that it can serve as examples of indentation styles for other people.  `R-ESS-bugs.R` is organized  on `fifo` principles and I don't think we can do better.\r\n\r\nWhat @lionel-  did is already pretty comprehensive and systematic.  There might be a few indentation test relating to comments what are in `R-ESS-bugs.R` but are missing here.  But that I can fix myself once the test suit is merged."}}