-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for preferring Kotlin types
- Loading branch information
Showing
6 changed files
with
285 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
sqldelight-compiler/src/test/query-interface-fixtures/prefer-kotlin-type/com/sample/Data.sq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import java.util.List; | ||
import kotlin.Boolean; | ||
import com.sample.Person; | ||
import com.squareup.Redacted; | ||
|
||
CREATE TABLE people ( | ||
_id INTEGER NOT NULL PRIMARY KEY, | ||
person1 BLOB AS Person NOT NULL, | ||
person2 BLOB AS Person | ||
); | ||
|
||
preferKotlinType: | ||
SELECT MAX(person1, person2) AS max_person, | ||
MIN(person1, person2) AS min_person, | ||
COALESCE(person2, person1) AS coalesce_person, | ||
IFNULL(person2, person1) AS if_null_person | ||
FROM people; |
10 changes: 10 additions & 0 deletions
10
...rc/test/query-interface-fixtures/prefer-kotlin-type/output/com/sample/PreferKotlinType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.sample | ||
|
||
import com.sample.person | ||
|
||
public data class PreferKotlinType( | ||
public val max_person: Person?, | ||
public val min_person: Person?, | ||
public val coalesce_person: Person, | ||
public val if_null_person: Person, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...rc/test/view-interface-fixtures/requires-adapter/output/com/sample/PersonandMaxFriends.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.sample | ||
|
||
import com.squareup.Redacted | ||
import java.util.List | ||
import kotlin.Boolean | ||
import kotlin.Long | ||
import kotlin.String | ||
|
||
public data class PersonAndMaxFriends( | ||
public val _id: Long, | ||
public val name: String, | ||
public val last_name: String?, | ||
public val is_cool: Boolean, | ||
public val friends: List<Person>?, | ||
@Redacted | ||
public val shhh_its_secret: String, | ||
public val how_cool: String, | ||
public val max_friends: List<Person>?, | ||
) |