Created
May 7, 2012 13:51
-
-
Save k-bx/2627879 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
(defun un-camelcase-string (s &optional sep start) | |
"Convert CamelCase string S to lower case with word separator SEP. | |
Default for SEP is a hyphen \"-\". | |
If third argument START is non-nil, convert words after that | |
index in STRING." | |
(let ((case-fold-search nil)) | |
(while (string-match "[A-Z]" s (or start 1)) | |
(setq s (replace-match (concat (or sep "-") | |
(downcase (match-string 0 s))) | |
t nil s))) | |
(downcase s))) |
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
# -*- mode: snippet -*- | |
# key: ut | |
# name: ut | |
# expand-env: ((yas/indent-line 'fixed)) | |
# -- | |
class Test${1:Foo}(BaseTestCase): | |
def setUp(self): | |
super(Test$1, self).setUp() | |
def tearDown(self): | |
super(Test$1, self).tearDown() | |
def test_should_${1:$(un-camelcase-string text "_")}(self): | |
$2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment