Skip to content

Commit

Permalink
Add pending_wasm32
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Dec 13, 2023
1 parent 59095ff commit 66ecc6b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 11 deletions.
1 change: 0 additions & 1 deletion spec/compiler/crystal/tools/init_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require "spec"
require "yaml"
require "../../../support/tempfile"
require "../../../support/env"
require "../../../support/win32"

private def exec_init(project_name, project_dir = nil, type = "lib", force = false, skip_existing = false)
args = [type, project_name]
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require "compiler/requires"
require "./support/syntax"
require "./support/tempfile"
require "./support/win32"
require "./support/wasm32"

class Crystal::Program
setter temp_var_counter
Expand Down
1 change: 0 additions & 1 deletion spec/std/socket/address_spec.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require "spec"
require "socket"
require "../../support/win32"
require "spec/helpers/string"

describe Socket::Address do
Expand Down
1 change: 0 additions & 1 deletion spec/std/socket/socket_spec.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require "./spec_helper"
require "../../support/tempfile"
require "../../support/win32"

describe Socket, tags: "network" do
describe ".unix" do
Expand Down
1 change: 0 additions & 1 deletion spec/std/socket/tcp_socket_spec.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{% skip_file if flag?(:wasm32) %}

require "./spec_helper"
require "../../support/win32"

describe TCPSocket, tags: "network" do
describe "#connect" do
Expand Down
1 change: 1 addition & 0 deletions spec/std/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require "spec"
require "../support/tempfile"
require "../support/fibers"
require "../support/win32"
require "../support/wasm32"

def datapath(*components)
File.join("spec", "std", "data", *components)
Expand Down
12 changes: 5 additions & 7 deletions spec/std/string_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2687,14 +2687,12 @@ describe "String" do
end
end

{% unless flag?(:wasm32) %}
it "allocates buffer of correct size (#3332)" do
String.new(255_u8) do |buffer|
LibGC.size(buffer).should be > 255
{255, 0}
end
pending_wasm32 "allocates buffer of correct size (#3332)" do
String.new(255_u8) do |buffer|
LibGC.size(buffer).should be > 255
{255, 0}
end
{% end %}
end

it "raises if returned bytesize is greater than capacity" do
expect_raises ArgumentError, "Bytesize out of capacity bounds" do
Expand Down
19 changes: 19 additions & 0 deletions spec/support/wasm32.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require "spec"

{% if flag?(:wasm32) %}
def pending_wasm32(description = "assert", file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block)
pending("#{description} [wasm32]", file, line, end_line)
end

def pending_wasm32(*, describe, file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block)
pending_wasm32(describe, file, line, end_line) { }
end
{% else %}
def pending_wasm32(description = "assert", file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block)
it(description, file, line, end_line, &block)
end

def pending_wasm32(*, describe, file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block)
describe(describe, file, line, end_line, &block)
end
{% end %}

0 comments on commit 66ecc6b

Please sign in to comment.