Skip to content

Commit

Permalink
Test for Enumeration support (wvlet#3411)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSpanel committed Feb 28, 2024
1 parent 08d3fb1 commit 8dd0dda
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions airframe-surface/src/test/scala/wvlet/airframe/surface/i3411.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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 i3411 extends AirSpec {

object SomeEnum extends Enumeration {
type SomeEnum = Value

val A, B, C = Value
}

import SomeEnum.SomeEnum

test("Handle a Scala 2 enumeration") {
val s = Surface.of[SomeEnum] // just check there is no error - no expected properties
val m = Surface.methodsOf[SomeEnum]
debug(s.params)
// enumeration type (value) usually contains at least the compare method
m.map(_.name) shouldContain "compare"
}
}

0 comments on commit 8dd0dda

Please sign in to comment.