Skip to content

Commit

Permalink
annotate test-only methods
Browse files Browse the repository at this point in the history
Closes #3.
  • Loading branch information
mockturtl committed Jul 12, 2018
1 parent 824821a commit 59beced
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/dotenv.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
library dotenv;

import 'dart:io';

import 'package:meta/meta.dart';
part 'src/parser.dart';

var _env = new Map<String, String>.from(Platform.environment);
Expand Down
12 changes: 6 additions & 6 deletions lib/src/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Parser {
}

/// Parses a single line into a key-value pair.
@Deprecated('Exposed for testing') // FIXME
@visibleForTesting
Map<String, String> parseOne(String line,
{Map<String, String> env: const {}}) {
var stripped = strip(line);
Expand All @@ -49,7 +49,7 @@ class Parser {
}

/// Substitutes $bash_vars in [val] with values from [env].
@Deprecated('Exposed for testing') // FIXME
@visibleForTesting
String interpolate(String val, Map<String, String> env) =>
val.replaceAllMapped(_bashVar, (m) {
var k = m.group(2);
Expand All @@ -59,23 +59,23 @@ class Parser {

/// If [val] is wrapped in single or double quotes, returns the quote character.
/// Otherwise, returns the empty string.
@Deprecated('Exposed for testing') // FIXME
@visibleForTesting
String surroundingQuote(String val) {
if (!_surroundQuotes.hasMatch(val)) return '';
return _surroundQuotes.firstMatch(val).group(1);
}

/// Removes quotes (single or double) surrounding a value.
@Deprecated('Exposed for testing') // FIXME
@visibleForTesting
String unquote(String val) =>
val.replaceFirstMapped(_surroundQuotes, (m) => m[2]).trim();

/// Strips comments (trailing or whole-line).
@Deprecated('Exposed for testing') // FIXME
@visibleForTesting
String strip(String line) => line.replaceAll(_comment, '').trim();

/// Omits 'export' keyword.
@Deprecated('Exposed for testing') // FIXME
@visibleForTesting
String swallow(String line) => line.replaceAll(_keyword, '').trim();

bool _isValid(String s) => s.isNotEmpty && s.contains('=');
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ dependencies:
dev_dependencies:
test: any
collection: any
meta: any

0 comments on commit 59beced

Please sign in to comment.