File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
test/integration/connection Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ var common = require ( '../../common' ) ;
2
+ var connection = common . createConnection ( ) ;
3
+ var assert = require ( 'assert' ) ;
4
+
5
+ // test data stores
6
+ var testData = [
7
+ 'ютф восемь' ,
8
+ 'परीक्षण' ,
9
+ 'test тест テスト փորձաsրկում পরীক্ষা kiểm tra' ,
10
+ 'ტესტი પરીક્ષણ מבחן פּרובירן اختبار'
11
+ ] ;
12
+
13
+ var resultData = null ;
14
+
15
+ // tests
16
+
17
+ var testEncoding = function ( err ) {
18
+ assert . ifError ( err ) ;
19
+
20
+ testData . forEach ( function ( data ) {
21
+ connection . query (
22
+ 'INSERT INTO `test-charset-encoding` (field) values(?)' ,
23
+ [ data ] ,
24
+ function ( err2 ) {
25
+ assert . ifError ( err2 ) ;
26
+ } ) ;
27
+ } ) ;
28
+
29
+ connection . query ( 'SELECT * from `test-charset-encoding`' , function ( err , results ) {
30
+ assert . ifError ( err ) ;
31
+ resultData = results ;
32
+ } ) ;
33
+ connection . end ( ) ;
34
+ } ;
35
+
36
+ // init test sequence
37
+ ( function ( ) {
38
+ connection . query (
39
+ 'CREATE TABLE IF NOT EXISTS `test-charset-encoding` ' +
40
+ '( `field` VARCHAR(1000) CHARACTER SET latin1 COLLATE latin1_danish_ci)' ,
41
+ function ( err ) {
42
+ assert . ifError ( err ) ;
43
+ connection . query ( 'DELETE from `test-charset-encoding`' , testEncoding ) ;
44
+ } ) ;
45
+ } ) ( ) ;
46
+
47
+ process . on ( 'exit' , function ( ) {
48
+ resultData . forEach ( function ( data , index ) {
49
+ assert . equal ( data . field , testData [ index ] ) ;
50
+ } ) ;
51
+ } ) ;
You can’t perform that action at this time.
0 commit comments