From 39bda3064e75a8a4be100afa4f5e7adee33c2f17 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 1 Jul 2019 14:44:34 -0700 Subject: Update changelog and add post setter test --- .../androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'core') 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(), "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") + } } -- cgit v1.2.3