mirror of
https://github.com/iv-org/invidious.git
synced 2025-11-04 14:18:30 -06:00
Commit the whole ./lib/ folder which stores the Crystal dependencies. This has a few benefits: - Allows to build the project without a connection to the Internet to retrieve dependencies. - Makes the project resistant against dependency re-tags which might include malicious code.
24 lines
742 B
Crystal
24 lines
742 B
Crystal
require "spec"
|
|
require "../../src/pq/param"
|
|
|
|
private def it_encodes_array(value, encoded)
|
|
it "encodes #{value.class}" do
|
|
PQ::Param.encode_array(value).should eq encoded
|
|
end
|
|
end
|
|
|
|
describe PQ::Param do
|
|
describe "encoders" do
|
|
describe "#encode_array" do
|
|
it_encodes_array([] of String, "{}")
|
|
it_encodes_array([true, false, true], "{t,f,t}")
|
|
it_encodes_array(["t", "f", "t"], %({"t","f","t"}))
|
|
it_encodes_array([1, 2, 3], "{1,2,3}")
|
|
it_encodes_array([1.2, 3.4, 5.6], "{1.2,3.4,5.6}")
|
|
it_encodes_array([%(a), %(\\b~), %(c\\"d), %(\uFF8F)], %({"a","\\\\b~","c\\\\\\"d","\uFF8F"}))
|
|
it_encodes_array(["baz, bar"], %({"baz, bar"}))
|
|
it_encodes_array(["foo}"], %({"foo}"}))
|
|
end
|
|
end
|
|
end
|