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

Test: Enhance test cases with new assert function

parent def6a844
No related branches found
No related tags found
1 merge request!3Liquidsoap 2 migration
......@@ -27,3 +27,6 @@ print("Config file used: #{config}")
ini = read_ini(config)
log("Read configuration:\n${ini}")
print(ini)
soundsystem = list.assoc(default="", "soundsystem", ini)
assertEquals(soundsystem, "alsa")
\ No newline at end of file
......@@ -25,6 +25,8 @@ settings.frame.audio.samplerate.set(44100)
input_fs = single(id="fs", "assets/audio.mp3")
def process(metadata) =
print(json.stringify(metadata))
assertEquals(metadata["album"], "ccMixter")
shutdown(code=0)
end
input_fs.on_metadata(process)
output.dummy(id="dummy", input_fs)
......@@ -25,6 +25,7 @@
# 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})")
assertEquals("#{data.show_name}", "null")
# > Set current show to 'null' (ID: null)
# Scenario 2: Works, when data types of the JSON have been defined
......@@ -33,16 +34,26 @@ let json.parse (data : {
show_name: string
}) = '{"show_id": "-1", "show_name": "Random Music"}'
print("Set current show to '#{data.show_name}' (ID: #{data.show_id})")
assertEquals(data.show_name, "Random Music")
assertEquals(data.show_id, "-1")
# # > 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 ^ ")")
assertEquals(data.show_name, "Random Music")
assertEquals(data.show_id, "-1")
# # > Set current show to 'Random Music' (ID: -1)
# 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 ^ ")")
assertEquals(data.show_name, "Random Music")
assertEquals(data.show_id, "-1")
print("Set current show to '#{data.show_name}' (ID: #{data.show_id})")
assertEquals(data.show_name, "Random Music")
assertEquals(data.show_id, "-1")
# > Set current show to 'Random Music' (ID: -1)
# > Set current show to 'Random Music' (ID: -1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment