Created
December 2, 2011 19:20
-
-
Save mandric/1424480 to your computer and use it in GitHub Desktop.
couchdb regex test
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
// fails 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" : { | |
"exec" : "function(doc) {\ | |
var re = /test/; return re.exec('testing')[0];\ | |
}", | |
"test" : "function(doc) {\ | |
var re = /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/exec"); | |
T(xhr.responseText == "test"); | |
xhr = CouchDB.request("GET", "/test_suite_db/_design/testregex/_show/test"); | |
T(xhr.responseText == "true"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also posted on the issue tracker. http://www.couchbase.org/issues/browse/CB-83