summaryrefslogtreecommitdiff
path: root/examples/scala-js/compiler/src/test/scala/scala/scalajs/compiler/test/JSExportASTTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'examples/scala-js/compiler/src/test/scala/scala/scalajs/compiler/test/JSExportASTTest.scala')
-rw-r--r--examples/scala-js/compiler/src/test/scala/scala/scalajs/compiler/test/JSExportASTTest.scala38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/scala-js/compiler/src/test/scala/scala/scalajs/compiler/test/JSExportASTTest.scala b/examples/scala-js/compiler/src/test/scala/scala/scalajs/compiler/test/JSExportASTTest.scala
new file mode 100644
index 0000000..4a2b1af
--- /dev/null
+++ b/examples/scala-js/compiler/src/test/scala/scala/scalajs/compiler/test/JSExportASTTest.scala
@@ -0,0 +1,38 @@
+package scala.scalajs.compiler.test
+
+import util._
+
+import org.junit.Test
+import org.junit.Assert._
+
+import scala.scalajs.ir.{Trees => js}
+
+class JSExportASTTest extends JSASTTest {
+
+ @Test
+ def inheritExportMethods: Unit = {
+
+ var props = 0
+
+ """
+ import scala.scalajs.js.annotation.JSExport
+
+ class A {
+ @JSExport
+ def foo = 1
+ }
+
+ class B extends A {
+ @JSExport
+ override def foo = 2
+ }
+ """.traverse {
+ case js.PropertyDef(js.StringLiteral("foo"), _, _, _) =>
+ props += 1
+ }
+
+ assertEquals("Only define the property `foo` once", props, 1)
+
+ }
+
+}