Created
December 19, 2011 17:33
-
-
Save mandric/1498086 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
// passes in couchbase single server, you can test in Futon by pasting into Custom Test | |
couchTests.custom_test = function(debug) { | |
var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"}); | |
db.deleteDb(); | |
db.createDb(); | |
if (debug) debugger; | |
var testregexDoc = { | |
_id: "_design/testregex", | |
"shows" : { | |
"newexec" : "function(doc) {\ | |
var re = new RegExp('test'); return re.exec('testing')[0];\ | |
}", | |
"newtest" : "function(doc) {\ | |
var re = new RegExp('test'); return String(re.test('testing'));\ | |
}" | |
} | |
}; | |
var save_response = db.save(testregexDoc); | |
T(save_response.ok); | |
var xhr = CouchDB.request("GET", "/test_suite_db/_design/testregex/_show/newexec"); | |
T(xhr.responseText === "test"); | |
xhr = CouchDB.request("GET", "/test_suite_db/_design/testregex/_show/newtest"); | |
T(xhr.responseText === "true"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment