stevedlawrence commented on code in PR #12:
URL: https://github.com/apache/daffodil-sbt/pull/12#discussion_r1465173149


##########
src/sbt-test/sbt-daffodil/flat-layout-01/test/test.scala:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 com.example
+
+import org.junit.Test
+import org.apache.daffodil.tdml.Runner
+import org.junit.AfterClass
+
+object TestExample {
+  lazy val runner = Runner("/", "test.tdml")
+
+  @AfterClass def shutdown: Unit = { runner.reset }
+}
+
+class TestExample {
+  import TestExample._
+
+  @Test def test_test01() { runner.runOneTest("test01") }
+}

Review Comment:
   >  I think that feature would be very helpful :-).
   
   Agreed. I'll open a ticket for that.
   
   A code generator is a good option.
   
   Another possibility, which I think Mike discovered, was to do something like 
this:
   ```scala
   @Test def test_test01(): Unit = doTest(runner)
   ```
   And the `doTest` function looks at the stack to figure out the function that 
called it, strips off the "test_" prefix and calls `runner.runOneTest` passing 
in the name. It still requires managing scala file, but it's a bit less verbose.
   
   I wonder if now that IDE's have much better SBT support, if creating a SBT 
Test Interface for TDML would just magically give IDE's the capabilities we 
expect out of IDEs (e.g. list of tests, ability to right-click a location in a 
TDML file to run a test). Might be another option. 
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to