Skip to content
Snippets Groups Projects
Commit b2f6eba8 authored by Abhay Menon's avatar Abhay Menon
Browse files

Merge branch 'main' into '33-set-up-launch-from-command-line'

parents a8997420 b7088850
No related branches found
No related tags found
1 merge request!2Resolve "Set up launch from command line"
Pipeline #83871 passed
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/utilities/notes-multi.utilities.test.iml" filepath="$PROJECT_DIR$/.idea/modules/utilities/notes-multi.utilities.test.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../../../utilities/src/test">
<sourceFolder url="file://$MODULE_DIR$/../../../utilities/src/test/kotlin" isTestSource="true" />
</content>
</component>
</module>
\ No newline at end of file
...@@ -9,9 +9,14 @@ plugins { ...@@ -9,9 +9,14 @@ plugins {
dependencies { dependencies {
implementation 'org.apache.commons:commons-text' implementation 'org.apache.commons:commons-text'
implementation project(':utilities') implementation project(':utilities')
testImplementation 'org.jetbrains.kotlin:kotlin-test'
} }
application { application {
// Define the main class for the application. // Define the main class for the application.
mainClass = 'notes.multi.app.AppKt' mainClass = 'notes.multi.app.AppKt'
} }
test {
useJUnitPlatform()
}
...@@ -9,9 +9,14 @@ plugins { ...@@ -9,9 +9,14 @@ plugins {
dependencies { dependencies {
implementation 'org.apache.commons:commons-text' implementation 'org.apache.commons:commons-text'
implementation project(':utilities') implementation project(':utilities')
testImplementation 'org.jetbrains.kotlin:kotlin-test'
} }
application { application {
// Define the main class for the application. // Define the main class for the application.
mainClass = 'notes.multi.console.ConsoleKt' mainClass = 'notes.multi.console.ConsoleKt'
} }
test {
useJUnitPlatform()
}
...@@ -8,4 +8,9 @@ plugins { ...@@ -8,4 +8,9 @@ plugins {
dependencies { dependencies {
api project(':list') api project(':list')
testImplementation 'org.jetbrains.kotlin:kotlin-test'
}
test {
useJUnitPlatform()
} }
...@@ -24,7 +24,9 @@ class Filemanager(private val dir: String, private val name: String) { ...@@ -24,7 +24,9 @@ class Filemanager(private val dir: String, private val name: String) {
// create and write to that file // create and write to that file
fun writefile(line:String) { fun writefile(line:String) {
filepath.writeText(line) filepath.writeText(line)
listfiles.add(filepath) if (!listfiles.contains(filepath)) {
listfiles.add(filepath)
}
} }
// opens and read the existing file // opens and read the existing file
...@@ -39,6 +41,9 @@ class Filemanager(private val dir: String, private val name: String) { ...@@ -39,6 +41,9 @@ class Filemanager(private val dir: String, private val name: String) {
fun deletefile():Boolean { fun deletefile():Boolean {
listfiles.remove(filepath) listfiles.remove(filepath)
for (i in listfiles) {
println("Not Deleted!")
}
return filepath.delete() return filepath.delete()
} }
......
import notes.multi.utilities.Filemanager
import kotlin.test.Test
import kotlin.test.assertEquals
internal class FilemanagerTest {
private val testmanager: Filemanager = Filemanager("${System.getProperty("user.dir")}/testfolder/", "hello.txt")
@Test
fun createreadfile() {
val expected = "hello from the moon"
testmanager.writefile(expected)
assertEquals(expected, testmanager.openfile())
}
@Test
fun ReadNoneExistingFile() {
val expected = ""
testmanager.writefile("walking to the mooon")
testmanager.deletefile()
assertEquals(expected, testmanager.openfile())
}
}
\ No newline at end of file
blahblah
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment