Skip to content

Commit 06aa3eb

Browse files
committed
Add a VcrBeta opt-in annotation.
1 parent acb831a commit 06aa3eb

File tree

1 file changed

+16
-1
lines changed
  • jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie

1 file changed

+16
-1
lines changed

jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/Selfie.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,20 @@ object Selfie {
8888
@JvmStatic
8989
fun <T> cacheSelfieBinary(roundtrip: Roundtrip<T, ByteArray>, toCache: Cacheable<T>) =
9090
CacheSelfieBinary<T>(deferredDiskStorage, roundtrip, toCache)
91-
@JvmStatic fun vcrTestLocator(sub: String = "") = VcrSelfie.TestLocator(sub, deferredDiskStorage)
91+
92+
/**
93+
* Whichever file calls this method is where Selfie will look for `//selfieonce` comments to
94+
* control whether the VCR is writing or reading. If the caller lives in a package called
95+
* `selfie.*` it will keep looking up the stack trace until a caller is not inside `selfie.*`.
96+
*/
97+
@JvmStatic
98+
@VcrBeta
99+
fun vcrTestLocator(sub: String = "") = VcrSelfie.TestLocator(sub, deferredDiskStorage)
92100
}
101+
102+
@RequiresOptIn(
103+
level = RequiresOptIn.Level.WARNING,
104+
message = "This API is in beta and may change in the future.")
105+
@Retention(AnnotationRetention.BINARY)
106+
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
107+
annotation class VcrBeta

0 commit comments

Comments
 (0)