class Rbspy < Formula desc "Sampling profiler for Ruby" homepage "https://rbspy.github.io/" url "https://github.com/rbspy/rbspy/archive/v0.6.0.tar.gz" sha256 "72ba0aaf12f365efa889a2c7a65c86d98eb11beddb3f8ebb6e5a1a9fad15b562" license "MIT" bottle do sha256 cellar: :any_skip_relocation, arm64_big_sur: "4feabc6698696353166e912e65d17b1f9523135377f607777330d093087247c8" sha256 cellar: :any_skip_relocation, big_sur: "834932b878ad43662ed6e165546f2f36c6b6185043fe474a78db2384f1bea884" sha256 cellar: :any_skip_relocation, catalina: "e7258054afaaf8e9635fd855339e3c75db2e2472da4c8651ba90bf38bbf6ef47" sha256 cellar: :any_skip_relocation, mojave: "783a995631ed3a73725707dee18c903e36ced198349945231e749bc93cc9b42b" end depends_on "rust" => :build def install system "cargo", "install", *std_cargo_args end test do recording = <<~EOS H4sICDJNbmAAA3JlcG9ydAC9ks1OwzAQhO88RbUnkKzGqfPTRIi34FRV1to11MKxLdtphaq8O w5QVEEPnHrd2ZlPu5ogon+nq7sTRBy8UTxgUtCXlBIIs8YPKkTtLPRAl9WSAYGYMCSe9JAXs0 /JyKO2UnHlndxnc1O2bcfWrCJg0bpfct2UrOsopdOUsSmgzDmbU16dAyEapfxiIxcvo5Upk7c ZGZTBpA+Ke0w5Au5H+2bd0T5kDUV0ZkxnzY7GEDDaKuugpxP5SUbEK1Hfd/vgXgMOyyD+RkLx HPMXChHUsfj8SnHNdWayC6YQ4ibM9oIppbwJsywvoI8Davt0Gy6btgS83uWzq1XTEkj7oHDH5 0lVreuqrlmTC/yPitZXK1rSlrbNV0U/ACePNHUiAwAA EOS (testpath/"recording.gz").write Base64.decode64(recording.delete("\n")) system bin/"rbspy", "report", "-f", "summary", "-i", "recording.gz", "-o", "result" expected_result = <<~EOS % self % total name 100.00 100.00 sleep [c function] - (unknown) 0.00 100.00 ccc - sample_program.rb 0.00 100.00 bbb - sample_program.rb 0.00 100.00 aaa - sample_program.rb 0.00 100.00
- sample_program.rb EOS assert_equal File.read("result"), expected_result end end