aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-07-01 14:44:34 -0700
committerAllan Wang <me@allanwang.ca>2019-07-01 14:44:34 -0700
commit39bda3064e75a8a4be100afa4f5e7adee33c2f17 (patch)
tree61349f45b00f1697d6824aca5fcd2546735e0f23 /core/src
parent1f9198a1c05223edc7abb095f483d02cda5f1122 (diff)
downloadkau-39bda3064e75a8a4be100afa4f5e7adee33c2f17.tar.gz
kau-39bda3064e75a8a4be100afa4f5e7adee33c2f17.tar.bz2
kau-39bda3064e75a8a4be100afa4f5e7adee33c2f17.zip
Update changelog and add post setter test
Diffstat (limited to 'core/src')
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
index 735302c..143b83f 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
@@ -41,11 +41,15 @@ class KPrefTest {
initialize(ApplicationProvider.getApplicationContext<Context>(), "kpref_test_${System.currentTimeMillis()}")
}
+ var postSetterCount: Int = 0
+
var one by kpref("one", 1)
var two by kpref("two", 2f)
- var `true` by kpref("true", true)
+ var `true` by kpref("true", true, postSetter = {
+ postSetterCount++
+ })
var hello by kpref("hello", "hello")
@@ -113,4 +117,10 @@ class KPrefTest {
assertPrefEquals(true, { oneShot })
assertPrefEquals(false, { androidPref.oneShot })
}
+
+ @Test
+ fun postSetter() {
+ pref { `true` = true }
+ assertPrefEquals(1, { postSetterCount }, "Post setter was not called")
+ }
}