Skip to content

Instantly share code, notes, and snippets.

@thinca
Created November 14, 2014 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinca/ea922d7ce1a740b6615f to your computer and use it in GitHub Desktop.
Save thinca/ea922d7ce1a740b6615f to your computer and use it in GitHub Desktop.
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