forked from cory/tildefriends
Cory McWilliams
7a16a1d65c
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3161 ed5197a5-7fde-0310-b194-c3ffbd925b24
35 lines
596 B
Bash
Executable File
35 lines
596 B
Bash
Executable File
#!/bin/bash
|
|
|
|
mkdir testdb
|
|
|
|
cat > test.js << EOF
|
|
var db = new Database("testdb");
|
|
if (db.get("a")) {
|
|
exit(1);
|
|
}
|
|
db.set("a", 1);
|
|
if (db.get("a") != 1) {
|
|
exit(1);
|
|
}
|
|
db.set("b", 2);
|
|
db.set("c", 3);
|
|
|
|
var expected = ['a', 'b', 'c'];
|
|
var have = db.getAll();
|
|
for (var i = 0; i < have.length; i++) {
|
|
var item = have[i];
|
|
if (expected.indexOf(item) == -1) {
|
|
print("Did not find " + item + " in db.");
|
|
exit(2);
|
|
} else {
|
|
expected.splice(expected.indexOf(item), 1);
|
|
}
|
|
}
|
|
if (expected.length) {
|
|
print("Expected but did not find: " + JSON.stringify(expected));
|
|
exit(3);
|
|
}
|
|
EOF
|
|
|
|
$TILDEFRIENDS test.js
|