1 if(!dojo._hasResource["dojox.collections.tests.Stack"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.collections.tests.Stack"] = true;
3 dojo.provide("dojox.collections.tests.Stack");
4 dojo.require("dojox.collections.Stack");
6 tests.register("dojox.collections.tests.Stack", [
8 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
9 t.assertEqual(4, s.count);
11 function testClear(t){
12 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
14 t.assertEqual(0, s.count);
16 function testClone(t){
17 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
19 t.assertEqual(s.count, cloned.count);
20 t.assertEqual(s.toArray().join(), cloned.toArray().join());
22 function testContains(t){
23 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
24 t.assertTrue(s.contains("bar"));
25 t.assertFalse(s.contains("faz"));
27 function testGetIterator(t){
28 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
29 var itr=s.getIterator();
30 while(!itr.atEnd()){ itr.get(); }
31 t.assertEqual("bull", itr.element);
34 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
35 t.assertEqual("bull", s.peek());
38 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
39 t.assertEqual("bull", s.pop());
40 t.assertEqual("test", s.pop());
43 var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
45 t.assertEqual("bug", s.peek());