Merge pull request #1 from jpfeiffer16/master

change de-json:html to de:json:html
This commit is contained in:
~litlep-nibbyt 2023-12-21 23:09:56 -05:00 committed by GitHub
commit de8be242c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 36 deletions

View File

@ -95,7 +95,7 @@ sanitized, we need to rerun sanitize on the input json so that they match.
```dojo
> =p -build-file /=john=/lib/punch/hoon
> (parse (sanitize:p (need (de-json:html j))))
> (parse (sanitize:p (need (de:json:html j))))
[ name='string'
popularity=0
images=[url='https://i.scdn.co/image/ab67616d00001e02ff9ca10b55ce82ae553c8228' width=300 height=300]

View File

@ -4,5 +4,5 @@
:- %tang
=/ parse=hoon
%- ~(start punch:p lab sani)
(need (de-json:html jon))
(flop (turn wall:(need ((p-hoon:hoon-format parse) 0 | 0)) |=(=tape leaf+tape)))
(need (de:json:html jon))
(flop (turn wall:(need ((p-hoon:hoon-format parse) 0 | 0)) |=(=tape leaf+tape)))

View File

@ -3,7 +3,7 @@
::
++ show-json
|= =vase
(en-json:html (en-vase vase))
(en:json:html (en-vase vase))
::
++ en-vase
|= [typ=type arg=*]
@ -175,4 +175,4 @@
%ui [%n `@t`(rsh [3 2] (scot %ui dat))]
%ud [%n (scot %ud dat)]
==
--
--

View File

@ -7,7 +7,7 @@
:: +to-hoon: calls the hoon-format library on the result of +start
++ to-hoon
|= c=cord
=/ jon=json (need (de-json:html c))
=/ jon=json (need (de:json:html c))
wall:(need ((p-hoon:hoon-format (start jon)) 0 | 0))
::
:: +start: calls +dumb, appends %tscm to top of AST for brevity

View File

@ -20,17 +20,17 @@
%+ expect-eq
::
:: Then, the result for x1 should be a json number 5,
!>((need (de-json:html '5')))
!>((need (de:json:html '5')))
!>((en-vase:e !>(x1)))
%+ expect-eq
::
:: the result for x2 should be a json string "five",
!>((need (de-json:html '"five"')))
!>((need (de:json:html '"five"')))
!>((en-vase:e !>(x2)))
%+ expect-eq
::
:: and the result for x3 should be a json boolean 'true'
!>((need (de-json:html 'true')))
!>((need (de:json:html 'true')))
!>((en-vase:e !>(x3)))
%+ expect-eq
::
@ -54,17 +54,17 @@
%+ expect-eq
::
:: Then, the result for x1 should be a json array of true, false, true,
!>((need (de-json:html '[true, false, true]')))
!>((need (de:json:html '[true, false, true]')))
!>((en-vase:e !>(x1)))
::
:: the result for x2 should be a json array of "fee", "fi", "fo",
%+ expect-eq
!>((need (de-json:html '["fee", "fi", "fo"]')))
!>((need (de:json:html '["fee", "fi", "fo"]')))
!>((en-vase:e !>(x2)))
::
:: and the result for x2 should be a json array of 1,2,3
%+ expect-eq
!>((need (de-json:html '[1,2,3]')))
!>((need (de:json:html '[1,2,3]')))
!>((en-vase:e !>(x3)))
==
::
@ -80,13 +80,13 @@
%+ expect-eq
::
:: Then, the result for x1 should be the `json` object below
!>((need (de-json:html '{"a": 1, "b": "value"}')))
!>((need (de:json:html '{"a": 1, "b": "value"}')))
!>((en-vase:e !>(x1)))
%+ expect-eq
::
:: Then, the result for x2 should be the `json` object below
!>((need (de-json:html '{"a": 1, "b": [1,2,"last"]}')))
!>((need (de:json:html '{"a": 1, "b": [1,2,"last"]}')))
!>((en-vase:e !>(x2)))
==
::
--
--

View File

@ -7,7 +7,7 @@
:: a json null, named jon1
=/ jon1=json
%- need
%- de-json:html
%- de:json:html
'null'
::
:: Whens,
@ -31,13 +31,13 @@
:: a json boolean, named jon1 holding the value: 'true'
=/ jon1=json
%- need
%- de-json:html
%- de:json:html
'false'
::
:: a json boolean, named jon2 holding the value: 'false'.
=/ jon2=json
%- need
%- de-json:html
%- de:json:html
'true'
::
:: Whens,
@ -70,7 +70,7 @@
:: a json string, named jon.
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'"abc123"'
::
:: Whens,
@ -91,19 +91,19 @@
:: A json number, named jon1 holding an integer value.
=/ jon1=json
%- need
%- de-json:html
%- de:json:html
'33'
::
:: A json number, named jon2 holding a decimal value.
=/ jon2=json
%- need
%- de-json:html
%- de:json:html
'33.33'
::
:: and a json number named jon3 holding a negative decimal value.
=/ jon3=json
%- need
%- de-json:html
%- de:json:html
'-33.33'
::
:: When I use the +start arm with faces disabled
@ -139,7 +139,7 @@
:: Given a json array named `jon` consisting of 3 elements of string, number, and boolean respectively.
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'["A", 0.5, false]'
::
:: When I use the +start arm with faces disabled,
@ -157,7 +157,7 @@
:: Given a json array named `jon` consisting of 3 elements, each of the string type.
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'["A", "B", "C"]'
::
:: When I use the +start arm inside with faces disabled,
@ -175,7 +175,7 @@
:: Given a json object named `jon` with one key holding a number,
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"key": 10}'
::
:: When I use the +start arm with faces disabled,
@ -192,7 +192,7 @@
:: Given a json object named `jon` which consists of nested objects 1 layer deep,
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"outer": {"inner": 10}}'
::
:: When I use the +start arm inside with faces disabled,
@ -216,7 +216,7 @@
:: Given a json object named `jon` with one key holding an array with three string elements,
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"outer": ["J", "G", "Ballard"]}'
::
:: When I use the +start arm with faces disabled,
@ -241,7 +241,7 @@
:: Given a json object named `jon` with one key holding an array with three elements,
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"outer": ["Ness", 10, 5, 5.35]}'
::
:: When I use the +start arm with faces disabled,
@ -252,4 +252,4 @@
|. =/ parse=hoon (~(start punch:p %| %|) jon)
=/ g !<($-(json stats) (slap !>(.) parse))
`stats`(g jon)
--
--

View File

@ -8,7 +8,7 @@
::
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"Aardvark": 11}'
::
:: Whens,
@ -35,7 +35,7 @@
::
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"AardVark": 11}'
::
:: Whens,
@ -63,7 +63,7 @@
::
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"@@rdv-@rk$%.": 11}'
::
:: Whens,
@ -92,7 +92,7 @@
::
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"aard_vark_apts": 11}'
::
:: Whens,
@ -119,7 +119,7 @@
::
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"aard vark apts": 11}'
::
:: When,
@ -145,11 +145,11 @@
::
=/ jon=json
%- need
%- de-json:html
%- de:json:html
'{"@#$#$%@^&+": 11}'
::
:: Thens, +sanitize will fail
::
%- expect-fail
|.((sanitize:p jon))
--
--