-
Notifications
You must be signed in to change notification settings - Fork 98
feat(stdlib): extract function #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3a87b1b
feat(stdlib): yeah
Mte90 4415196
feat(review): new contains_all
Mte90 9292c2d
feat(review): new contains_all
Mte90 a39b756
feat(stdlib): extract improved
Mte90 1bd0421
feat(stdlib): extract improved
Mte90 2368aef
Update src/std/fs.ab
Mte90 c1c1c44
Update src/std/fs.ab
Mte90 0739645
fix(test): done
Mte90 cd3fc4b
feat(tests): imprroved
Mte90 1a4f581
feat(tests): imprroved
Mte90 80a7ad4
Update src/std/fs.ab
Mte90 add743c
Update src/std/fs.ab
Mte90 a2b4775
feat(regex): g match
Mte90 96282f4
feat(stdlib): match
Mte90 28cc7d1
feat(stdlib): match
Mte90 27e4059
feat(review): done
Mte90 0fa3d88
feat(review): done
Mte90 47f22b1
feat(review): done
Mte90 b7ceaf8
feat(review): done
Mte90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,19 @@ | ||
import { contains_all } from "std/text" | ||
Mte90 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Output | ||
Mte90 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// None: 0 | ||
// One: 0 | ||
// Right: 1 | ||
// Both: 1 | ||
|
||
fun test_multiple(label, text, terms) { | ||
let result = contains_all(text, terms) | ||
echo "{label}: {result}" | ||
} | ||
|
||
main { | ||
test_multiple("None", "Hello World", ["Other", "Other"]) | ||
test_multiple("One", "Hello World", ["World", "Something"]) | ||
test_multiple("Right", "Hello World", ["World", "Hello"]) | ||
test_multiple("Both", "Hello World", ["Hello", "World"]) | ||
} |
This file contains hidden or 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,21 @@ | ||
import { contains_any } from "std/text" | ||
Mte90 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Output | ||
// Empty: 0 | ||
// None: 0 | ||
// Left: 1 | ||
// Right: 1 | ||
// Both: 1 | ||
|
||
fun test_multiple(label, text, terms) { | ||
let result = contains_any(text, terms) | ||
echo "{label}: {result}" | ||
} | ||
|
||
main { | ||
test_multiple("Empty", "Hello World", [Text]) | ||
test_multiple("None", "Hello World", ["Other", "Other"]) | ||
test_multiple("Left", "Hello World", ["Hello", "Other"]) | ||
test_multiple("Right", "Hello World", ["Other", "World"]) | ||
test_multiple("Both", "Hello World", ["Hello", "World"]) | ||
} |
This file contains hidden or 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,21 @@ | ||
import * from "std/fs" | ||
import { includes } from "std/array" | ||
|
||
main { | ||
let tmpdir = trust $ mktemp -d /tmp/amber-XXXX $ | ||
cd tmpdir | ||
trust $ touch test.txt $ | ||
silent trust $tar -czf "filename.tar.gz" "{tmpdir}/test.txt"$ | ||
trust $ rm "test.txt" $ | ||
let package = tmpdir + "/" + "filename.tar.gz" | ||
|
||
extract(package, tmpdir) failed { | ||
echo "Error" | ||
} | ||
|
||
if dir_exist(tmpdir + "/" + tmpdir) { | ||
echo "Succeeded" | ||
} | ||
|
||
trust $ rm -rf "{tmpdir}" $ | ||
} |
This file contains hidden or 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,21 @@ | ||
import { match_any_regex } from "std/text" | ||
|
||
// Output | ||
// Empty: 0 | ||
// None: 0 | ||
// Right: 1 | ||
// Left: 1 | ||
// Both: 1 | ||
|
||
fun test_multiple(label, text, terms) { | ||
let result = match_any_regex(text, terms) | ||
echo "{label}: {result}" | ||
} | ||
|
||
main { | ||
test_multiple("Empty", "Hello World", [Text]) | ||
test_multiple("None", "Hello World", ["Other", "Other$"]) | ||
test_multiple("Right", "Hello World", ["Other", "World$"]) | ||
test_multiple("Left", "Hello World", ["^Hello", "Other"]) | ||
test_multiple("Both", "Hello World", ["^Hello", "$World"]) | ||
} |
This file contains hidden or 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,7 @@ | ||
import { match_regex } from "std/text" | ||
|
||
main { | ||
if match_regex("Hello World", "World$") { | ||
echo "Succeeded" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.