Skip to content

Commit

Permalink
Merge pull request #23 from hahwul/hahwul-dev
Browse files Browse the repository at this point in the history
Add Spec for valid_json, valid_yaml
  • Loading branch information
hahwul authored Aug 17, 2023
2 parents 12c7040 + ad37eec commit 320596f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/utils_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,21 @@ describe "str_to_bool" do
str_to_bool("hahwul").should eq(false)
end
end

describe "valid_json?" do
it "valid json" do
valid_json?("{\"test\":\"test\"}").should eq(true)
end
it "invalid json" do
valid_json?("{\"test\":\"test\"").should eq(false)
end
end

describe "valid_yaml?" do
it "valid yaml" do
valid_yaml?("test: test").should eq(true)
end
it "invalid yaml" do
valid_yaml?(":").should eq(false)
end
end

0 comments on commit 320596f

Please sign in to comment.