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"); | |
}; |
I posted to the couchbase list but haven't heard anything yet.
Also posted on the issue tracker. http://www.couchbase.org/issues/browse/CB-83
It appears only regex literals are broken in couchbase, see: https://gist.github.com/1498086
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is the couchdb community discussing this regex issue somewhere? i'd like to follow the progress.