-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add paragrah data source to lorem resource
- Loading branch information
Showing
12 changed files
with
112 additions
and
20 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
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
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
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,21 @@ | ||
import 'package:faker_x/src/base/base.dart'; | ||
|
||
class ParagraphArgs { | ||
final int maxSentences; | ||
|
||
ParagraphArgs({ | ||
@nonNullable required this.maxSentences, | ||
}); | ||
} | ||
|
||
final paragraph = StringDataSource<ParagraphArgs>.withBuilder( | ||
dataKey: DataKeys.paragraph, | ||
locale: Locales.en_us, | ||
builder: (ParagraphArgs args, FakerXLocale locale) { | ||
final sentenceCount = randomInt(args.maxSentences); | ||
return List.generate( | ||
sentenceCount, | ||
(_) => provide(DataKeys.sentence, locale), | ||
).join('. '); | ||
}, | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// ignore_for_file: unused_import | ||
|
||
import 'package:faker_x/faker_x.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
import '../../utils.dart'; | ||
|
||
void main() { | ||
test("en_us -> lorem -> paragraph test", () async { | ||
// TODO: please write test manually to test FakerX.localized.en_us.lorem.paragraph(args) | ||
}); | ||
} |
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,12 @@ | ||
// ignore_for_file: unused_import | ||
|
||
import 'package:faker_x/faker_x.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
import '../../utils.dart'; | ||
|
||
void main() { | ||
test("fa_ir -> lorem -> paragraph test", () async { | ||
// TODO: please write test manually to test FakerX.localized.fa_ir.lorem.paragraph(args) | ||
}); | ||
} |