-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Gleam support Related to exercism/gleam#32 (comment) * Oops, whitespace
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
!e | ||
//\p | ||
///\p | ||
////\p | ||
import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
require "test_helper" | ||
|
||
module SnippetExtractor | ||
module Languages | ||
class GleamTest < Minitest::Test | ||
def test_full_example | ||
code = <<~CODE | ||
//// This is a file | ||
//// With some comments in it | ||
// And a blank line ⬆️ | ||
// It has some imports like this: | ||
import gleam/erlang | ||
import gleam/erlang/process.{Subject} | ||
/// And then eventually the code | ||
pub fn two_fer(name: String) -> String { | ||
todo | ||
} | ||
CODE | ||
|
||
expected = <<~CODE | ||
pub fn two_fer(name: String) -> String { | ||
todo | ||
} | ||
CODE | ||
|
||
assert_equal expected, ExtractSnippet.(code, :gleam) | ||
end | ||
|
||
def test_extended_example | ||
code = <<~CODE | ||
//// This is a file | ||
//// With some comments in it | ||
// And a blank line ⬆️ | ||
// It has some imports like this: | ||
import gleam/erlang | ||
import gleam/erlang/process.{Subject} | ||
/// And then eventually the code | ||
pub fn two_fer(name: String) -> String { | ||
todo// with comments | ||
} | ||
// Here is a comment | ||
/// And a documentation comment | ||
pub type TwoFer { | ||
TwoFer(name: String) | ||
} | ||
const a = 1 | ||
const b = 1 | ||
const c = 1 // More, but this is over 10 lines so it wont appear | ||
CODE | ||
|
||
expected = <<~CODE | ||
pub fn two_fer(name: String) -> String { | ||
todo | ||
} | ||
pub type TwoFer { | ||
TwoFer(name: String) | ||
} | ||
const a = 1 | ||
const b = 1 | ||
CODE | ||
|
||
assert_equal expected, ExtractSnippet.(code, :gleam) | ||
end | ||
end | ||
end | ||
end |