Skip to content
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

use dart:convert to replace dart:json #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/logging_handlers_shared.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
library logging_handlers_shared;

import 'dart:json';

import 'package:logging/logging.dart';
import 'package:intl/intl.dart';

Expand Down
2 changes: 1 addition & 1 deletion test/shared/shared_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ library shared_test;
import 'package:logging_handlers/logging_handlers_shared.dart';
import 'package:unittest/unittest.dart';
import 'package:logging/logging.dart';
import 'dart:json';
import 'dart:convert';

part 'src/transformer_tests.dart';

Expand Down
16 changes: 8 additions & 8 deletions test/shared/src/transformer_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ runMapTransformerTests() {
var logRecord = new LogRecord(Level.INFO, message, loggerName, time);

var impl = new MapTransformer();
var map = impl.transform(logRecord); // convert the logRecord to a map
String json = stringify(map); // convert the map to json with dart:json
Map map2 = parse(json); // convert the json back to a map
var map = impl.transform(logRecord); // convert the logRecord to a map
String json = JSON.encode(map); // convert the map to json with dart:json
Map map2 = JSON.decode(json); // convert the json back to a map

expect(map2["message"], equals(logRecord.message));
expect(map2["loggerName"], equals(logRecord.loggerName));
expect(map2["level"], equals(logRecord.level.name));
Expand All @@ -123,10 +123,10 @@ runMapTransformerTests() {
"Exception text");

var impl = new MapTransformer();
var map = impl.transform(logRecord); // convert the logRecord to a map
String json = stringify(map); // convert the map to json with dart:json
Map map2 = parse(json); // convert the json back to a map
var map = impl.transform(logRecord); // convert the logRecord to a map
String json = JSON.encode(map); // convert the map to json with dart:json
Map map2 = JSON.decode(json); // convert the json back to a map

expect(map2["message"], equals(logRecord.message));
expect(map2["loggerName"], equals(logRecord.loggerName));
expect(map2["level"], equals(logRecord.level.name));
Expand Down