-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/sh -eu | ||
|
||
test -d vendor/vader.vim || { | ||
git clone --depth=1 https://github.com/junegunn/vader.vim.git vendor/vader.vim | ||
} | ||
|
||
vim -esNu test/fixtures/vimrc -c 'Vader! test/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Given php (condition on if): | ||
<?php | ||
|
||
$sentence = 'Hello'; | ||
|
||
if ('foo' === $firstName) { | ||
$sentence .= ' ' . $firstName; | ||
} | ||
|
||
Do (select the condition and extract variable): | ||
/foo\<CR> | ||
vi( | ||
;ev | ||
firstNameIsValid\<CR> | ||
|
||
Expect php (variable is extracted): | ||
<?php | ||
|
||
$sentence = 'Hello'; | ||
|
||
$firstNameIsValid = 'foo' === $firstName; | ||
|
||
if ($firstNameIsValid) { | ||
$sentence .= ' ' . $firstName; | ||
} | ||
|
||
Given php (condition on if and on function): | ||
<?php | ||
|
||
function prepareSentence() | ||
{ | ||
$sentence = 'Hello'; | ||
|
||
if ('foo' === $firstName) { | ||
$sentence .= ' ' . $firstName; | ||
} | ||
|
||
return $sentence; | ||
} | ||
|
||
Do (select the condition and extract variable): | ||
/foo\<CR> | ||
vi( | ||
;ev | ||
firstNameIsValid\<CR> | ||
|
||
Expect php (variable is extracted): | ||
<?php | ||
|
||
function prepareSentence() | ||
{ | ||
$sentence = 'Hello'; | ||
|
||
$firstNameIsValid = 'foo' === $firstName; | ||
|
||
if ($firstNameIsValid) { | ||
$sentence .= ' ' . $firstName; | ||
} | ||
|
||
return $sentence; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
" Setup a testing environment that is isolated from the other plugins. | ||
" | ||
filetype off | ||
|
||
set rtp+=vendor/vader.vim | ||
set rtp+=. | ||
set rtp+=after | ||
|
||
filetype plugin on | ||
filetype indent on | ||
|
||
syntax enable | ||
|
||
let mapleader = ";" |