Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Add a test for plugin library dependencies in the testall plugin #2

Merged
merged 1 commit into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion testall/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// GENERATED FILE USING THE CHAT OVERFLOW PLUGIN FRAMEWORK

name := "testall"
version := "1.0"
version := "1.0"

libraryDependencies += "org.apache.commons" % "commons-math3" % "3.6.1" // used by 'dependencytest'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.codeoverflow.plugins.testall

import org.codeoverflow.chatoverflow.api.plugin.{PluginImpl, PluginManager}
import org.codeoverflow.plugins.testall.tests.{discordtest, filetest, serialtest, tipeeestreamtest, twitchtest}
import org.codeoverflow.plugins.testall.tests._


class testallPlugin(manager: PluginManager) extends PluginImpl(manager) {
Expand All @@ -26,7 +26,8 @@ class testallPlugin(manager: PluginManager) extends PluginImpl(manager) {
),
new tipeeestreamtest(this,
require.input.tipeeeStream("tipeeestreamEvents", "TipeeeStream event input", true)
)
),
new dependencytest(this)
//Add more tests here!
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.codeoverflow.plugins.testall.tests

import org.apache.commons.math3.analysis.function.Sqrt
import org.codeoverflow.plugins.testall.{test, testallPlugin}

/**
* A quick test to ensure that plugins are able to have dependencies by using apache commons math3 to take the square root of a number.
* This dependency has been added in the build.sbt and should be downloaded using Coursier inside the framework.
*/
class dependencytest(val plugin: testallPlugin) extends test(plugin) {
override def name: String = "Dependency test"

override def setup(): Unit = {
try {
val num = 4
val numSquared = num * num
assert(num == new Sqrt().value(numSquared))
log("Dependencies are working as expected")
} catch {
case _: Throwable => log("Dependencies aren't working successfully")
}
}

override def loop(): Unit = ()

override def shutdown(): Unit = ()
}