-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…cess (#3423) Starting with tests - I hope I will be able to implement the fix as well. --------- Co-authored-by: Taro L. Saito <[email protected]>
- Loading branch information
1 parent
a188e7b
commit d68b2bd
Showing
3 changed files
with
89 additions
and
1 deletion.
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
38 changes: 38 additions & 0 deletions
38
airframe-surface/src/test/scala/wvlet/airframe/surface/i3416.scala
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,38 @@ | ||
/* | ||
* 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 wvlet.airframe.surface | ||
|
||
import wvlet.airspec.AirSpec | ||
|
||
object i3416 extends AirSpec { | ||
|
||
object O { | ||
class C(private[O] val id: Int) { | ||
private[O] def getId: Int = id | ||
} | ||
} | ||
|
||
test("List package private fields as parameters") { | ||
val s = Surface.of[O.C] | ||
debug(s.params) | ||
s.params.size shouldBe 1 | ||
val p1 = s.params(0) | ||
p1.name shouldBe "id" | ||
} | ||
|
||
test("Do not list package private methods") { | ||
val s = Surface.methodsOf[O.C] | ||
s.size shouldBe 0 | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
airframe-surface/src/test/scala/wvlet/airframe/surface/i3419.scala
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,45 @@ | ||
/* | ||
* 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 wvlet.airframe.surface | ||
|
||
import wvlet.airspec.AirSpec | ||
|
||
object i3419 extends AirSpec { | ||
|
||
class QPrivate private (val id: Int) | ||
|
||
class QProtected protected (val id: Int) | ||
|
||
object O { | ||
class QPackagePrivate private[O] (val id: Int) | ||
} | ||
|
||
test("Handle private constructor") { | ||
val s = Surface.of[QPrivate] | ||
debug(s.params) | ||
s.params.size shouldBe 0 | ||
} | ||
|
||
test("Handle protected constructor") { | ||
val s = Surface.of[QProtected] | ||
debug(s.params) | ||
s.params.size shouldBe 0 | ||
} | ||
|
||
test("Handle package private constructor") { | ||
val s = Surface.of[O.QPackagePrivate] | ||
debug(s.params) | ||
s.params.size shouldBe 0 | ||
} | ||
} |