Skip to content

Commit

Permalink
missing formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PgBiel committed Apr 26, 2024
1 parent b008b1c commit 2310125
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 45 deletions.
1 change: 1 addition & 0 deletions test/gleam/float_test.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gleam/float

// import gleam/int
// import gleam/iterator
// import gleam/list
Expand Down
27 changes: 24 additions & 3 deletions test/gleam/regex_test.gleam
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
import gleam/option.{None, Some}

// import gleam/regex.{Match, Options}
import gleam/regex.{Match}
import gleam/should

@target(erlang)
const word = "\\w"

@target(erlang)
const space = "\\s"

@target(erlang)
const digit = "\\d"

@target(javascript)
const word = "\\w"

@target(javascript)
const space = "\\s"

@target(javascript)
const digit = "\\d"

@target(nix)
const word = "[[:alnum:]_]"

@target(nix)
const space = "[[:space:]]"

@target(nix)
const digit = "[0-9]"

Expand Down Expand Up @@ -159,7 +166,8 @@ pub fn scan_test() {
regex.scan(re, "你好 42 世界")
|> should.equal([Match(content: "42", submatches: [Some("42")])])

let assert Ok(re) = regex.from_string("([+|\\-])?(" <> digit <> "+)(" <> word <> "+)?")
let assert Ok(re) =
regex.from_string("([+|\\-])?(" <> digit <> "+)(" <> word <> "+)?")
regex.scan(re, "+36kg")
|> should.equal([
Match(content: "+36kg", submatches: [Some("+"), Some("36"), Some("kg")]),
Expand All @@ -180,7 +188,19 @@ pub fn scan_test() {
|> should.equal([])

let assert Ok(re) =
regex.from_string("var" <> space <> "*(" <> word <> "+)" <> space <> "*(int|string)?" <> space <> "*=" <> space <> "*(.*)")
regex.from_string(
"var"
<> space
<> "*("
<> word
<> "+)"
<> space
<> "*(int|string)?"
<> space
<> "*="
<> space
<> "*(.*)",
)
regex.scan(re, "var age int = 32")
|> should.equal([
Match(content: "var age int = 32", submatches: [
Expand All @@ -195,7 +215,8 @@ pub fn scan_test() {
Match(content: "var age = 32", submatches: [Some("age"), None, Some("32")]),
])

let assert Ok(re) = regex.from_string("let (" <> word <> "+) = (" <> word <> "+)")
let assert Ok(re) =
regex.from_string("let (" <> word <> "+) = (" <> word <> "+)")
regex.scan(re, "let age = 32")
|> should.equal([
Match(content: "let age = 32", submatches: [Some("age"), Some("32")]),
Expand Down
1 change: 0 additions & 1 deletion test/gleam/string_builder_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub fn reverse_test() {
|> string_builder.reverse
|> string_builder.to_string
|> should.equal("👶🏿")

// "👶🏿"
// |> string_builder.from_string
// |> string_builder.reverse
Expand Down
81 changes: 40 additions & 41 deletions test/gleam/string_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import gleam/should
import gleam/string

pub fn length_test() {
// Graphemes not yet supported
// string.length("ß↑e̊")
// |> should.equal(3)
// Graphemes not yet supported
// string.length("ß↑e̊")
// |> should.equal(3)

string.length("Gleam")
|> should.equal(5)
Expand Down Expand Up @@ -47,10 +47,10 @@ pub fn reverse_test() {
|> string.reverse
|> should.equal("ÖÄÅ")

// Graphemes not yet supported
// "👶🏿"
// |> string.reverse
// |> should.equal("👶🏿")
// Graphemes not yet supported
// "👶🏿"
// |> string.reverse
// |> should.equal("👶🏿")

"👶🏿"
|> string.reverse
Expand Down Expand Up @@ -376,37 +376,36 @@ pub fn to_graphemes_test() {
|> string.to_graphemes
|> should.equal(["a", "b", "c"])

// "🌷🎁💩😜👍🏳️‍🌈"
// |> string.to_graphemes
// |> should.equal(["🌷", "🎁", "💩", "😜", "👍", "🏳️‍🌈"])
// "🌷🎁💩😜👍🏳️‍🌈"
// |> string.to_graphemes
// |> should.equal(["🌷", "🎁", "💩", "😜", "👍", "🏳️‍🌈"])

// "Ĺo͂řȩm̅"
// |> string.to_graphemes
// |> should.equal(["Ĺ", "o͂", "ř", "ȩ", "m̅"])
// "Ĺo͂řȩm̅"
// |> string.to_graphemes
// |> should.equal(["Ĺ", "o͂", "ř", "ȩ", "m̅"])

"뎌쉐"
|> string.to_graphemes
|> should.equal(["뎌", "쉐"])

// "👨‍👩‍👦‍👦"
// |> string.to_graphemes()
// |> should.equal(["👨‍👩‍👦‍👦"])

// "ごん゙に゙ぢば"
// |> string.to_graphemes()
// |> should.equal(["ご", "ん゙", "に゙", "ぢ", "ば"])

// "パピプペポ"
// |> string.to_graphemes()
// |> should.equal(["パ", "ピ", "プ", "ペ", "ポ"])

// "Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞"
// |> string.to_graphemes
// |> should.equal([
// "Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍", "A̴̵̜̰͔ͫ͗͢", "L̠ͨͧͩ͘",
// "G̴̻͈͍͔̹̑͗̎̅͛́", "Ǫ̵̹̻̝̳͂̌̌͘",
// "!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞",
// ])
// "👨‍👩‍👦‍👦"
// |> string.to_graphemes()
// |> should.equal(["👨‍👩‍👦‍👦"])

// "ごん゙に゙ぢば"
// |> string.to_graphemes()
// |> should.equal(["ご", "ん゙", "に゙", "ぢ", "ば"])

// "パピプペポ"
// |> string.to_graphemes()
// |> should.equal(["パ", "ピ", "プ", "ペ", "ポ"])

// "Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞"
// |> string.to_graphemes
// |> should.equal([
// "Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍", "A̴̵̜̰͔ͫ͗͢", "L̠ͨͧͩ͘",
// "G̴̻͈͍͔̹̑͗̎̅͛́", "Ǫ̵̹̻̝̳͂̌̌͘",
// "!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞",
// ])
}

pub fn to_utf_codepoints_test() {
Expand Down Expand Up @@ -520,10 +519,10 @@ pub fn first_test() {
|> string.first
|> should.equal(Ok("g"))

// No grapheme popping yet on Nix
// "⭐️ Gleam"
// |> string.first
// |> should.equal(Ok("⭐️"))
// No grapheme popping yet on Nix
// "⭐️ Gleam"
// |> string.first
// |> should.equal(Ok("⭐️"))

"a"
|> string.first
Expand All @@ -543,10 +542,10 @@ pub fn last_test() {
|> string.last
|> should.equal(Ok(" "))

// Graphemes not yet supported
// "եոգլի"
// |> string.last
// |> should.equal(Ok("ի"))
// Graphemes not yet supported
// "եոգլի"
// |> string.last
// |> should.equal(Ok("ի"))

"a"
|> string.last
Expand Down
1 change: 1 addition & 0 deletions test/gleam/uri_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import gleam/option.{None, Some}
import gleam/should

// import gleam/string
import gleam/uri

Expand Down

0 comments on commit 2310125

Please sign in to comment.