test/slots/duplicate.rad 445 B raw
1
//! Compile-failure fixture for repeated reservation consumption.
2
3
use std::testing;
4
use kernel::slots;
5
6
/// A reservation cannot be cancelled twice.
7
@test unsafe fn duplicate() throws (testing::TestError) {
8
    let mut table: [slots::Slot; 1] = undefined;
9
    slots::initialize(&mut table[..]);
10
    let token = try! slots::reserve(&mut table[..]);
11
    try! slots::cancel(&mut table[..], token);
12
    try! slots::cancel(&mut table[..], token);
13
}