Skip to content

Commit

Permalink
Merge pull request #1 from warrenrhodes/warrenrhodes-patch-1
Browse files Browse the repository at this point in the history
Create dart.yml
  • Loading branch information
warrenrhodes authored May 21, 2024
2 parents 625103d + 28cbce4 commit 9c90789
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 11 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Dart Build

on:
push:
branches:
- "master"
pull_request:

env:
DART_SDK_VERSION: 3.4.0

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ env.DART_SDK_VERSION }}

- name: Install dependencies
run: dart pub get

- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .

- name: Analyze project source
run: dart analyze

- name: Run tests
run: dart test
5 changes: 1 addition & 4 deletions example/dart_utils_example.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@


void main() {
}
void main() {}
23 changes: 16 additions & 7 deletions test/list_extension_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ void main() {
expect(repeatedList, [[], [], []]);
expect(repeatedList2, [54, 54, 54]);
});

test('Concatenates tow list', () {
List<int> list_1 = [1,2];
List<int> list_2 = [3,4];
List<int> list_1 = [1, 2];
List<int> list_2 = [3, 4];

expect(list_1 + list_2, [1,2,3,4]);
expect(list_1 + list_2, [1, 2, 3, 4]);
});

test('Count the number of element', () {
Expand All @@ -30,10 +30,19 @@ void main() {
"age": 30,
"address": {"street": "123 Main St", "city": "Anytown"},
};
List<dynamic> listOfList = [[1,2], [1,2], [1,4], [9,4], 2];
List<dynamic> listOfList = [
[1, 2],
[1, 2],
[1, 4],
[9, 4],
2
];
List<dynamic> listOfInt = [1, 3, 2, 5, 6, 2, 2];
List<dynamic> listOfMap = [map2, {"key": "value"},];
expect(listOfList.count([1,2]), 2);
List<dynamic> listOfMap = [
map2,
{"key": "value"},
];
expect(listOfList.count([1, 2]), 2);
expect(listOfMap.count(mapToTest), 1);
expect(listOfInt.count(2), 3);
});
Expand Down

0 comments on commit 9c90789

Please sign in to comment.