summaryrefslogtreecommitdiff
path: root/jstests/core/string_with_nul_bytes.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/string_with_nul_bytes.js')
-rw-r--r--jstests/core/string_with_nul_bytes.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/jstests/core/string_with_nul_bytes.js b/jstests/core/string_with_nul_bytes.js
new file mode 100644
index 00000000000..a1f6e395dd2
--- /dev/null
+++ b/jstests/core/string_with_nul_bytes.js
@@ -0,0 +1,9 @@
+// SERVER-6649 - issues round-tripping strings with embedded NUL bytes
+
+t = db.string_with_nul_bytes.js;
+t.drop();
+
+string = "string with a NUL (\0) byte";
+t.insert({str:string});
+assert.eq(t.findOne().str, string);
+assert.eq(t.findOne().str.length, string.length); // just to be sure