Added test for Ref initial value bug
This commit is contained in:
parent
8816c7feaa
commit
0fd629e405
1 changed files with 17 additions and 0 deletions
|
|
@ -23,6 +23,23 @@ class TransactionalRefSpec extends Spec with ShouldMatchers {
|
|||
value should be(3)
|
||||
}
|
||||
|
||||
it("should keep the initial value, even if the first transaction is rolled back") {
|
||||
val ref = Ref(3)
|
||||
|
||||
try {
|
||||
atomic {
|
||||
ref.swap(5)
|
||||
throw new Exception
|
||||
}
|
||||
} catch {
|
||||
case e => {}
|
||||
}
|
||||
|
||||
val value = atomic { ref.get.get }
|
||||
|
||||
value should be(3)
|
||||
}
|
||||
|
||||
it("should be settable using swap") {
|
||||
val ref = Ref[Int]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue