"Fossies" - the Fresh Open Source Software Archive

Member "scala-js-1.3.1/test-suite/shared/src/test/scala/org/scalajs/testsuite/javalib/util/ArrayListTest.scala" (14 Nov 2020, 954 Bytes) of package /linux/www/scala-js-1.3.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Scala source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * Scala.js (https://www.scala-js.org/)
    3  *
    4  * Copyright EPFL.
    5  *
    6  * Licensed under Apache License 2.0
    7  * (https://www.apache.org/licenses/LICENSE-2.0).
    8  *
    9  * See the NOTICE file distributed with this work for
   10  * additional information regarding copyright ownership.
   11  */
   12 
   13 package org.scalajs.testsuite.javalib.util
   14 
   15 import org.junit.Test
   16 
   17 import java.{util => ju}
   18 
   19 import scala.reflect.ClassTag
   20 
   21 class ArrayListTest extends AbstractListTest {
   22 
   23   override def factory: AbstractListFactory = new ArrayListFactory
   24 
   25   @Test def `should_not_fail_with_pre-allocation_methods`(): Unit = {
   26     // note that these methods become no ops in js
   27     val al = new ju.ArrayList[String]
   28     al.ensureCapacity(0)
   29     al.ensureCapacity(34)
   30     al.trimToSize()
   31   }
   32 }
   33 
   34 class ArrayListFactory extends AbstractListFactory {
   35   override def implementationName: String =
   36     "java.util.ArrayList"
   37 
   38   override def empty[E: ClassTag]: ju.ArrayList[E] =
   39     new ju.ArrayList[E]
   40 }