From 63164470b7eaa26e6363586bf2bee86a61629956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6stlin?= Date: Sat, 23 Dec 2023 00:20:37 +0100 Subject: [PATCH] refactoring: Sort imports --- dub.sdl | 5 +---- dub.selections.json | 3 +-- source/colored/package.d | 26 ++++++-------------------- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/dub.sdl b/dub.sdl index 75776b3..3532b4a 100644 --- a/dub.sdl +++ b/dub.sdl @@ -7,8 +7,6 @@ license "MIT" x:ddoxFilterArgs "--min-protection=Public" x:ddoxTool "scod" -preGenerateCommands "$DC --version" - configuration "library" { targetPath "out/lib" excludedSourceFiles "source/testsuite.d" @@ -19,8 +17,7 @@ configuration "unittest" { targetName "unittest" targetPath "out/test" - dependency "unit-threaded" version="~>2.1.2" -// dependency "color" version="~>0.0.9" + dependency "unit-threaded" version="~>2.1.7" mainSourceFile "source/testsuite.d" postRunCommands "$DUB run lst2errormessages || true" diff --git a/dub.selections.json b/dub.selections.json index da5d7f6..f7f37fd 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -1,7 +1,6 @@ { "fileVersion": 1, "versions": { - "color": "0.0.9", - "unit-threaded": "2.1.2" + "unit-threaded": "2.1.7" } } diff --git a/source/colored/package.d b/source/colored/package.d index eb8f8a3..d721a6d 100644 --- a/source/colored/package.d +++ b/source/colored/package.d @@ -9,13 +9,13 @@ module colored; @safe: -import std.algorithm : map, filter, joiner; +import std.algorithm : filter, joiner, map; import std.array : join, split; import std.conv : to; import std.format : format; import std.functional : not; import std.range : ElementType, empty, front, popFront; -import std.regex : ctRegex, Captures, replaceAll; +import std.regex : Captures, ctRegex, replaceAll; import std.string : toUpper; import std.traits : EnumMembers; @@ -25,7 +25,8 @@ version (unittest) import core.time : msecs; import std.conv : to; import std.process : environment; - import std.stdio : writeln, write; + import std.stdio : write, writeln; + import unit_threaded : should; } /// Available Colors enum AnsiColor @@ -181,9 +182,9 @@ string onRgb(string s, ubyte r, ubyte g, ubyte b) /+ @system @("rgb") unittest { - import unit_threaded; - import std.experimental.color : RGBA8, convertColor; + import std.experimental.color : convertColor, RGBA8; import std.experimental.color.hsx : HSV; + import unit_threaded; writeln("red: ", "r".rgb(255, 0, 0).onRgb(0, 255, 0)); writeln("green: ", "g".rgb(0, 255, 0).onRgb(0, 0, 255)); @@ -218,7 +219,6 @@ string onRgb(string s, ubyte r, ubyte g, ubyte b) @system @("styledstring") unittest { - import unit_threaded; foreach (immutable color; [EnumMembers!AnsiColor]) { @@ -242,7 +242,6 @@ string onRgb(string s, ubyte r, ubyte g, ubyte b) @system @("styledstring ~") unittest { - import unit_threaded; ("test".red ~ "blub").should == "\033[31mtest\033[0mblub"; } @@ -286,8 +285,6 @@ mixin(styleMixin!Style); @system @("api") unittest { - import unit_threaded; - "redOnGreen".red.onGreen.writeln; "redOnYellowBoldUnderlined".red.onYellow.bold.underlined.writeln; "bold".bold.writeln; @@ -421,8 +418,6 @@ auto tokenize(Range)(Range parts) @system @("ansi tokenizer") unittest { - import unit_threaded; - [38, 5, 2, 38, 2, 1, 2, 3, 36, 1, 2, 3, 4].tokenize.should == ([ [38, 5, 2], [38, 2, 1, 2, 3], [36], [1], [2], [3], [4] ]); @@ -483,9 +478,6 @@ bool all(uint[]) @system @("configurable strip") unittest { - import unit_threaded; - import std.functional : not; - "test".red .onGreen .bold @@ -539,8 +531,6 @@ auto leftJustifyFormattedString(string s, ulong width, dchar fillChar = ' ') @system @("leftJustifyFormattedString") unittest { - import unit_threaded; - "test".red.to!string.leftJustifyFormattedString(10) .to!string.should == "\033[31mtest\033[0m "; } @@ -559,8 +549,6 @@ auto rightJustifyFormattedString(string s, ulong width, char fillChar = ' ') @system @("rightJustifyFormattedString") unittest { - import unit_threaded; - "test".red.to!string.rightJustifyFormattedString(10).should == (" \033[31mtest\033[0m"); } @@ -573,8 +561,6 @@ auto forceStyle(string text, Style style) @("forceStyle") unittest { - import unit_threaded; - auto splitt = "1es2eses3".split("es").filter!(not!(empty)); splitt.should == ["1", "2", "3"]; string s = "noformatting%snoformatting".format("red".red).forceStyle(Style.reverse);