From 01a05e38ee4aba5e5e5f57187c20e336c8d2f8ed Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Thu, 13 Feb 2014 22:12:33 +0100 Subject: [PATCH 1/2] Disable relatedtests if file extension is not supported --- plugin/relatedtest.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugin/relatedtest.vim b/plugin/relatedtest.vim index 49f5a5e..f096f74 100644 --- a/plugin/relatedtest.vim +++ b/plugin/relatedtest.vim @@ -16,6 +16,23 @@ if !exists('g:relatedtest_open_command') let g:relatedtest_open_command = 'tt' endif +let available_extensions = [ + \ '\.php$', + \ '\.go$', + \ '\.java$' + \ ] + +let is_available = 0 +for pattern in available_extensions + if bufname('%') =~ pattern + let is_available = 1 + endif +endfor + +if is_available == 0 + finish +endif + function! g:relatedTestHandleTT() let a:bufname = bufname('%') if b:relatedTestIsTest(a:bufname) > 0 From 1307f7734d132bda5db2eb7eb1e935b6941607a7 Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Thu, 13 Feb 2014 22:12:42 +0100 Subject: [PATCH 2/2] Java in readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6121cc8..395cd4c 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ If the test file is missing you can create it on the fly. - In PHP if you open `src/Name/App.php` and issue `tt` the plugin tries to open `tests/Name/AppTest.php` - In Golang if you open `boat.go` and issue `tt` the plugin tries to open `boat_test.go` +- In Java if you open the class AppController.java under the package com.mycompany.App and issue ``tt`` the plugin tries to open the class `AppControllerTest.java` under the same package ... And viceversa! ;-)