Skip to content
Snippets Groups Projects
Commit b4e45809 authored by David Trattnig's avatar David Trattnig
Browse files

Test: Add case with typed parsing

parent 1274db73
No related branches found
No related tags found
1 merge request!3Liquidsoap 2 migration
......@@ -20,19 +20,27 @@
%include "base_config.liq"
# Submitted bug report: https://github.com/savonet/liquidsoap/issues/2483
# Compare: https://github.com/savonet/liquidsoap/issues/2483
# Scenario 1: Doesn't work
let json.parse data = '{"show_id": "-1", "show_name": "Random Music"}'
print("Set current show to '#{data.show_name}' (ID: #{data.show_id})")
# > Set current show to 'null' (ID: null)
# Scenario 2: Works
# Scenario 2: Works, when data types of the JSON have been defined
let json.parse (data : {
show_id: string,
show_name: string
}) = '{"show_id": "-1", "show_name": "Random Music"}'
print("Set current show to '#{data.show_name}' (ID: #{data.show_id})")
# # > Set current show to 'Random Music' (ID: -1)
# Scenario 3: Works, even when no data types have been defined
let json.parse data = '{"show_id": "-1", "show_name": "Random Music"}'
print("Set current show to '" ^ data.show_name ^ "' (ID: " ^ data.show_id ^ ")")
# > Set current show to 'Random Music' (ID: -1)
# # > Set current show to 'Random Music' (ID: -1)
# Scenario 3: Works, when variables have been accessed outside the string before
# Scenario 4: Works, when variables have been accessed outside the string before
let json.parse data = '{"show_id": "-1", "show_name": "Random Music"}'
print("Set current show to '" ^ data.show_name ^ "' (ID: " ^ data.show_id ^ ")")
print("Set current show to '#{data.show_name}' (ID: #{data.show_id})")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment