{"id":13800434,"url":"https://github.com/nadavwr/makeshift","last_synced_at":"2026-01-12T02:04:45.979Z","repository":{"id":136534767,"uuid":"89606038","full_name":"nadavwr/makeshift","owner":"nadavwr","description":"Makeshift unit testing library for Scala Native","archived":false,"fork":false,"pushed_at":"2018-03-10T23:32:18.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-06T21:07:45.984Z","etag":null,"topics":["mit-license","scala-native","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nadavwr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-04-27T14:23:11.000Z","updated_at":"2018-10-29T18:24:55.000Z","dependencies_parsed_at":"2024-01-05T21:48:13.762Z","dependency_job_id":null,"html_url":"https://github.com/nadavwr/makeshift","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadavwr%2Fmakeshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadavwr%2Fmakeshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadavwr%2Fmakeshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadavwr%2Fmakeshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nadavwr","download_url":"https://codeload.github.com/nadavwr/makeshift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913136,"owners_count":21983263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mit-license","scala-native","unit-testing"],"created_at":"2024-08-04T00:01:12.566Z","updated_at":"2026-01-12T02:04:45.963Z","avatar_url":"https://github.com/nadavwr.png","language":"Scala","funding_links":[],"categories":["Unit Tests"],"sub_categories":[],"readme":"A unit testing library I quickly hacked together for personal use, until one of the established libraries becomes available for Scala Native.\n\nTo use it:\n\n```scala\nresolvers += Resolver.bintrayRepo(\"nadavwr\", \"maven\")\nlibraryDependencies += \"com.github.nadavwr\" %%% \"makeshift\" % \"0.1.1\"\n```\n\n* Unit tests are aggregated under `Spec` instances.\n* Each unit test makes use of a `Fixture`\n* Using fixtures enables sharing code across test cases, as well as orderly resource initialization and cleanup.\n* The method `assertThat()` provides some rudimentary papertrail for what specific checks pass/fail. Make sure your terminal can render 👍 and ❗.\n* No effort is made by the library to aggregate specs into test suites. Having a `Spec` extend `App` has been a guilty pleasure for me so far.\n* SBT test framework integration isn't there yet, so just place your specs in a separate module and plain-old `run` them.\n\nGiven a heap-allocated buffer such as the following:\n\n```scala\nclass Buffer(val size: Int) {\n  import scalanative.native._\n  val ptr: Ptr[Byte] = stdlib.malloc(1024)\n  def dispose(): Unit = stdlib.free(ptr)\n\n  def put(bytes: Array[Byte]): Unit =\n    bytes.zipWithIndex.foreach { case (b, i) =\u003e !(ptr+i) = b }\n  def get(size: Int): Array[Byte] = {\n    val out = new Array[Byte](size)\n    for (i \u003c- 0 until size) {\n      out(i) = !(ptr+i)\n    }\n    out\n  }\n}\n```\n\nIt can be tested as seen below:\n\n```scala\nimport com.github.nadavwr.makeshift._\n\nobject MySpec extends Spec with App {\n\n  trait BufferFixture extends Fixture {\n    lazy val buffer = new Buffer(1024)\n      .withCleanup(\"buffer\") { _.dispose() }\n  }\n\n  test(\"manipulate heap memory\") runWith new BufferFixture {\n    val message = \"hello\"\n    val messageBytes = message.toArray.map(_.toByte)\n    buffer.put(messageBytes)\n    val output = buffer.get(messageBytes.length)\n    assertThat(output sameElements messageBytes,\n      s\"buffer should be assigned expected value '$message'\")\n  }\n}\n```\n\nproducing the following output:\n```\n_______________________\n▏manipulate heap memory\nbufer created\n👍 buffer should be assigned expected value 'hello'\n👍\ncleaning up bufer\n```\n\nSee more usage examples in [SampleSpec](sample/src/main/scala/com/github/nadavwr/makeshift/SampleSpec.scala)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadavwr%2Fmakeshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnadavwr%2Fmakeshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadavwr%2Fmakeshift/lists"}