| | 119 | ### Test append operator |
| | 120 | def test_11_append |
| | 121 | printTestHeader "Locus: Append operator (<<)" |
| | 122 | otherLocus = FaerieMUD::Locus::new |
| | 123 | rval = nil |
| | 124 | |
| | 125 | # Check |
| | 126 | assert_nothing_raised { |
| | 127 | rval = @testLocus.contains?( otherLocus ) |
| | 128 | } |
| | 129 | assert !rval, "contains? was unexpectedly true before adding." |
| | 130 | assert_nothing_raised { |
| | 131 | rval = otherLocus.containedBy?( @testLocus ) |
| | 132 | } |
| | 133 | assert !rval, "containedBy? was unexpectedly true before adding." |
| | 134 | |
| | 135 | # Add |
| | 136 | assert_nothing_raised { |
| | 137 | rval = @testLocus << otherLocus |
| | 138 | } |
| | 139 | assert_equal @testLocus, rval |
| | 140 | |
| | 141 | # Check |
| | 142 | assert_nothing_raised { |
| | 143 | rval = @testLocus.contains?( otherLocus ) |
| | 144 | } |
| | 145 | assert rval, "contains? was unexpectedly false after adding." |
| | 146 | assert_nothing_raised { |
| | 147 | rval = otherLocus.containedBy?( @testLocus ) |
| | 148 | } |
| | 149 | assert rval, "containedBy? was unexpectedly false after adding." |
| | 150 | |
| | 151 | # Append again (shouldn't do anything) |
| | 152 | assert_nothing_raised { |
| | 153 | rval = @testLocus << otherLocus |
| | 154 | } |
| | 155 | assert_equal @testLocus, rval |
| | 156 | |
| | 157 | end |
| | 158 | |
| | 159 | |