Tizen 2.1 base
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / node_modules / grunt / node_modules / nodeunit / node_modules / tap / node_modules / runforcover / node_modules / bunker / node_modules / burrito / test / label.js
1 var test = require('tap').test;
2 var burrito = require('../');
3
4 test('call label', function (t) {
5     t.plan(1);
6     
7     burrito('foo(10)', function (node) {
8         if (node.name === 'call') {
9             t.equal(node.label(), 'foo');
10         }
11     });
12 });
13
14 test('var label', function (t) {
15     t.plan(1);
16     
17     burrito('var x = 2', function (node) {
18         if (node.name === 'var') {
19             t.same(node.label(), [ 'x' ]);
20         }
21     });
22 });
23
24 test('vars label', function (t) {
25     t.plan(1);
26     
27     burrito('var x = 2, y = 3', function (node) {
28         if (node.name === 'var') {
29             t.same(node.label(), [ 'x', 'y' ]);
30         }
31     });
32 });
33
34 test('defun label', function (t) {
35     t.plan(1);
36     
37     burrito('function moo () {}', function (node) {
38         if (node.name === 'defun') {
39             t.same(node.label(), 'moo');
40         }
41     });
42 });
43
44 test('function label', function (t) {
45     t.plan(1);
46     
47     burrito('(function zzz () {})()', function (node) {
48         if (node.name === 'function') {
49             t.same(node.label(), 'zzz');
50         }
51     });
52 });
53
54 test('anon function label', function (t) {
55     t.plan(1);
56     
57     burrito('(function () {})()', function (node) {
58         if (node.name === 'function') {
59             t.equal(node.label(), null);
60         }
61     });
62 });
63
64 test('dot call label', function (t) {
65     t.plan(1);
66     
67     burrito('process.nextTick(fn)', function (node) {
68         if (node.name === 'call') {
69             t.equal(node.label(), 'nextTick');
70         }
71     });
72 });
73
74 test('triple dot label', function (t) {
75     t.plan(1);
76     
77     burrito('a.b.c(fn)', function (node) {
78         if (node.name === 'call') {
79             t.equal(node.label(), 'c');
80         }
81     });
82 });
83
84 test('expr label', function (t) {
85     t.plan(1);
86     
87     burrito('a.b[x+1](fn)', function (node) {
88         if (node.name === 'call') {
89             t.ok(node.label() === null);
90         }
91     });
92 });