Skip to content

Commit

Permalink
add test to make use of the recent adjustments
Browse files Browse the repository at this point in the history
This commit adds a test that would fail without the changes in this
pull request, such as JvmSuppressWildcard, `Null` class name, and
kotlin/java generic name difference
  • Loading branch information
davissuber committed Mar 28, 2024
1 parent 34c49be commit 41d5467
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/ChildScope.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2023 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package testcases.KT008_funky_names

@motif.Scope
interface ChildScope {

@motif.Objects
abstract class Objects {

abstract fun myNull(): Null
}
}
102 changes: 102 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/GRAPH.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
########################################################################
# #
# This file is auto-generated by running the Motif compiler tests and #
# serves a as validation of graph correctness. IntelliJ plugin tests #
# also rely on this file to ensure that the plugin graph understanding #
# is equivalent to the compiler's. #
# #
# - Do not edit manually. #
# - Commit changes to source control. #
# - Since this file is autogenerated, code review changes carefully to #
# ensure correctness. #
# #
########################################################################

-------
| Scope |
-------

==== Required ====

==== Provides ====

---- boolean | Objects.myBoolean ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myBoolean()

---- byte | Objects.myByte ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myByte()

---- char | Objects.myChar ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myChar()

---- double | Objects.myDouble ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myDouble()

---- float | Objects.myFloat ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myFloat()

---- int | Objects.myInt ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myInt()

---- Object | Objects.myAny ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myAny()

---- Function2<Long,Double,Short> | Objects.function2 ----
[ Required ]
[ Consumed By ]
* ChildScope | Objects.myNull(function2)

---- long | Objects.myLong ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myLong()

---- short | Objects.myShort ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myShort()

---- Scope | implicit ----
[ Required ]
[ Consumed By ]

------------
| ChildScope |
------------

==== Required ====

---- Function2<Long,Double,Short> ----
[ Provided By ]
* Scope | Objects.function2
[ Consumed By ]
* ChildScope | Objects.myNull(function2)

==== Provides ====

---- ChildScope | implicit ----
[ Required ]
[ Consumed By ]

---- Null | Objects.myNull ----
[ Required ]
Function2<Long,Double,Short>
[ Provided By ]
* Scope | Objects.function2
[ Consumed By ]


18 changes: 18 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/Null.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2023 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package testcases.KT008_funky_names

class Null(function2: @JvmSuppressWildcards ((Long, Double) -> Short))
68 changes: 68 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/Scope.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (c) 2023 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package testcases.KT008_funky_names

import motif.Expose


@motif.Scope
interface Scope {

fun child(): ChildScope

fun myByte(): Byte

fun myShort(): Short

fun myInt(): Int

fun myLong(): Long

fun myFloat(): Float

fun myDouble(): Double

fun myBoolean(): Boolean

fun myChar(): Char

fun myAny(): Any

@motif.Objects
open class Objects {

@Expose
fun function2(): ((Long, Double) -> Short) = { _, d -> d.toInt().toShort() }

fun myByte(): Byte = 3

fun myShort(): Short = 3

fun myInt(): Int = 3

fun myLong(): Long = 3

fun myFloat(): Float = 0.2f

fun myDouble(): Double = 0.2

fun myBoolean(): Boolean = true

fun myChar(): Char = 'c'

fun myAny(): Any = Any()
}
}
26 changes: 26 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2023 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package testcases.KT008_funky_names;

import static com.google.common.truth.Truth.assertThat;

public class Test {

public static void run() {
Scope scope = new ScopeImpl();
assertThat(scope.child()).isNotNull();
}
}

0 comments on commit 41d5467

Please sign in to comment.