Comparison

tests/test_util_stanza.lua @ 7961:ff556d010225

tests: Trim trailing whitespace
author Kim Alvefur <zash@zash.se>
date Mon, 06 Mar 2017 16:01:27 +0100
parent 7503:1810f1a4ff05
comparison
equal deleted inserted replaced
7960:9a938b785bc5 7961:ff556d010225
35 local s1 = stanza("s1"); 35 local s1 = stanza("s1");
36 assert_equal(s1.name, "s1"); 36 assert_equal(s1.name, "s1");
37 assert_equal(s1.attr.xmlns, nil); 37 assert_equal(s1.attr.xmlns, nil);
38 assert_equal(#s1, 0); 38 assert_equal(#s1, 0);
39 assert_equal(#s1.tags, 0); 39 assert_equal(#s1.tags, 0);
40 40
41 s1:tag("child1"); 41 s1:tag("child1");
42 assert_equal(#s1.tags, 1); 42 assert_equal(#s1.tags, 1);
43 assert_equal(s1.tags[1].name, "child1"); 43 assert_equal(s1.tags[1].name, "child1");
44 44
45 s1:tag("grandchild1"):up(); 45 s1:tag("grandchild1"):up();
46 assert_equal(#s1.tags, 1); 46 assert_equal(#s1.tags, 1);
47 assert_equal(s1.tags[1].name, "child1"); 47 assert_equal(s1.tags[1].name, "child1");
48 assert_equal(#s1.tags[1], 1); 48 assert_equal(#s1.tags[1], 1);
49 assert_equal(s1.tags[1][1].name, "grandchild1"); 49 assert_equal(s1.tags[1][1].name, "grandchild1");
50 50
51 s1:up():tag("child2"); 51 s1:up():tag("child2");
52 assert_equal(#s1.tags, 2, tostring(s1)); 52 assert_equal(#s1.tags, 2, tostring(s1));
53 assert_equal(s1.tags[1].name, "child1"); 53 assert_equal(s1.tags[1].name, "child1");
54 assert_equal(s1.tags[2].name, "child2"); 54 assert_equal(s1.tags[2].name, "child2");
55 assert_equal(#s1.tags[1], 1); 55 assert_equal(#s1.tags[1], 1);