-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c31265
commit 4fdb466
Showing
9 changed files
with
517 additions
and
17 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 |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# Dart binding for opendal | ||
|
||
## Development | ||
|
||
``` | ||
flutter pub get | ||
flutter_rust_bridge_codegen generate | ||
cd rust | ||
cargo build -r | ||
cd .. | ||
dart run lib/opendal_test.dart | ||
``` |
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
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,53 @@ | ||
import 'package:test/test.dart'; | ||
import 'src/rust/frb_generated.dart'; | ||
import 'src/rust/api/opendal_api.dart'; | ||
|
||
void main() { | ||
group('opendal unit test', () { | ||
group('opendal fs schema', () { | ||
test('operator function in fs schema', () async { | ||
await RustLib.init(); | ||
final op = new Operator( | ||
schemeStr: "fs", | ||
map: {"root": "/tmp"}, | ||
); | ||
expect(op, isNotNull); | ||
|
||
await op.createDir(path: "test_dir/"); | ||
expect(await op.isExist(path: "test_dir/"), true); | ||
|
||
expect(await op.isExist(path: "test_1.txt"), false); | ||
expect(await op.isExist(path: "test.txt"), false); | ||
}); | ||
}); | ||
|
||
group('opendal memory schema', () { | ||
test('operator function in memory schema', () async { | ||
final op = new Operator( | ||
schemeStr: "memory", | ||
map: {"root": "/tmp"}, | ||
); | ||
expect(op, isNotNull); | ||
}); | ||
|
||
test('meta function in memory schema', () async { | ||
final op = new Operator( | ||
schemeStr: "memory", | ||
map: {"root": "/tmp"}, | ||
); | ||
expect(op, isNotNull); | ||
|
||
await op.createDir(path: "test/"); | ||
|
||
final meta = await op.stat(path: "test/"); | ||
expect(meta, isNotNull); | ||
|
||
final isFile = meta.isFile; | ||
expect(isFile, false); | ||
|
||
final isDir = meta.isDirectory; | ||
expect(isDir, true); | ||
}); | ||
}); | ||
}); | ||
} |
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
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
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
Oops, something went wrong.