import static org.junit.jupiter.api.Assertions.assertEquals;

import java.lang.module.ModuleDescriptor;
import java.util.Set;
import org.junit.jupiter.api.Test;

class ModulesParseTextBlockDeclarationTest {

  @Test
  void parseDeclaration() {
    var descriptor = Bach.Modules.parseDeclaration("""
        module foo.bar { // 3.3-ALPHA
          requires foo.bax; // @1.3
          requires foo.bay/*342*/;
          requires foo.baz; // 47.11
        }
        """);

    assertEquals("foo.bar", descriptor.name(), descriptor.toString());
    assertEquals(
        ModuleDescriptor.newModule("x")
            .requires("foo.bax")
            .requires(Set.of(), "foo.bay", ModuleDescriptor.Version.parse("342"))
            .requires("foo.baz")
            .build()
            .requires(),
        descriptor.requires(),
        descriptor.toString());
  }
}

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Version;
import java.util.Set;
import org.junit.jupiter.api.Test;

class ModulesParseTextBlockDeclarationTest {

  @Test
  void parseDeclaration() {
    var descriptor = Bach.Modules.parseDeclaration("""
        module foo.bar {
          requires foo.bax;
          requires foo.bay/*1*/;
          requires foo.baz /* 2.3-ea */;
        }
        """);

    assertEquals("foo.bar", descriptor.name(), descriptor.toString());
    assertEquals(
        ModuleDescriptor.newModule("x")
            .requires("foo.bax")
            .requires(Set.of(), "foo.bay", Version.parse("1"))
            .requires(Set.of(), "foo.baz", Version.parse("2.3-ea"))
            .build()
            .requires(),
        descriptor.requires(),
        descriptor.toString());
  }
}

Check for spaces being ignored in inline versions
Check for spaces being ignored in inline versions
