Permalink
Browse files

multi level group/items in working storage, test

  • Loading branch information...
1 parent 79c6b07 commit e58b814ad6d6c233c3300dbc28b40ad5e86a77d0 @ajlopez committed Dec 22, 2012
Showing with 30 additions and 0 deletions.
  1. +30 −0 test/ws.js
View
30 test/ws.js
@@ -52,3 +52,33 @@ assert.ok(program.data.working_storage);
assert.ok(typeof(program.data.working_storage.group1) != 'undefined');
assert.ok(typeof(program.data.working_storage.group1.items.item1) != 'undefined');
assert.ok(typeof(program.data.working_storage.group1.items.item2) != 'undefined');
+
+// Working storage with two group items and three levels
+
+var parser = new cobs.Parser('\
+DATA DIVISION.\r\n\
+WORKING-STORAGE SECTION.\r\n\
+01 GROUP1.\r\n\
+02 ITEM1.\r\n\
+03 SUBITEM1.\r\n\
+03 SUBITEM2.\r\n\
+02 ITEM2.\r\n\
+01 GROUP2.\r\n\
+02 ITEM1.\r\n\
+02 ITEM2.\r\n\
+ ');
+
+var program = parser.parseProgram();
+
+assert.ok(program);
+assert.ok(program.data);
+assert.ok(program.data.working_storage);
+assert.ok(program.data.working_storage.group1);
+assert.ok(program.data.working_storage.group1.items.item1);
+assert.ok(program.data.working_storage.group1.items.item1.items);
+assert.ok(typeof(program.data.working_storage.group1.items.item1.items.subitem1) != 'undefined');
+assert.ok(typeof(program.data.working_storage.group1.items.item1.items.subitem2) != 'undefined');
+assert.ok(typeof(program.data.working_storage.group1.items.item2) != 'undefined');
+assert.ok(program.data.working_storage.group2);
+assert.ok(typeof(program.data.working_storage.group2.items.item1) != 'undefined');
+assert.ok(typeof(program.data.working_storage.group2.items.item2) != 'undefined');

0 comments on commit e58b814

Please sign in to comment.