Sort.nsi 819 B

123456789101112131415161718192021222324252627282930313233343536
  1. !include MUI2.nsh
  2. Name `nsJSON plug-in`
  3. OutFile nsJSON_Sort.exe
  4. RequestExecutionLevel user
  5. ShowInstDetails show
  6. !insertmacro MUI_PAGE_INSTFILES
  7. !insertmacro MUI_LANGUAGE English
  8. !macro nJSON_Sort_Test Options
  9. nsJSON::Sort /options ${Options} /end
  10. nsJSON::Get /end
  11. Pop $R0
  12. DetailPrint $R0
  13. !macroend
  14. !define nJSON_Sort_Test `!insertmacro nJSON_Sort_Test`
  15. Section
  16. nsJSON::Set /value `{ "D": "X", "b": 3, "a": 22, "c" : 2, "d": "x", "y": { "f": 33, "a": 9, "n": [ 1, 5, -10, 11, "m" ] } }` /end
  17. DetailPrint `Sorted root node values only`
  18. ${nJSON_Sort_Test} 0
  19. DetailPrint `Sorted root node values only numerically`
  20. ${nJSON_Sort_Test} 2
  21. DetailPrint `Sorted root node by keys only`
  22. ${nJSON_Sort_Test} 8
  23. DetailPrint `Sorted values numerically + recursively`
  24. ${nJSON_Sort_Test} 18
  25. SectionEnd