Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc344b0

Browse files
committed
Add test with vader
1 parent5804b8b commitfc344b0

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

‎README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,12 @@ class Foo {
381381
`<Leader>da` will call your documentation plugin (by default Php Documentor for vimhttps://github.com/tobyS/pdv) for every uncommented classes, methods, functions and properties.
382382

383383

384+
##Running tests
385+
386+
```
387+
bin/test
388+
```
389+
390+
###How to write tests?
391+
392+
Seehttps://github.com/junegunn/vader.vim

‎bin/test‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/sh -eu
2+
3+
test -d vendor/vader.vim|| {
4+
git clone --depth=1 https://github.com/junegunn/vader.vim.git vendor/vader.vim
5+
}
6+
7+
vim -esNu test/fixtures/vimrc -c'Vader! test/*'

‎test/extract_variable.vader‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Given php (condition on if):
2+
<?php
3+
4+
$sentence = 'Hello';
5+
6+
if ('foo' === $firstName) {
7+
$sentence .= ' ' . $firstName;
8+
}
9+
10+
Do (select the condition and extract variable):
11+
/foo\<CR>
12+
vi(
13+
;ev
14+
firstNameIsValid\<CR>
15+
16+
Expect php (variable is extracted):
17+
<?php
18+
19+
$sentence = 'Hello';
20+
21+
$firstNameIsValid = 'foo' === $firstName;
22+
23+
if ($firstNameIsValid) {
24+
$sentence .= ' ' . $firstName;
25+
}
26+
27+
Given php (condition on if and on function):
28+
<?php
29+
30+
function prepareSentence()
31+
{
32+
$sentence = 'Hello';
33+
34+
if ('foo' === $firstName) {
35+
$sentence .= ' ' . $firstName;
36+
}
37+
38+
return $sentence;
39+
}
40+
41+
Do (select the condition and extract variable):
42+
/foo\<CR>
43+
vi(
44+
;ev
45+
firstNameIsValid\<CR>
46+
47+
Expect php (variable is extracted):
48+
<?php
49+
50+
function prepareSentence()
51+
{
52+
$sentence = 'Hello';
53+
54+
$firstNameIsValid = 'foo' === $firstName;
55+
56+
if ($firstNameIsValid) {
57+
$sentence .= ' ' . $firstName;
58+
}
59+
60+
return $sentence;
61+
}

‎test/fixtures/vimrc‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
filetypeoff
2+
setrtp+=vendor/vader.vim
3+
setrtp+=.
4+
setrtp+=after
5+
filetypepluginindenton
6+
syntaxenable
7+
let mapleader=";"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp