Skip to content

Commit

Permalink
resolves #262 string as a lookup variable
Browse files Browse the repository at this point in the history
  • Loading branch information
zigzago committed Jan 30, 2021
1 parent bca01b9 commit 60ed58a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -484,5 +484,10 @@ fun KProperty<*>.variableDefinition(name: String = path()): Variable<String> = V
/**
* Defines a [Variable] projection (ie $$name)
*/
val KProperty<*>.variable: String get() = "\$\$${path()}"
val KProperty<*>.variable: String get() = path().variable

/**
* Defines a [Variable] projection (ie $$"myString"")
*/
val String.variable: String get() = "\$\$$this"

Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,10 @@ class AggregatesTest {
)
)
}

@Test
fun testVariable() {
assertEquals("\$\$s", AggregateData::s.variable)
assertEquals("\$\$s", "s".variable)
}
}

0 comments on commit 60ed58a

Please sign in to comment.