Another test and minor cleanup

This commit is contained in:
Steven Fackler
2013-12-01 21:41:42 -08:00
parent 9a4b51e157
commit 4ab1cd3dbf
2 changed files with 14 additions and 2 deletions

View File

@@ -257,7 +257,7 @@ types. The driver currently supports the following conversions:
<td>TSRANGE, TSTZRANGE</td>
</tr>
<tr>
<td>types::array::ArrayBase&lt;i32&gt;</td>
<td>types::array::ArrayBase&lt;Option&lt;i32&gt;&gt;</td>
<td>INT4[], INT4[][], ...</td>
</tr>
</tbody>

View File

@@ -74,7 +74,7 @@ impl<T> ArrayBase<T> {
assert!(self.info.len() - 1 == other.info.len(),
"Cannot append differently shaped arrays");
for (info1, info2) in self.info.iter().skip(1).zip(other.info.iter()) {
assert!(info1 == info2, "Cannot append differently shaped arrays");
assert!(info1 == info2, "Cannot join differently shaped arrays");
}
self.info[0].len += 1;
self.data.push_all_move(other.data);
@@ -279,4 +279,16 @@ mod tests {
assert_eq!(&6, s2.get(0));
assert_eq!(&7, s2.get(1));
}
#[test]
fn test_mut() {
let mut a = ArrayBase::from_vec(~[1, 2], 0);
a.wrap(0);
{
let mut s = a.slice_mut(0);
*s.get_mut(0) = 3;
}
let s = a.slice(0);
assert_eq!(&3, s.get(0));
}
}