-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,536 additions
and
1,386 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
if(typeof exports === 'object') { | ||
var assert = require("assert"); | ||
var alasql = require('..'); | ||
} else { | ||
__dirname = '.'; | ||
}; | ||
|
||
describe('Test 307 special selectors', function() { | ||
|
||
it('0. Create database ',function(done){ | ||
alasql('CREATE DATABASE test307;USE test307'); | ||
done(); | ||
}); | ||
|
||
|
||
it('1. SET selector',function(done){ | ||
var data = [{a:1,b:10},{a:2,b:20}]; | ||
var res = alasql('SEARCH / set(b=a*3) FROM ?',[data]); | ||
// console.log(res); | ||
// console.log(data); | ||
assert.deepEqual(res,[ { a: 1, b: 3 }, { a: 2, b: 6 } ]); | ||
assert.deepEqual(data,[ { a: 1, b: 3 }, { a: 2, b: 6 } ]); | ||
done(); | ||
}); | ||
|
||
it('2. SET selector',function(done){ | ||
var data = [{a:1,b:10},{a:2,b:20}]; | ||
var res = alasql('SEARCH / clonedeep() set(b=a*3) FROM ?',[data]); | ||
// console.log(res); | ||
// console.log(data); | ||
assert.deepEqual(res,[ { a: 1, b: 3 }, { a: 2, b: 6 } ]); | ||
assert.deepEqual(data,[ { a: 1, b: 10 }, { a: 2, b: 20 } ]); | ||
done(); | ||
}); | ||
|
||
// it('3. DELETE selector',function(done){ | ||
// var data = [{a:1,b:10},{a:2,b:20}]; | ||
// var res = alasql('SEARCH / ok(a=1) FROM ?',[data]); | ||
// console.log(res); | ||
// console.log(data); | ||
// // assert.deepEqual(res,[ { a: 1, b: 3 }, { a: 2, b: 6 } ]); | ||
// // assert.deepEqual(data,[ { a: 1, b: 10 }, { a: 2, b: 20 } ]); | ||
// done(); | ||
// }); | ||
|
||
it('99. Drop database ',function(done){ | ||
alasql('DROP DATABASE test307'); | ||
done(); | ||
}); | ||
|
||
}); | ||
|