Skip to content

TestFramework: [VM and YYC] json_stringify_test #4 in BasicJsonTestSuite, json_stringify ( struct:local, ..., replacer ), use custom replace funnction (structs are not equal) #14335

@ksuchitra532

Description

@ksuchitra532

Workflow Artifact URL

https://github.com/YoYoGames/GM-TestFramework/actions/runs/22700744457/artifacts/5772535381

Test Code

	addFact("json_stringify_test #4", function() {

		var _struct, _output, _jsonStr;
	
		// ========== REPLACED ==========
			
		_struct = {
			version: 2,
			myArray: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
			myFunction: function() {}
		}

		_jsonStr = json_stringify(_struct, false, function(_key, _value) {
			if (is_callable(_value)) return "func";
			if (is_array(_value)) return "array";
			return _value;
		});
		
		_output = json_parse(_jsonStr);
		
		var _test = {
			version: 2,
			myArray: "array",
			myFunction: "func",
		}
		
		assert_struct_equals(_test, _output, "json_stringify ( struct:local, ..., replacer ), use custom replace funnction (structs are not equal)")			
	});

Output From The Test

Test Name: json_stringify_test #4
Title: Asserted two structs to be equal
Description: json_stringify ( struct:local, ..., replacer ), use custom replace funnction (structs are not equal)
Expected Value: {"version":"func","myArray":"array"}
Actual Value: {"version":2.0,"myFunction":"func","myArray":"array"}
Stack: gml_Script_anon@10455@BasicJsonTestSuite@BasicJsonTestSuite

Runtime Version

2024.1400.4.988

Location Of The Test

https://github.com/YoYoGames/GM-TestFramework/blob/develop/projects/xUnit/scripts/BasicJsonTestSuite/BasicJsonTestSuite.gml#L372-L399

Which platform(s) are you seeing the problem on?

Windows

Metadata

Metadata

Assignees

Labels

TestFrameworkBugs found by TestFramework

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions