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

Refactor and enhance Colorize #3925

Closed
Closed
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
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@

LLVM_CONFIG ?= ## llvm-config command path to use

release ?= ## Compile in release mode
stats ?= ## Enable statistics output
threads ?= ## Maximum number of threads to use
debug ?= ## Add symbolic debug info
verbose ?= ## Run specs in verbose mode
release ?= ## Compile in release mode
stats ?= ## Enable statistics output
threads ?= ## Maximum number of threads to use
debug ?= ## Add symbolic debug info
verbose ?= ## Run specs in verbose mode
color ?= auto ## Colorize the output

O := .build
SOURCES := $(shell find src -name '*.cr')
SPEC_SOURCES := $(shell find spec -name '*.cr')
# TODO: Uncomment below after next release.
# FLAGS := --color=$(color)$(if $(release), --release)$(if $(stats), --stats)$(if $(threads), --threads $(threads))$(if $(debug), -d)
FLAGS := $(if $(release),--release )$(if $(stats),--stats )$(if $(threads),--threads $(threads) )$(if $(debug),-d )
VERBOSE := $(if $(verbose),-v )
COLOR := --color=$(color)
EXPORTS := $(if $(release),,CRYSTAL_CONFIG_PATH=`pwd`/src)
SHELL = bash
LLVM_CONFIG_FINDER := \
Expand Down Expand Up @@ -73,15 +77,15 @@ help: ## Show this help

.PHONY: spec
spec: $(O)/all_spec ## Run all specs
$(O)/all_spec $(VERBOSE)
$(O)/all_spec $(COLOR) $(VERBOSE)

.PHONY: std_spec
std_spec: $(O)/std_spec ## Run standard library specs
$(O)/std_spec $(VERBOSE)
$(O)/std_spec $(COLOR) $(VERBOSE)

.PHONY: compiler_spec
compiler_spec: $(O)/compiler_spec ## Run compiler specs
$(O)/compiler_spec $(VERBOSE)
$(O)/compiler_spec $(COLOR) $(VERBOSE)

.PHONY: doc
doc: ## Generate standard library documentation
Expand Down
8 changes: 4 additions & 4 deletions bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ prepare_system() {
}

build() {
with_build_env 'make std_spec clean'
with_build_env 'make crystal spec doc'
with_build_env 'find samples -name "*.cr" | xargs -L 1 ./bin/crystal build --no-codegen'
with_build_env './bin/crystal tool format --check samples spec src'
with_build_env 'make std_spec clean color=always'
with_build_env 'make crystal spec doc color=always'
with_build_env 'find samples -name "*.cr" | xargs -L 1 ./bin/crystal build --color=always --no-codegen'
with_build_env './bin/crystal tool format --color=always --check samples spec src'
}

deploy() {
Expand Down
4 changes: 1 addition & 3 deletions spec/compiler/semantic/did_you_mean_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ describe "Semantic: did you mean" do
end

it "suggests a better alternative to logical operators (#2715)" do
message = "undefined method 'and'"
message = " (did you mean '&&'?)".colorize.yellow.bold.to_s
assert_error %(
def rand(x : Int32)
end
Expand All @@ -252,7 +250,7 @@ describe "Semantic: did you mean" do
if "a".bytes and 1
1
end
), message
), "did you mean '&&'?"
end

it "says did you mean in instance var declaration" do
Expand Down
Loading