aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2018-08-15Add support for function symbols as project default commandsAndreas Marschke
This allows for the implementation of IDE-like features where projectile could context-sensitively change the value of the command to execute for a given command type. An example usage of this feature would go as follows: ```elisp (defun my/compile-command () "Returns a String representing the compile command to run for the given context" (cond ((and (eq major-mode 'java-mode) (not (string-match-p (regexp-quote "\\.*/test/\\.*") (buffer-file-name (current-buffer))))) "./gradlew build") ((eq major-mode 'web-mode) "./gradlew compile-templates") )) (defun my/test-command () "Returns a String representing the test command to run for the given context" (cond ((eq major-mode 'js-mode) "grunt test") ;; Test the JS of the project ((eq major-mode 'java-mode) "./gradlew test") ;; Test the Java code of the project ((eq major-mode 'my-mode) "special-command.sh") ;; Even Special conditions/test-sets can be covered )) (projectile-register-project-type 'has-command-at-point '("file.txt") :compile 'my/compile-command :test 'my/test-command) ``` In cases where one projectile project covers multiple different build types and commands to run subdivisions of the testset this is a major improvement.
2018-08-08Use regexp-quote in projectile-get-other-filesSean Bowman
to handle files with characters like "+" in them correctly. Such characters should be matched literally instead of ending up as part of a regexp. This happens for example with Objective-C, where it's common to have two files of the form Class+Protocol.{m,h}.
2018-07-28Match ignored buffers against regular expressions (#1260)Jorge Araya Navarro
Buffers are created by other packages that appear on projectile's buffer lists, but they always have some variation that makes impossible including all possible name cases, thus regular expressions come handy for this sort of cases. This commit allows `*-ignored-*-p` functions to work with regular expressions.
2018-07-24Avoid "No projects needed to be removed." messages in global modeRemco van 't Veer
When enabling projectile-global-mode every time a new file buffer is opened, a "No projects needed to be removed." message is triggered. These messages are not helpful to the user, clutter the messages buffer, may obscure other more informative messages in the mini buffer, and are rather annoying. The former behaviour, when used interactively, is still intact.
2018-07-12Fix a broken testBozhidar Batsov
2018-07-09Set projectile-test-path for the testsBozhidar Batsov
2018-07-09Add a test-helper.el for ert-runnerBozhidar Batsov
2018-07-09Update the Travis setupBozhidar Batsov
2018-06-16[Fix #1246] Give clear-known-projects test temp project fileNick Drozd
This test was blowing away the actual project file, rather than a test file. To fix this, move the test to the known-project-test file and give it test-tmp-file-path.
2018-06-16Ensure project-roots are directoriesNick Drozd
Projectile adds projects as directory names, as in "~/project/". Manually adding a project root that is not a directory name, as in (projectile-add-known-project "~/project"), works fine, but Projectile will then add the project root as a directory name, so that both "~/project" and "~/project/" will be in the list of known projects. This change converts "~/project" to "~/project/" before adding it to the list, thereby avoiding annoying near-duplicates.
2018-03-17[Fix #1222] Don't pass nil format string to `format`Stephan Creutz
The return value of `projectile-default-configure-command` is checked for nil, since `format` doesn't accept nil format strings.
2017-12-29[Fix #1193] Add :src-dir and :test-dir to project-type (#1204)Alexandre Héaumé
Currently, the source directory and test directory are hardcoded values ("src/" and "test/", cf. projectile-create-test-file-for) This commit adds :src-dir and :test-dir as arguments to projectile-project-type to make it easier to control where the tests file are created.
2017-11-19Support setting default compilation dirMattias Bengtsson
Some build systems (eg. meson, autotools and CMake) support building out out-of-tree. This is already supported in projectile by setting the `projectile-project-compilation-dir` variable in .dir-locals.el of the project you prefer an out-of-tree build fr. However for some build systems (eg. meson) building in-tree is not a possibility and having to add a .dir-locals.el file to each meson project is not ergonomic. Add support for setting a default compilation dir to a project type.
2017-11-19Move rails-* project type detection before npm (#1191)kayhide
2017-11-19Treat members of projectile-globally-ignored-file-suffixes as file name ↵Dmitry Lazurkin
suffixes.
2017-11-09Allow the project files to list to expire after a time periodWilfred Hughes
projectile-enable-caching is important for performance for commands like projectile-find-file. However, the cache lives indefinitely (even across Emacs restarts) and can go stale if files are added/removed outside of Emacs. Instead, allow the user to specify how long the cache may live by setting projectile-files-cache-expire, similar to projectile-file-exists-local-cache-expire.
2017-07-24Cache projectile-project-root for performance (#1149)Alex Murray
Cache the result of (projectile-project-root) as a buffer local variable to increase performance - this is implemented the same as was done for (projectile-project-name) in PR 1906. To ensure project root cache is used when there is no project (ie. when (projectile-project-root) is nil) - we set the cached value to the symbol 'none' and then replace this with nil before we return it - since the cached value is non-nil we don't reevaluate it - but we don't want to return 'none' as a result - so we instead substitute 'none' for nil before returning, and also move the `projectile-require-project-root` error check to the exit of the function to ensure this is still raised in this case. Finally, this commit also changes the unit tests to handle the cached project root by resetting before each evaluation - since the unit tests don't actually change the (buffer-file-name) we need to do this to ensure they still pass.
2017-07-22Improve performance of unignore directive for directories (#1139)smallid
2017-04-16Specify test suffix and prefix at project type registration (#1127)Evgeniy Sharapov
2016-12-15[Fix #1078] For projectile-grep/ag use default value like grep/rgrep/agDmitry Lazurkin
2016-10-05Fix indentation and add missing metadataBozhidar Batsov
2016-10-05Make projectile-mode a global modeBozhidar Batsov
2016-10-05Unify modifications to find-file-hookOleh Krehel
projectile.el (projectile-find-file-hook-function): New defun. Call nothing for remote files. * projectile.el (projectile-mode): Don't set find-file-hook locally. * test/projectile-test.el (projectile-test-setup-hook-functions-projectile-mode): (projectile-test-setup-hook-functions-projectile-global-mode): Update tests.
2016-10-04Revert "[Fix #1044] Prefer `call-process` to `shell-command-to-string` (#1045)"Bozhidar Batsov
This reverts commit ee5ce8d0799d6db366025cc664faf683cfdb4cca.
2016-09-26[Fix #1044] Prefer `call-process` to `shell-command-to-string` (#1045)Ivan Malison
This change makes it so that a direct `call-process` invocation is used when it is possible to determine what binary should be used for the command. This avoids the cost of shell startup time that is incurred when `shell-command-to-string` is invoked instead.
2016-09-21Fix a broken testBozhidar Batsov
2016-08-29Use .elpa as dir for packages and remove CaskOleh Krehel
* travis/provision.sh: Don't install Cask. * test/make-update.el: Use .elpa. * test/elpa.el: Use .elpa. * doc/contributing.md: Update test recipe notes. Re #1046
2016-08-26Simplify MakefileOleh Krehel
* Makefile: Don't depend on cask, which has been broken for months. Simplify the "all", "update", "compile", "test" and "clean" targets to a single line each. * script/emacs.sh: Remove unnecessary script. * test/elpa.el: New script that initializes the package directory to .cask/version. * test/make-update.el: New script that updates dependencies in .cask/version. * test/make-compile.el: New script that compiles projectile.el.
2016-07-28Ignore backup files in projectile-get-other-file (#1034)jchmrt
projectile-get-other-file used to consider backup files of files as the same extension. So if you called it with "test.c" as current-file and '("test.h" "test.h~") it would return them both, while the user probably wouldn't want to edit the backup file. This commit makes sure no backup files are returned.
2016-04-05Let user override ignored filesLionel Henry
Closes #892
2016-03-26Ignore cached project roots that point to nonexistent directoriesWilfred Hughes
This fixes an awkward bug when the current project is a symlink that changes. Suppose we have the following filesystem layout: /tmp/projectile_project -> /tmp/first_project If we now delete /tmp/first_project and change the symlink: /tmp/projectile_project -> /tmp/second_project then `projectile-project-root-cache` will contain a key `"projectile-root-bottom-up-/tmp/projectile-project"` with value `"/tmp/first_project"`. This will stop `projectile-find-file` from working as it can't cd to /tmp/first_project. Instead, we enforce that the string from `projectile-project-root` points to a directory that currently exists.
2016-02-21Fix test of `projectile-cleanup-known-projects'Sean Whitton
This test can fail if user-emacs-dir does not exist. So make a temporary known projects file, as is done in the test of `projectile-merge-known-projects' in projectile-known-project-test.el.
2016-02-10[Fix #952] Exclude out-of-project VCS submodulesTim Harper
2016-02-04[Fix #955] Handle match candidates in project rootsandor-juhasz
2015-10-17Allow specification of a compilation dirDavid Shepherd
Other than the project root dir. Fixes #874. Also make compile-command cache compile-directory specific.
2015-10-10Fix non-ASCII parsing in dirconfigJoonatan O'Rourke
2015-08-26Allow specifying regexp to projectile-grepGeorg Brandl
This makes overriding the "query the user" part easier.
2015-07-14[Fix #454] Add Nested extensions for other filesNupf
2015-06-10Merge pull request #728 from vspinu/truenameBozhidar Batsov
[Fix #657] Remove `file-truename` calls from `projectile-project-root`
2015-04-27[Fix #657] Remove `file-truename` calls from `projectile-project-root`Vitalie Spinu
Also make `projectile-locate-dominating-file` return expanded directory.
2015-04-27Pass `nowarn` argument to `find-file-noselect` in testsVitalie Spinu
2015-04-27Don't re-create dummy buffers in testsVitalie Spinu
2015-04-27Add debug specs to helper test macrosVitalie Spinu
2015-02-22Fix test for tags-exclude-patternsDhiraj Goel
2015-02-22projectile-find-other-file sort candidatesLefteris Karapetsas
In projects where there are multiple file names with the same header/source combinations we can still provide more accurate results by sorting the candidates list to put the other-file under the same directory name as this file to the top of the list.
2015-02-07[Fix #560] [Fix #580] Add new defcustom that is used for globally ignoring ↵Todd Neal
files by extension Add a new defcustom projectile-globally-ignored-file-suffixes that is used by projectile-remove-ignored to remove files based off of the file suffix.
2015-02-01Sanitize test setupJonas Bernoulli
* Remove test/test-helpers. * Remove prefix less helper variables and functions. * Provide two new prefixed macros, which actually solve the task they are supposed to solve _completely_, instead of stopping have way through, like the predecessors did. * Stop using the `f' library. * Enforce use of spaces for indentation. * Explicitly require needed libraries.
2015-02-01Stop depending on s and fJonas Bernoulli
Only two functions from `s' were used for which no equivalent function exists in all supported Emacs versions. So add a backward compatibility definition of `string-suffix-p' and add `projectile-trim-string' as a replacement for `s-trim'. In all other cases *not* using `s' and `f' is actually an improvement, in my humble opinion. And having to define the two mentioned functions does therefor not outweigh not having two additional dependencies. Also see #623.
2015-02-01Improve parse-dirconfig-file testJonas Bernoulli
Use more explicit filenames, making it possible to guess what is being tested by just looking at the filenames. Also extend test to assert that empty lines are ignored.
2015-01-07Remove some ack leftoversBozhidar Batsov