Created
November 14, 2014 14:19
-
-
Save thinca/ea922d7ce1a740b6615f to your computer and use it in GitHub Desktop.
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
Describe vimspec-style | |
Describe supports lexical scope | |
let test_var_1 = 1 | |
It can access to the variable | |
Assert True(exists('test_var_1')) | |
Assert Equals(test_var_1, 1) | |
End | |
It does not taint the global scope | |
Assert False(exists('g:test_var_1')) | |
End | |
Context in the child block | |
It can access to the variable | |
Assert True(exists('test_var_1')) | |
Assert Equals(test_var_1, 1) | |
End | |
End | |
Context in before block | |
Before | |
let test_var_1 = 5 | |
End | |
It can change the variable | |
Assert True(exists('test_var_1')) | |
Assert Equals(test_var_1, 5) | |
End | |
End | |
Context in before each block | |
let inc = 0 | |
Before each | |
let inc += 1 | |
End | |
It is shared the scope (first) | |
Assert True(exists('inc')) | |
Assert Equals(inc, 1) | |
End | |
It is shared the scope (second) | |
Assert True(exists('inc')) | |
Assert Equals(inc, 2) | |
End | |
It is shared the scope (third) | |
Assert True(exists('inc')) | |
Assert Equals(inc, 3) | |
End | |
End | |
End | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment