<commit_before>package org.scalatra

import org.scalatest.FunSuite
import org.scalatest.matchers.ShouldMatchers
import org.scalatra._

/**
 * Test cases adapted from  https://github.com/josh/rack-mount/blob/d44e02ec8a6318fdda8ea53a30aac654e228e07b/test/test_strexp.rb
 */
class RailsPathPatternParserTest extends FunSuite with ShouldMatchers {
  test("unanchored segment") {
    val PathPattern(re, names) = RailsPathPatternParser("/foo(/bar)")
    re.toString should equal ("""\A/foo(?:/bar)?\Z""")
    names should equal (Nil)
  }

  test("static string") {
    val PathPattern(re, names) = RailsPathPatternParser("foo")
    re.toString should equal ("""\Afoo\Z""")
    names should equal (Nil)
  }

  test("dynamic segment") {
    val PathPattern(re, names) = RailsPathPatternParser(":foo.example.com")
    re.toString should equal ("""\A([^#/.?]+)\.example\.com\Z""")<commit_msg>Remove duplicated test from RailsPathPatternParserTest<commit_after>package org.scalatra

import org.scalatest.FunSuite
import org.scalatest.matchers.ShouldMatchers

/**
 * Test cases adapted from  https://github.com/josh/rack-mount/blob/d44e02ec8a6318fdda8ea53a30aac654e228e07b/test/test_strexp.rb
 */
class RailsPathPatternParserTest extends FunSuite with ShouldMatchers {

  test("static string") {
    val PathPattern(re, names) = RailsPathPatternParser("foo")
    re.toString should equal ("""\Afoo\Z""")
    names should equal (Nil)
  }

  test("dynamic segment") {
    val PathPattern(re, names) = RailsPathPatternParser(":foo.example.com")
    re.toString should equal ("""\A([^#/.?]+)\.example\.com\Z""")
{'fraction_non_alphanumeric': 0.14536340852130325, 'fraction_numerical': 0.02756892230576441, 'mean_word_length': 4.724014336917563, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6888992', 'n_tokens_mistral': 566, 'n_tokens_neox': 526, 'n_words': 101}