Merge pull request #143 from typesafehub/wip/havocp-invalidate-tests

Add tests for cache invalidation with ref config and full config
This commit is contained in:
Havoc Pennington 2014-02-11 19:15:48 -05:00
commit d5924b6d01

View File

@ -937,6 +937,28 @@ class PublicApiTest extends TestUtils {
assertTrue("stuff gets cached repeatedly conf", conf3 eq conf4) assertTrue("stuff gets cached repeatedly conf", conf3 eq conf4)
} }
@Test
def invalidateReferenceConfig(): Unit = {
val orig = ConfigFactory.defaultReference()
val cached = ConfigFactory.defaultReference()
assertTrue("reference config was cached", orig eq cached)
ConfigFactory.invalidateCaches()
val changed = ConfigFactory.defaultReference()
assertTrue("reference config was invalidated", orig ne changed)
}
@Test
def invalidateFullConfig(): Unit = {
val orig = ConfigFactory.load()
val cached = ConfigFactory.load()
assertTrue("full config was cached", orig eq cached)
ConfigFactory.invalidateCaches()
val changed = ConfigFactory.load()
assertTrue("full config was invalidated", orig ne changed)
}
@Test @Test
def canUseSomeValuesWithoutResolving(): Unit = { def canUseSomeValuesWithoutResolving(): Unit = {
val conf = ConfigFactory.parseString("a=42,b=${NOPE}") val conf = ConfigFactory.parseString("a=42,b=${NOPE}")